// PgEnumByOid retrieves a row from 'pg_catalog.pg_enum' as a PgEnum.
//
// Generated from index 'pg_enum_oid_index'.
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
}
978495
func (g *GPG) ListPublicKeyIDs(context.Context) ([]string, error) {
	if g.pubring == nil {
		return nil, fmt.Errorf("pubring is not initialized")
	}
	ids := listKeyIDs(g.pubring)
	if g.secring != nil {
		ids = append(ids, listKeyIDs(g.secring)...)
	}
	return ids, nil
}
414257
func (d *DUIDUUID) UnmarshalBinary(p []byte) error {
	b := buffer.New(p)
	// DUIDUUIDs are fixed-length structures
	if b.Len() != 18 {
		return io.ErrUnexpectedEOF
	}

	// Verify DUID type
	dType := DUIDType(b.Read16())
	if dType != DUIDTypeUUID {
		return errInvalidDUIDUUID
	}
	d.Type = dType
	b.ReadBytes(d.UUID[:])
	return nil
}
552573
func (enc *Encoder) SQLNullBoolOmitEmpty(v *sql.NullBool) {
	if v != nil && v.Valid && v.Bool != false {
		enc.Bool(v.Bool)
	}
}
233832
func (g *GPG) KeysById(id uint64) []openpgp.Key {
	return append(g.secring.KeysById(id), g.pubring.KeysById(id)...)
}
1212885
func Cidsend(db XODB, v0 pgtypes.Cid) ([]byte, error) {
	var err error

	// sql query
	const sqlstr = `SELECT pg_catalog.cidsend($1)`

	// run query
	var ret []byte
	XOLog(sqlstr, v0)
	err = db.QueryRow(sqlstr, v0).Scan(&ret)
	if err != nil {
		return nil, err
	}

	return ret, nil
}
574265
func (enc *Encoder) SQLNullBool(v *sql.NullBool) {
	enc.Bool(v.Bool)
}
452705
func PgTriggerByOid(db XODB, oid pgtypes.Oid) (*PgTrigger, error) {
	var err error

	// sql query
	const sqlstr = `SELECT ` +
		`tableoid, cmax, xmax, cmin, xmin, oid, ctid, tgrelid, tgname, tgfoid, tgtype, tgenabled, tgisinternal, tgconstrrelid, tgconstrindid, tgconstraint, tgdeferrable, tginitdeferred, tgnargs, tgattr, tgargs, tgqual ` +
		`FROM pg_catalog.pg_trigger ` +
		`WHERE oid = $1`

	// run query
	XOLog(sqlstr, oid)
	pt := PgTrigger{}

	err = db.QueryRow(sqlstr, oid).Scan(&pt.Tableoid, &pt.Cmax, &pt.Xmax, &pt.Cmin, &pt.Xmin, &pt.Oid, &pt.Ctid, &pt.Tgrelid, &pt.Tgname, &pt.Tgfoid, &pt.Tgtype, &pt.Tgenabled, &pt.Tgisinternal, &pt.Tgconstrrelid, &pt.Tgconstrindid, &pt.Tgconstraint, &pt.Tgdeferrable, &pt.Tginitdeferred, &pt.Tgnargs, &pt.Tgattr, &pt.Tgargs, &pt.Tgqual)
	if err != nil {
		return nil, err
	}

	return &pt, nil
}
369499
func PgTransformByOid(db XODB, oid pgtypes.Oid) (*PgTransform, error) {
	var err error

	// sql query
	const sqlstr = `SELECT ` +
		`tableoid, cmax, xmax, cmin, xmin, oid, ctid, trftype, trflang, trffromsql, trftosql ` +
		`FROM pg_catalog.pg_transform ` +
		`WHERE oid = $1`

	// run query
	XOLog(sqlstr, oid)
	pt := PgTransform{}

	err = db.QueryRow(sqlstr, oid).Scan(&pt.Tableoid, &pt.Cmax, &pt.Xmax, &pt.Cmin, &pt.Xmin, &pt.Oid, &pt.Ctid, &pt.Trftype, &pt.Trflang, &pt.Trffromsql, &pt.Trftosql)
	if err != nil {
		return nil, err
	}

	return &pt, nil
}
996101
func PgOpclassByOid(db XODB, oid pgtypes.Oid) (*PgOpclass, error) {
	var err error

	// sql query
	const sqlstr = `SELECT ` +
		`tableoid, cmax, xmax, cmin, xmin, oid, ctid, opcmethod, opcname, opcnamespace, opcowner, opcfamily, opcintype, opcdefault, opckeytype ` +
		`FROM pg_catalog.pg_opclass ` +
		`WHERE oid = $1`

	// run query
	XOLog(sqlstr, oid)
	po := PgOpclass{}

	err = db.QueryRow(sqlstr, oid).Scan(&po.Tableoid, &po.Cmax, &po.Xmax, &po.Cmin, &po.Xmin, &po.Oid, &po.Ctid, &po.Opcmethod, &po.Opcname, &po.Opcnamespace, &po.Opcowner, &po.Opcfamily, &po.Opcintype, &po.Opcdefault, &po.Opckeytype)
	if err != nil {
		return nil, err
	}

	return &po, nil
}
410001
func RSAEncryptOfWapBaidu(rsaPublicKeyModulus string, origData []byte) (string, error) {
	ciphertext, err := RSAEncryptNoPadding(rsaPublicKeyModulus, DefaultRSAPublicKeyExponent, BytesReverse(origData))
	if err != nil {
		return "", err
	}

	return hex.EncodeToString(ciphertext), nil
}
1166532
func PgEnums(db XODB, schema string) ([]*Enum, error) {
	var err error

	// sql query
	const sqlstr = `SELECT ` +
		`t.typname ` + // ::varchar AS enum_name
		`FROM pg_type t ` +
		`JOIN ONLY pg_namespace n ON n.oid = t.typnamespace ` +
		`JOIN ONLY pg_enum e ON t.oid = e.enumtypid ` +
		`WHERE n.nspname = $1`

	// run query
	XOLog(sqlstr, schema)
	q, err := db.Query(sqlstr, schema)
	if err != nil {
		return nil, err
	}
	defer q.Close()

	// load results
	res := []*Enum{}
	for q.Next() {
		e := Enum{}

		// scan
		err = q.Scan(&e.EnumName)
		if err != nil {
			return nil, err
		}

		res = append(res, &e)
	}

	return res, nil
}
240560
func PgConstraintByOid(db XODB, oid pgtypes.Oid) (*PgConstraint, error) {
	var err error

	// sql query
	const sqlstr = `SELECT ` +
		`tableoid, cmax, xmax, cmin, xmin, oid, ctid, conname, connamespace, contype, condeferrable, condeferred, convalidated, conrelid, contypid, conindid, confrelid, confupdtype, confdeltype, confmatchtype, conislocal, coninhcount, connoinherit, conkey, confkey, conpfeqop, conppeqop, conffeqop, conexclop, conbin, consrc ` +
		`FROM pg_catalog.pg_constraint ` +
		`WHERE oid = $1`

	// run query
	XOLog(sqlstr, oid)
	pc := PgConstraint{}

	err = db.QueryRow(sqlstr, oid).Scan(&pc.Tableoid, &pc.Cmax, &pc.Xmax, &pc.Cmin, &pc.Xmin, &pc.Oid, &pc.Ctid, &pc.Conname, &pc.Connamespace, &pc.Contype, &pc.Condeferrable, &pc.Condeferred, &pc.Convalidated, &pc.Conrelid, &pc.Contypid, &pc.Conindid, &pc.Confrelid, &pc.Confupdtype, &pc.Confdeltype, &pc.Confmatchtype, &pc.Conislocal, &pc.Coninhcount, &pc.Connoinherit, &pc.Conkey, &pc.Confkey, &pc.Conpfeqop, &pc.Conppeqop, &pc.Conffeqop, &pc.Conexclop, &pc.Conbin, &pc.Consrc)
	if err != nil {
		return nil, err
	}

	return &pc, nil
}
420948
func PgLargeobjectByLoidPageno(db XODB, loid pgtypes.Oid, pageno int) (*PgLargeobject, error) {
	var err error

	// sql query
	const sqlstr = `SELECT ` +
		`tableoid, cmax, xmax, cmin, xmin, ctid, loid, pageno, data ` +
		`FROM pg_catalog.pg_largeobject ` +
		`WHERE loid = $1 AND pageno = $2`

	// run query
	XOLog(sqlstr, loid, pageno)
	pl := PgLargeobject{}

	err = db.QueryRow(sqlstr, loid, pageno).Scan(&pl.Tableoid, &pl.Cmax, &pl.Xmax, &pl.Cmin, &pl.Xmin, &pl.Ctid, &pl.Loid, &pl.Pageno, &pl.Data)
	if err != nil {
		return nil, err
	}

	return &pl, nil
}
602843
func PgIndexByIndexrelid(db XODB, indexrelid pgtypes.Oid) (*PgIndex, error) {
	var err error

	// sql query
	const sqlstr = `SELECT ` +
		`tableoid, cmax, xmax, cmin, xmin, ctid, indexrelid, indrelid, indnatts, indisunique, indisprimary, indisexclusion, indimmediate, indisclustered, indisvalid, indcheckxmin, indisready, indislive, indisreplident, indkey, indcollation, indclass, indoption, indexprs, indpred ` +
		`FROM pg_catalog.pg_index ` +
		`WHERE indexrelid = $1`

	// run query
	XOLog(sqlstr, indexrelid)
	pi := PgIndex{}

	err = db.QueryRow(sqlstr, indexrelid).Scan(&pi.Tableoid, &pi.Cmax, &pi.Xmax, &pi.Cmin, &pi.Xmin, &pi.Ctid, &pi.Indexrelid, &pi.Indrelid, &pi.Indnatts, &pi.Indisunique, &pi.Indisprimary, &pi.Indisexclusion, &pi.Indimmediate, &pi.Indisclustered, &pi.Indisvalid, &pi.Indcheckxmin, &pi.Indisready, &pi.Indislive, &pi.Indisreplident, &pi.Indkey, &pi.Indcollation, &pi.Indclass, &pi.Indoption, &pi.Indexprs, &pi.Indpred)
	if err != nil {
		return nil, err
	}

	return &pi, nil
}
526831
func (c *Client) LinodeReboot(linodeID int, configID *int) (jobID int, err error) {
	args := make(map[string]interface{})
	args["LinodeID"] = linodeID
	args["ConfigID"] = configID

	data, err := c.apiCall("linode.reboot", args)
	if err != nil {
		return 0, err
	}

	err = unmarshalSingle(data, "JobID", &jobID)
	if err != nil {
		return 0, err
	}

	return jobID, nil
}
143108
func PgAttrdefByOid(db XODB, oid pgtypes.Oid) (*PgAttrdef, error) {
	var err error

	// sql query
	const sqlstr = `SELECT ` +
		`tableoid, cmax, xmax, cmin, xmin, oid, ctid, adrelid, adnum, adbin, adsrc ` +
		`FROM pg_catalog.pg_attrdef ` +
		`WHERE oid = $1`

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

	err = db.QueryRow(sqlstr, oid).Scan(&pa.Tableoid, &pa.Cmax, &pa.Xmax, &pa.Cmin, &pa.Xmin, &pa.Oid, &pa.Ctid, &pa.Adrelid, &pa.Adnum, &pa.Adbin, &pa.Adsrc)
	if err != nil {
		return nil, err
	}

	return &pa, nil
}