/*
PostLookups finds all

put all

*/
165676
func (a *Client) PostLookups(params *PostLookupsParams, authInfo runtime.ClientAuthInfoWriter) (*PostLookupsOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewPostLookupsParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "PostLookups",
		Method:             "POST",
		PathPattern:        "/lookups",
		ProducesMediaTypes: []string{"application/json", "application/x-gzip"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &PostLookupsReader{formats: a.formats},
		AuthInfo:           authInfo,
	})
	if err != nil {
		return nil, err
	}
	return result.(*PostLookupsOK), nil
}
692826
func (s *Store) FindAll(rs []rune) map[string][]Entity {
	result := make(map[string][]Entity, len(s.groups))
	for s, g := range s.groups {
		result[s] = g.Find(rs)
	}
	return result
}
894205
func (f *Finder) FindAll(ctx context.Context, resType string, paths []string, dst interface{}) error {
	for _, p := range paths {
		if err := f.Find(ctx, resType, p, dst); err != nil {
			return err
		}
	}
	return nil
}
1257165
func (t *TableMap) setupHooks(i interface{}) {
	// These hooks must be implemented on a pointer, so if a value is passed in
	// we have to get a pointer for a new value of that type in order for the
	// type assertions to pass.
	ptr := i
	if reflect.ValueOf(i).Kind() == reflect.Struct {
		ptr = reflect.New(reflect.ValueOf(i).Type()).Interface()
	}

	_, t.CanPreInsert = ptr.(PreInserter)
	_, t.CanPostInsert = ptr.(PostInserter)
	_, t.CanPostGet = ptr.(PostGetter)
	_, t.CanPreUpdate = ptr.(PreUpdater)
	_, t.CanPostUpdate = ptr.(PostUpdater)
	_, t.CanPreDelete = ptr.(PreDeleter)
	_, t.CanPostDelete = ptr.(PostDeleter)
}
703795
func (s GeoDistanceSort) Points(points ...*GeoPoint) GeoDistanceSort {
	s.points = append(s.points, points...)
	return s
}
227393
func (r *Rx) PostBuffers(buffers []RxBuffer) bool {
	for i := range buffers {
		b := r.tx.Push(sizeOfPostedBuffer)
		if b == nil {
			r.tx.Abort()
			return false
		}

		pb := &buffers[i]
		binary.LittleEndian.PutUint64(b[postedOffset:], pb.Offset)
		binary.LittleEndian.PutUint32(b[postedSize:], pb.Size)
		binary.LittleEndian.PutUint32(b[postedRemainingInGroup:], 0)
		binary.LittleEndian.PutUint64(b[postedUserData:], pb.UserData)
		binary.LittleEndian.PutUint64(b[postedID:], pb.ID)
	}

	r.tx.Flush()

	return true
}
610472
func (q *Qbs) FindAll(ptrOfSliceOfStructPtr interface{}) error {
	strucType := reflect.TypeOf(ptrOfSliceOfStructPtr).Elem().Elem().Elem()
	strucPtr := reflect.New(strucType).Interface()
	q.criteria.model = structPtrToModel(strucPtr, !q.criteria.omitJoin, q.criteria.omitFields)
	query, args := q.Dialect.querySql(q.criteria)
	return q.doQueryRows(ptrOfSliceOfStructPtr, query, args...)
}
585995
func (lkp *lookupInternal) Lookup(vcursor VCursor, ids []sqltypes.Value) ([]*sqltypes.Result, error) {
	results := make([]*sqltypes.Result, 0, len(ids))
	for _, id := range ids {
		bindVars := map[string]*querypb.BindVariable{
			lkp.FromColumns[0]: sqltypes.ValueBindVariable(id),
		}
		var err error
		var result *sqltypes.Result
		if lkp.Autocommit {
			result, err = vcursor.ExecuteAutocommit("VindexLookup", lkp.sel, bindVars, false /* isDML */)
		} else {
			result, err = vcursor.Execute("VindexLookup", lkp.sel, bindVars, false /* isDML */)
		}
		if err != nil {
			return nil, fmt.Errorf("lookup.Map: %v", err)
		}
		results = append(results, result)
	}
	return results, nil
}
1298760
func (a *API) FindResults(domain int, filter string) ([]Result, error) {
	params := make(map[string]string)
	if filter != EmptyFilter {
		params["q"] = filter
	}

	dst := make([]Result, 0)
	url := a.BuildURL("/v2/domain/%d/result", domain)
	err := a.Get(url, params, &dst)
	return dst, err
}
421155
func (col *Col) AllIndexes() (ret [][]string) {
	col.db.schemaLock.RLock()
	defer col.db.schemaLock.RUnlock()
	ret = make([][]string, 0, len(col.indexPaths))
	for _, path := range col.indexPaths {
		pathCopy := make([]string, len(path))
		for i, p := range path {
			pathCopy[i] = p
		}
		ret = append(ret, pathCopy)
	}
	return ret
}
225287
func (r *Regex) Find(data string, pos int) MatchObject {
	// if the new position is less than last search start position
	// ???: why we can't always do r.lastFound = pos?
	if pos < r.lastIndex {
		r.lastFound = pos
	}
	r.lastIndex = pos
	for ; r.lastFound < len(data); r.lastFound++ {
		ret := r.re.FindStringSubmatchIndex(data[r.lastFound:])
		if ret == nil {
			return nil
		}
		if (ret[0] + r.lastFound) >= pos {
			mo := MatchObject(ret)
			mo.fix(r.lastFound)
			return mo
		}
		if ret[0] != 0 {
			// ???: why shouldn't this be r.lastFound += ret[0]
			r.lastFound += ret[0] - 1
		}
	}
	return nil
}
767075
func NewLookupService() *LookupService {
	return &LookupService{
		NameFn: func(ctx context.Context, resource platform.ResourceType, id platform.ID) (string, error) {
			return "", nil
		},
	}
}
1343786
func (a *Client) GetLookups(params *GetLookupsParams, authInfo runtime.ClientAuthInfoWriter) (*GetLookupsOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewGetLookupsParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "GetLookups",
		Method:             "GET",
		PathPattern:        "/lookups",
		ProducesMediaTypes: []string{"application/json", "application/x-gzip"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &GetLookupsReader{formats: a.formats},
		AuthInfo:           authInfo,
	})
	if err != nil {
		return nil, err
	}
	return result.(*GetLookupsOK), nil
}
1186502
func isValidLookup(lookup string) (ok bool) {
	l := strings.TrimSpace(lookup)
	l = strings.ToLower(lookup)
	for _, v := range []string{"dns", "path", "auto"} {
		if l == v {
			return true
		}
	}
	return false
}
1364200
func (tx *Tx) AddPostCommitHook(post PostCommit) {
	tx.postHooks = append(tx.postHooks, post)
}
564250
func (r *record) PutAll(o Record) {
	if r.SameHeader(o) {
		copy(r.fields, o.AsSlice())
		r.cache = nil
	} else {
		for i, k := range r.header {
			v := o.Get(k)
			r.fields[i] = v
			if r.cache != nil {
				r.cache[k] = v
			}
		}
	}
}
341103
func (s *searchSession) postSearch(ctx context.Context) (err error) {
	defer s.indexer.Trace(ctx, func() error { return err }, "searchSession.postSearch")()
	switch s.opts.ReindexMode {
	case chat1.ReIndexingMode_POSTSEARCH_SYNC:
	default:
		return nil
	}
	for _, convID := range s.reindexConvs {
		select {
		case <-ctx.Done():
			return ctx.Err()
		default:
		}
		conv := s.getConv(convID)
		// ignore any fully indexed convs since we respect
		// opts.MaxConvsSearched
		fullyIndexed, err := s.convFullyIndexed(ctx, conv.Conv)
		if err != nil {
			return err
		}
		if fullyIndexed {
			continue
		}
		if err := s.reindexConvWithUIUpdate(ctx, conv); err != nil {
			s.indexer.Debug(ctx, "Search: postSearch: error reindexing: conv: %v convID: %v err: %v",
				conv.GetName(), conv.GetConvID(), err)
			s.inboxIndexStatus.rmConv(conv.Conv)
			continue
		}
		if s.searchDone(ctx, "postSearch") {
			continue
		}
		if err := s.searchConvWithUIUpdate(ctx, convID); err != nil {
			return err
		}
	}
	return nil
}