// SpgKdChoose calls the stored procedure 'pg_catalog.spg_kd_choose(internal, internal) void' on db.
494890
func SpgKdChoose(db XODB, v0 pgtypes.Internal, v1 pgtypes.Internal) error {
	var err error

	// sql query
	const sqlstr = `SELECT pg_catalog.spg_kd_choose($1, $2)`

	// run query
	XOLog(sqlstr)
	_, err = db.Exec(sqlstr)
	return err
}
41997
func golua_gchook(gostateindex uintptr, id uint) int {
	L1 := getGoState(gostateindex)
	L1.unregister(id)
	return 0
}
505332
func PgEnumByOid(db XODB, oid pgtypes.Oid) (*PgEnum, error) {
	var err error

	// sql query
	const sqlstr = `SELECT ` +
		`tableoid, cmax, xmax, cmin, xmin, oid, ctid, enumtypid, enumsortorder, enumlabel ` +
		`FROM pg_catalog.pg_enum ` +
		`WHERE oid = $1`

	// run query
	XOLog(sqlstr, oid)
	pe := PgEnum{}

	err = db.QueryRow(sqlstr, oid).Scan(&pe.Tableoid, &pe.Cmax, &pe.Xmax, &pe.Cmin, &pe.Xmin, &pe.Oid, &pe.Ctid, &pe.Enumtypid, &pe.Enumsortorder, &pe.Enumlabel)
	if err != nil {
		return nil, err
	}

	return &pe, nil
}
411640
func (_m *Scheduler) SelectCPUNodes(nodesInfo []types.NodeInfo, quota float64, memory int64) ([]types.NodeInfo, map[string][]types.CPUMap, int, error) {
	ret := _m.Called(nodesInfo, quota, memory)

	var r0 []types.NodeInfo
	if rf, ok := ret.Get(0).(func([]types.NodeInfo, float64, int64) []types.NodeInfo); ok {
		r0 = rf(nodesInfo, quota, memory)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).([]types.NodeInfo)
		}
	}

	var r1 map[string][]types.CPUMap
	if rf, ok := ret.Get(1).(func([]types.NodeInfo, float64, int64) map[string][]types.CPUMap); ok {
		r1 = rf(nodesInfo, quota, memory)
	} else {
		if ret.Get(1) != nil {
			r1 = ret.Get(1).(map[string][]types.CPUMap)
		}
	}

	var r2 int
	if rf, ok := ret.Get(2).(func([]types.NodeInfo, float64, int64) int); ok {
		r2 = rf(nodesInfo, quota, memory)
	} else {
		r2 = ret.Get(2).(int)
	}

	var r3 error
	if rf, ok := ret.Get(3).(func([]types.NodeInfo, float64, int64) error); ok {
		r3 = rf(nodesInfo, quota, memory)
	} else {
		r3 = ret.Error(3)
	}

	return r0, r1, r2, r3
}
1151429
func PgAggregateByAggfnoid(db XODB, aggfnoid pgtypes.Regproc) (*PgAggregate, error) {
	var err error

	// sql query
	const sqlstr = `SELECT ` +
		`tableoid, cmax, xmax, cmin, xmin, ctid, aggfnoid, aggkind, aggnumdirectargs, aggtransfn, aggfinalfn, aggmtransfn, aggminvtransfn, aggmfinalfn, aggfinalextra, aggmfinalextra, aggsortop, aggtranstype, aggtransspace, aggmtranstype, aggmtransspace, agginitval, aggminitval ` +
		`FROM pg_catalog.pg_aggregate ` +
		`WHERE aggfnoid = $1`

	// run query
	XOLog(sqlstr, aggfnoid)
	pa := PgAggregate{}

	err = db.QueryRow(sqlstr, aggfnoid).Scan(&pa.Tableoid, &pa.Cmax, &pa.Xmax, &pa.Cmin, &pa.Xmin, &pa.Ctid, &pa.Aggfnoid, &pa.Aggkind, &pa.Aggnumdirectargs, &pa.Aggtransfn, &pa.Aggfinalfn, &pa.Aggmtransfn, &pa.Aggminvtransfn, &pa.Aggmfinalfn, &pa.Aggfinalextra, &pa.Aggmfinalextra, &pa.Aggsortop, &pa.Aggtranstype, &pa.Aggtransspace, &pa.Aggmtranstype, &pa.Aggmtransspace, &pa.Agginitval, &pa.Aggminitval)
	if err != nil {
		return nil, err
	}

	return &pa, nil
}
1087936
func (api *HandshakeAPI) GetHandshakePublicKey(symkeyid string) (string, error) {
	storekey := api.ctrl.getSymKey(symkeyid)
	if storekey == nil {
		return "", fmt.Errorf("invalid symkey id %s", symkeyid)
	}
	return *storekey.pubKeyID, nil
}
675846
func NewPGPKeyfinder(g *libkb.GlobalContext, arg *PGPKeyfinderArg) *PGPKeyfinder {
	return &PGPKeyfinder{
		arg:          arg,
		Contextified: libkb.NewContextified(g),
	}
}
92203
func PgAmprocByOid(db XODB, oid pgtypes.Oid) (*PgAmproc, error) {
	var err error

	// sql query
	const sqlstr = `SELECT ` +
		`tableoid, cmax, xmax, cmin, xmin, oid, ctid, amprocfamily, amproclefttype, amprocrighttype, amprocnum, amproc ` +
		`FROM pg_catalog.pg_amproc ` +
		`WHERE oid = $1`

	// run query
	XOLog(sqlstr, oid)
	pa := PgAmproc{}

	err = db.QueryRow(sqlstr, oid).Scan(&pa.Tableoid, &pa.Cmax, &pa.Xmax, &pa.Cmin, &pa.Xmin, &pa.Oid, &pa.Ctid, &pa.Amprocfamily, &pa.Amproclefttype, &pa.Amprocrighttype, &pa.Amprocnum, &pa.Amproc)
	if err != nil {
		return nil, err
	}

	return &pa, nil
}
265557
func (m *Miniredis) HKeys(k string) ([]string, error) {
	return m.DB(m.selectedDB).HKeys(k)
}
1246235
func (c PGPClient) PGPPushPrivate(ctx context.Context, __arg PGPPushPrivateArg) (err error) {
	err = c.Cli.Call(ctx, "keybase.1.pgp.pgpPushPrivate", []interface{}{__arg}, nil)
	return
}
793713
func PdhCloseQuery(hQuery PDH_HQUERY) uint32 {
	ret, _, _ := pdh_CloseQuery.Call(uintptr(hQuery))

	return uint32(ret)
}
701782
func (scope *Scope) PrimaryKeyValue() interface{} {
	if field := scope.PrimaryField(); field != nil && field.Field.IsValid() {
		return field.Field.Interface()
	}
	return 0
}
509454
func insertKiteQuery(kiteProt *protocol.Kite, url, keyId string) (string, []interface{}, error) {
	psql := sq.StatementBuilder.PlaceholderFormat(sq.Dollar)

	kiteValues := kiteProt.Values()
	values := make([]interface{}, len(kiteValues))

	for i, kiteVal := range kiteValues {
		values[i] = kiteVal
	}

	values = append(values, url)
	values = append(values, keyId)

	return psql.Insert("kite.kite").Columns(
		"username",
		"environment",
		"kitename",
		"version",
		"region",
		"hostname",
		"id",
		"url",
		"key_id",
	).Values(values...).ToSql()
}
952182
func (c PGPClient) PGPSelect(ctx context.Context, __arg PGPSelectArg) (err error) {
	err = c.Cli.Call(ctx, "keybase.1.pgp.pgpSelect", []interface{}{__arg}, nil)
	return
}
550785
func (c *Cursor) search(key []byte, pgid pgid) {
	p, n := c.bucket.pageNode(pgid)
	if p != nil && (p.flags&(branchPageFlag|leafPageFlag)) == 0 {
		panic(fmt.Sprintf("invalid page type: %d: %x", p.id, p.flags))
	}
	e := elemRef{page: p, node: n}
	c.stack = append(c.stack, e)

	// If we're on a leaf page/node then find the specific node.
	if e.isLeaf() {
		c.nsearch(key)
		return
	}

	if n != nil {
		c.searchNode(key, n)
		return
	}
	c.searchPage(key, p)
}
635473
func (e *loginProvision) pgpProvision(m libkb.MetaContext) (err error) {
	defer m.Trace("loginProvision#pgpProvision", func() error { return err })()

	err = e.passphraseLogin(m)
	if err != nil {
		return err
	}

	// After obtaining login session, this will be called before the login state is released.
	// It tries to get the pgp key and uses it to provision new device keys for this device.
	signer, err := e.syncedPGPKey(m)
	if err != nil {
		return err
	}

	if err = e.makeDeviceKeysWithSigner(m, signer); err != nil {
		return err
	}

	e.saveToSecretStore(m)
	return nil
}
350432
func (u *User) GetActivePGPKeys(sibkey bool) (ret []*PGPKeyBundle) {
	if ckf := u.GetComputedKeyFamily(); ckf != nil {
		ret = ckf.GetActivePGPKeys(sibkey)
	}
	return
}