// ForeignOne mocks base method
191514
func (m *MockIndex) ForeignOne(arg0 imp1.Imp1) {
	m.ctrl.T.Helper()
	m.ctrl.Call(m, "ForeignOne", arg0)
}
231085
func (s UserResource) FindOne(ID string, r api2go.Request) (api2go.Responder, error) {
	user, err := s.UserStorage.GetOne(ID)
	if err != nil {
		return &Response{}, api2go.NewHTTPError(err, err.Error(), http.StatusNotFound)
	}

	user.Chocolates = []*model.Chocolate{}
	for _, chocolateID := range user.ChocolatesIDs {
		choc, err := s.ChocStorage.GetOne(chocolateID)
		if err != nil {
			return &Response{}, err
		}
		user.Chocolates = append(user.Chocolates, &choc)
	}
	return &Response{Res: user}, nil
}
381335
func selectOne(meta *KVMeta, pairs KVPairs, err error) (*KVMeta, *KVPair, error) {
	var pair *KVPair
	if len(pairs) > 0 {
		pair = pairs[0]
	}
	return meta, pair, err
}
20162
func (stmt *Stmt) ExecOne(params ...interface{}) (Result, error) {
	return stmt.execOne(context.TODO(), params...)
}
540393
func (q *Query) RunOne(model Model) error {
	tx := q.pool.NewTransaction()
	newTransactionQuery(q.query, tx).RunOne(model)
	return tx.Exec()
}
1205712
func AddOne(features []int, featuresMaxPosition []int) {
	for i := len(features) - 1; i >= 0; i-- {
		features[i] = (features[i] + 1)
		if features[i]/featuresMaxPosition[i] == 0 {
			break
		}
		features[i] = features[i] % featuresMaxPosition[i]
	}
}
1015657
func (tl TypeLoader) LoadForeignKeys(args *ArgType, tableMap map[string]*Type) (map[string]*ForeignKey, error) {
	var err error

	fkMap := map[string]*ForeignKey{}
	for _, t := range tableMap {
		// load keys per table
		err = tl.LoadTableForeignKeys(args, tableMap, t, fkMap)
		if err != nil {
			return nil, err
		}
	}

	// determine foreign key names
	for _, fk := range fkMap {
		fk.Name = args.ForeignKeyName(fkMap, fk)
	}

	// generate templates
	for _, fk := range fkMap {
		err = args.ExecuteTemplate(ForeignKeyTemplate, fk.Type.Name, fk.ForeignKey.ForeignKeyName, fk)
		if err != nil {
			return nil, err
		}
	}

	return fkMap, nil
}
1155795
func (db *baseDB) QueryOne(model, query interface{}, params ...interface{}) (Result, error) {
	return db.queryOne(context.TODO(), model, query, params...)
}
623884
func ForeignKeyConstraint(t *testing.T, repo grimoire.Repo) {
	extra := Extra{}
	repo.From(extras).MustSave(&extra)

	t.Run("ForeignKeyConstraint", func(t *testing.T) {
		// inserting
		err := repo.From(extras).Set("user_id", 1000).Insert(nil)
		assertConstraint(t, err, errors.ForeignKeyConstraint, "user_id")

		// updating
		err = repo.From(extras).Find(extra.ID).Set("user_id", 1000).Update(nil)
		assertConstraint(t, err, errors.ForeignKeyConstraint, "user_id")
	})
}
959928
func Mock(c config.Config, conn sol.Conn) *Auth {
	return create(c, conn, MockUsers(conn))
}
182426
func (t *MountTable) shallowClone() *MountTable {
	mt := &MountTable{
		Type:    t.Type,
		Entries: make([]*MountEntry, len(t.Entries)),
	}
	for i, e := range t.Entries {
		mt.Entries[i] = e
	}
	return mt
}
272895
func (m *MockIndex) ForeignFour(arg0 imp4.Imp4) {
	m.ctrl.T.Helper()
	m.ctrl.Call(m, "ForeignFour", arg0)
}
1331732
func (tm *transactionManager) filterOne(
	transID string, addr *net.UDPAddr) *transaction {

	trans := tm.getByTransID(transID)
	if trans == nil || trans.node.addr.String() != addr.String() {
		return nil
	}

	return trans
}
1048469
func MockAnything() Term {
	t := constructRootTerm("MockAnything", p.Term_DATUM, nil, nil)
	t.isMockAnything = true

	return t
}
175875
func BottleOne(id int) (*Bottle, error) {
	for _, v := range bottles {
		if id == v.ID {
			return &v, nil
		}
	}
	return nil, ErrNoRow
}
522993
func (db *DB) QueryOne(stmt Executable, i interface{}) error {
	result, err := db.Query(stmt)
	if err != nil {
		return err
	}
	// Close the result rows or sqlite3 will open another connection
	defer result.rows.Close()
	return result.One(i)
}
713929
func (e *ScanProofsEngine) CheckOne(m libkb.MetaContext, rec map[string]string, tickers ScanProofsTickers) (libkb.ProofError, bool, error) {
	uid := keybase1.UID(rec["uid"])
	sigid := keybase1.SigID(rec["sig_id"])

	foundhint := false
	hint, err := e.GetSigHint(m, uid, sigid)
	if err != nil {
		return nil, foundhint, err
	}
	if hint == nil {
		return nil, foundhint, nil
	}
	foundhint = true

	link, err := e.GetRemoteProofChainLink(m, uid, sigid)
	if err != nil {
		return nil, foundhint, err
	}

	pc, err := libkb.MakeProofChecker(m.G().GetProofServices(), link)
	if err != nil {
		return nil, foundhint, err
	}

	// Beyond this point, external requests will occur, and rate limiting is used
	ptype := link.GetProofType()
	if tickers[ptype] != nil {
		m.Info("Waiting for ticker: %v (%v)", keybase1.ProofTypeRevMap[ptype], ptype)
		<-tickers[ptype].C
	}

	pvlSource := m.G().GetPvlSource()
	if pvlSource == nil {
		return nil, foundhint, fmt.Errorf("no pvl source for proof verification")
	}
	pvlU, err := pvlSource.GetLatestEntry(m)
	if err != nil {
		return nil, foundhint, fmt.Errorf("error getting pvl: %s", err)
	}

	if _, perr := pc.CheckStatus(m, *hint, libkb.ProofCheckerModeActive, pvlU); perr != nil {
		return perr, foundhint, nil
	}

	return nil, foundhint, nil
}