// scope implements the scope interface.
321182
func (q DomainsQuery) scope(db *gorm.DB) *gorm.DB {
	var scope composedScope

	if q.Hostname != nil {
		scope = append(scope, fieldEquals("hostname", *q.Hostname))
	}

	if q.App != nil {
		scope = append(scope, forApp(q.App))
	}

	return scope.scope(db)
}
64271
func (m *scopedManager) Write(b []byte) (int, error) {
	if !m.wroteHeader {
		m.WriteHeader(http.StatusOK)
	}
	return m.ResponseWriter.Write(b)
}
922466
func (s *scopeStack) Set(name string, val Value) {
	for _, scope := range s.scopes {
		if _, ok := scope[name]; ok {
			scope[name] = val
			return
		}
	}
	s.scopes[len(s.scopes)-1][name] = val
}
368377
func (p *propScope) IsUserScope() bool {
	if p == nil {
		return false
	}
	return p.Scope == string(ESCopeUser)
}
1126208
func (aSpace *addrSpace) DataScope() string {
	aSpace.Lock()
	defer aSpace.Unlock()

	return aSpace.scope
}
1303189
func (scope *Scope) Exec() *Scope {
	defer scope.trace(NowFunc())

	if !scope.HasError() {
		if result, err := scope.SQLDB().Exec(scope.SQL, scope.SQLVars...); scope.Err(err) == nil {
			if count, err := result.RowsAffected(); scope.Err(err) == nil {
				scope.db.RowsAffected = count
			}
		}
	}
	return scope
}
1139758
func (scope *Scope) InstanceGet(name string) (interface{}, bool) {
	return scope.Get(name + scope.InstanceID())
}
415982
func (self *Scheme) fromScope(s conversion.Scope) (inVersion, outVersion string, scheme *Scheme) {
	scheme = self
	inVersion = s.Meta().SrcVersion
	outVersion = s.Meta().DestVersion
	return inVersion, outVersion, scheme
}
365286
func (e *Evaluator) Scope(data lang.Data, self addrs.Referenceable) *lang.Scope {
	return &lang.Scope{
		Data:     data,
		SelfAddr: self,
		PureOnly: e.Operation != walkApply && e.Operation != walkDestroy,
		BaseDir:  ".", // Always current working directory for now.
	}
}
351831
func (s *scopeStack) All() map[string]Value {
	res := make(map[string]Value)
	for _, scope := range s.scopes {
		for k, v := range scope {
			res[k] = v
		}
	}
	return res
}
82361
func (d *Defer) EvalScope(thread Thread) (*EvalScope, error) {
	scope, err := GoroutineScope(thread)
	if err != nil {
		return nil, fmt.Errorf("could not get scope: %v", err)
	}

	bi := thread.BinInfo()
	scope.PC = d.DeferredPC
	scope.File, scope.Line, scope.Fn = bi.PCToLine(d.DeferredPC)

	if scope.Fn == nil {
		return nil, fmt.Errorf("could not find function at %#x", d.DeferredPC)
	}

	// The arguments are stored immediately after the defer header struct, i.e.
	// addr+sizeof(_defer). Since CFA in go is always the address of the first
	// argument, that's what we use for the value of CFA.
	// For SP we use CFA minus the size of one pointer because that would be
	// the space occupied by pushing the return address on the stack during the
	// CALL.
	scope.Regs.CFA = (int64(d.variable.Addr) + d.variable.RealType.Common().ByteSize)
	scope.Regs.Regs[scope.Regs.SPRegNum].Uint64Val = uint64(scope.Regs.CFA - int64(bi.Arch.PtrSize()))

	bi.dwarfReader.Seek(scope.Fn.offset)
	e, err := bi.dwarfReader.Next()
	if err != nil {
		return nil, fmt.Errorf("could not read DWARF function entry: %v", err)
	}
	scope.Regs.FrameBase, _, _, _ = bi.Location(e, dwarf.AttrFrameBase, scope.PC, scope.Regs)
	scope.Mem = cacheMemory(scope.Mem, uintptr(scope.Regs.CFA), int(d.argSz))

	return scope, nil
}
1160177
func (a *accessToken) WithScope(scope string) Strategy {
	return &accessToken{
		accessToken: a.accessToken,
		manager:     a.manager,
		scope:       scope,
	}
}
534603
func (s *DockerVolumeConfiguration) SetScope(v string) *DockerVolumeConfiguration {
	s.Scope = &v
	return s
}
1133130
func (v *Vars) CloseScope(th *starlark.Thread) {
	switch {
	case len(v.scopes) == 0:
		panic("unexpected CloseScope call without matching OpenScope")
	case v.scopes[len(v.scopes)-1].thread != th:
		// This check may fail if Interpreter is using multiple goroutines to
		// execute 'exec's. It shouldn't. If this ever happens, we'll need to move
		// 'v.scopes' to Starlark's TLS. OpenScope will need a way to access TLS
		// of a thread that called 'exec', not only TLS of a new thread, as it does
		// now.
		panic("unexpected starlark thread")
	default:
		v.scopes = v.scopes[:len(v.scopes)-1]
	}
}
632374
func (c *ScopeTruncate) Execute(args []string) error {
	return c.doScopeOp("truncate", dosa.AdminClient.TruncateScope, c.Args.Scopes)
}
158693
func CleanScope(requestInfo *request.RequestInfo) string {
	if requestInfo.Namespace != "" {
		return "namespace"
	}
	if requestInfo.Name != "" {
		return "resource"
	}
	if requestInfo.IsResourceRequest {
		return "cluster"
	}
	// this is the empty scope
	return ""
}
320277
func (l ScopeList) Copy() ScopeList {
	scopes := make(ScopeList, len(l))
	copy(scopes, l)
	return scopes
}