Documentation
¶
Index ¶
- Constants
- type Address
- type AddressFields
- type AddressQueryer
- type AddressTable
- func (tbl AddressTable) Constraints() constraint.Constraints
- func (tbl AddressTable) Count(ctx context.Context, wh where.Expression) (count int64, err error)
- func (tbl AddressTable) CountWhere(ctx context.Context, where string, args ...interface{}) (count int64, err error)
- func (tbl AddressTable) CreateIndexes(ctx context.Context, ifNotExist bool) (err error)
- func (tbl AddressTable) CreatePostcodeIdxIndex(ctx context.Context, ifNotExist bool) error
- func (tbl AddressTable) CreateTable(ctx context.Context, ifNotExists bool) (int64, error)
- func (tbl AddressTable) CreateTableWithIndexes(ctx context.Context, ifNotExist bool) (err error)
- func (tbl AddressTable) CreateTownIdxIndex(ctx context.Context, ifNotExist bool) error
- func (tbl AddressTable) CreateUprnIdxIndex(ctx context.Context, ifNotExist bool) error
- func (tbl AddressTable) DB() pgxapi.SqlDB
- func (tbl AddressTable) Database() pgxapi.Database
- func (tbl AddressTable) Delete(ctx context.Context, req require.Requirement, wh where.Expression) (int64, error)
- func (tbl AddressTable) DeleteById(ctx context.Context, req require.Requirement, id ...int64) (int64, error)
- func (tbl AddressTable) DeleteByPostcode(ctx context.Context, req require.Requirement, postcode ...string) (int64, error)
- func (tbl AddressTable) DeleteByTown(ctx context.Context, req require.Requirement, town ...string) (int64, error)
- func (tbl AddressTable) DeleteByUprn(ctx context.Context, req require.Requirement, uprn ...string) (int64, error)
- func (tbl AddressTable) Dialect() dialect.Dialect
- func (tbl AddressTable) DropIndexes(ctx context.Context, ifExist bool) (err error)
- func (tbl AddressTable) DropPostcodeIdxIndex(ctx context.Context, ifExists bool) error
- func (tbl AddressTable) DropTable(ctx context.Context, ifExists bool) (int64, error)
- func (tbl AddressTable) DropTownIdxIndex(ctx context.Context, ifExists bool) error
- func (tbl AddressTable) DropUprnIdxIndex(ctx context.Context, ifExists bool) error
- func (tbl AddressTable) Exec(ctx context.Context, req require.Requirement, query string, ...) (int64, error)
- func (tbl AddressTable) Execer() pgxapi.Execer
- func (tbl AddressTable) Fetch(ctx context.Context, req require.Requirement, query string, ...) ([]*Address, error)
- func (tbl AddressTable) GetAddressById(ctx context.Context, req require.Requirement, id int64) (*Address, error)
- func (tbl AddressTable) GetAddressByUPRN(ctx context.Context, req require.Requirement, uprn string) (*Address, error)
- func (tbl AddressTable) GetAddressesById(ctx context.Context, req require.Requirement, qc where.QueryConstraint, ...) (list []*Address, err error)
- func (tbl AddressTable) GetAddressesByPostcode(ctx context.Context, req require.Requirement, qc where.QueryConstraint, ...) ([]*Address, error)
- func (tbl AddressTable) GetAddressesByTown(ctx context.Context, req require.Requirement, qc where.QueryConstraint, ...) ([]*Address, error)
- func (tbl AddressTable) GetAddressesByUPRN(ctx context.Context, req require.Requirement, qc where.QueryConstraint, ...) ([]*Address, error)
- func (tbl AddressTable) Insert(ctx context.Context, req require.Requirement, vv ...*Address) error
- func (tbl AddressTable) IsTx() bool
- func (tbl AddressTable) Logger() pgxapi.Logger
- func (tbl AddressTable) Name() pgxapi.TableName
- func (tbl AddressTable) PkColumn() string
- func (tbl AddressTable) Query(ctx context.Context, req require.Requirement, query string, ...) ([]*Address, error)
- func (tbl AddressTable) QueryOneNullFloat64(ctx context.Context, req require.Requirement, query string, ...) (result sql.NullFloat64, err error)
- func (tbl AddressTable) QueryOneNullInt64(ctx context.Context, req require.Requirement, query string, ...) (result sql.NullInt64, err error)
- func (tbl AddressTable) QueryOneNullString(ctx context.Context, req require.Requirement, query string, ...) (result sql.NullString, err error)
- func (tbl AddressTable) Select(ctx context.Context, req require.Requirement, wh where.Expression, ...) ([]*Address, error)
- func (tbl AddressTable) SelectOne(ctx context.Context, req require.Requirement, wh where.Expression, ...) (*Address, error)
- func (tbl AddressTable) SelectOneWhere(ctx context.Context, req require.Requirement, where, orderBy string, ...) (*Address, error)
- func (tbl AddressTable) SelectWhere(ctx context.Context, req require.Requirement, where, orderBy string, ...) ([]*Address, error)
- func (tbl AddressTable) SliceId(ctx context.Context, req require.Requirement, wh where.Expression, ...) ([]int64, error)
- func (tbl AddressTable) SlicePostcode(ctx context.Context, req require.Requirement, wh where.Expression, ...) ([]string, error)
- func (tbl AddressTable) SliceTown(ctx context.Context, req require.Requirement, wh where.Expression, ...) ([]string, error)
- func (tbl AddressTable) SliceUprn(ctx context.Context, req require.Requirement, wh where.Expression, ...) ([]string, error)
- func (tbl AddressTable) Transact(ctx context.Context, txOptions *pgx.TxOptions, fn func(AddressQueryer) error) error
- func (tbl AddressTable) Truncate(ctx context.Context, force bool) (err error)
- func (tbl AddressTable) Tx() pgxapi.SqlTx
- func (tbl AddressTable) Update(ctx context.Context, req require.Requirement, vv ...*Address) (int64, error)
- func (tbl AddressTable) UpdateById(ctx context.Context, req require.Requirement, id int64, fields ...sql.NamedArg) (int64, error)
- func (tbl AddressTable) UpdateByPostcode(ctx context.Context, req require.Requirement, postcode string, ...) (int64, error)
- func (tbl AddressTable) UpdateByTown(ctx context.Context, req require.Requirement, town string, ...) (int64, error)
- func (tbl AddressTable) UpdateByUprn(ctx context.Context, req require.Requirement, uprn string, ...) (int64, error)
- func (tbl AddressTable) UpdateFields(ctx context.Context, req require.Requirement, wh where.Expression, ...) (int64, error)
- func (tbl AddressTable) Upsert(ctx context.Context, v *Address, wh where.Expression) error
- func (tbl AddressTable) Using(tx pgxapi.Execer) AddressQueryer
- func (tbl AddressTable) WithConstraint(cc ...constraint.Constraint) AddressTabler
- func (tbl AddressTable) WithPrefix(pfx string) AddressTabler
- type AddressTabler
- type DbUserQueryer
- type DbUserTable
- func (tbl DbUserTable) Constraints() constraint.Constraints
- func (tbl DbUserTable) Count(ctx context.Context, wh where.Expression) (count int64, err error)
- func (tbl DbUserTable) CountWhere(ctx context.Context, where string, args ...interface{}) (count int64, err error)
- func (tbl DbUserTable) CreateEmailaddressIdxIndex(ctx context.Context, ifNotExist bool) error
- func (tbl DbUserTable) CreateIndexes(ctx context.Context, ifNotExist bool) (err error)
- func (tbl DbUserTable) CreateTable(ctx context.Context, ifNotExists bool) (int64, error)
- func (tbl DbUserTable) CreateTableWithIndexes(ctx context.Context, ifNotExist bool) (err error)
- func (tbl DbUserTable) CreateUserLoginIndex(ctx context.Context, ifNotExist bool) error
- func (tbl DbUserTable) DB() pgxapi.SqlDB
- func (tbl DbUserTable) Database() pgxapi.Database
- func (tbl DbUserTable) Delete(ctx context.Context, req require.Requirement, wh where.Expression) (int64, error)
- func (tbl DbUserTable) DeleteByAddressid(ctx context.Context, req require.Requirement, addressid ...int64) (int64, error)
- func (tbl DbUserTable) DeleteByAvatar(ctx context.Context, req require.Requirement, avatar ...string) (int64, error)
- func (tbl DbUserTable) DeleteByEmailaddress(ctx context.Context, req require.Requirement, emailaddress ...string) (int64, error)
- func (tbl DbUserTable) DeleteByF32(ctx context.Context, req require.Requirement, f32 ...float32) (int64, error)
- func (tbl DbUserTable) DeleteByF64(ctx context.Context, req require.Requirement, f64 ...float64) (int64, error)
- func (tbl DbUserTable) DeleteByI16(ctx context.Context, req require.Requirement, i16 ...int16) (int64, error)
- func (tbl DbUserTable) DeleteByI32(ctx context.Context, req require.Requirement, i32 ...int32) (int64, error)
- func (tbl DbUserTable) DeleteByI64(ctx context.Context, req require.Requirement, i64 ...int64) (int64, error)
- func (tbl DbUserTable) DeleteByI8(ctx context.Context, req require.Requirement, i8 ...int8) (int64, error)
- func (tbl DbUserTable) DeleteByLastupdated(ctx context.Context, req require.Requirement, lastupdated ...int64) (int64, error)
- func (tbl DbUserTable) DeleteByName(ctx context.Context, req require.Requirement, name ...string) (int64, error)
- func (tbl DbUserTable) DeleteByRole(ctx context.Context, req require.Requirement, role ...Role) (int64, error)
- func (tbl DbUserTable) DeleteByU16(ctx context.Context, req require.Requirement, u16 ...uint16) (int64, error)
- func (tbl DbUserTable) DeleteByU32(ctx context.Context, req require.Requirement, u32 ...uint32) (int64, error)
- func (tbl DbUserTable) DeleteByU64(ctx context.Context, req require.Requirement, u64 ...uint64) (int64, error)
- func (tbl DbUserTable) DeleteByU8(ctx context.Context, req require.Requirement, u8 ...uint8) (int64, error)
- func (tbl DbUserTable) DeleteByUid(ctx context.Context, req require.Requirement, uid ...int64) (int64, error)
- func (tbl DbUserTable) Dialect() dialect.Dialect
- func (tbl DbUserTable) DropEmailaddressIdxIndex(ctx context.Context, ifExists bool) error
- func (tbl DbUserTable) DropIndexes(ctx context.Context, ifExist bool) (err error)
- func (tbl DbUserTable) DropTable(ctx context.Context, ifExists bool) (int64, error)
- func (tbl DbUserTable) DropUserLoginIndex(ctx context.Context, ifExists bool) error
- func (tbl DbUserTable) Exec(ctx context.Context, req require.Requirement, query string, ...) (int64, error)
- func (tbl DbUserTable) Execer() pgxapi.Execer
- func (tbl DbUserTable) Fetch(ctx context.Context, req require.Requirement, query string, ...) ([]*User, error)
- func (tbl DbUserTable) GetUserByEmailAddress(ctx context.Context, req require.Requirement, emailaddress string) (*User, error)
- func (tbl DbUserTable) GetUserByName(ctx context.Context, req require.Requirement, name string) (*User, error)
- func (tbl DbUserTable) GetUserByUid(ctx context.Context, req require.Requirement, id int64) (*User, error)
- func (tbl DbUserTable) GetUsersByEmailAddress(ctx context.Context, req require.Requirement, qc where.QueryConstraint, ...) ([]*User, error)
- func (tbl DbUserTable) GetUsersByName(ctx context.Context, req require.Requirement, qc where.QueryConstraint, ...) ([]*User, error)
- func (tbl DbUserTable) GetUsersByUid(ctx context.Context, req require.Requirement, qc where.QueryConstraint, ...) (list []*User, err error)
- func (tbl DbUserTable) Insert(ctx context.Context, req require.Requirement, vv ...*User) error
- func (tbl DbUserTable) IsTx() bool
- func (tbl DbUserTable) Logger() pgxapi.Logger
- func (tbl DbUserTable) Name() pgxapi.TableName
- func (tbl DbUserTable) PkColumn() string
- func (tbl DbUserTable) Query(ctx context.Context, req require.Requirement, query string, ...) ([]*User, error)
- func (tbl DbUserTable) QueryOneNullFloat64(ctx context.Context, req require.Requirement, query string, ...) (result sql.NullFloat64, err error)
- func (tbl DbUserTable) QueryOneNullInt64(ctx context.Context, req require.Requirement, query string, ...) (result sql.NullInt64, err error)
- func (tbl DbUserTable) QueryOneNullString(ctx context.Context, req require.Requirement, query string, ...) (result sql.NullString, err error)
- func (tbl DbUserTable) Select(ctx context.Context, req require.Requirement, wh where.Expression, ...) ([]*User, error)
- func (tbl DbUserTable) SelectOne(ctx context.Context, req require.Requirement, wh where.Expression, ...) (*User, error)
- func (tbl DbUserTable) SelectOneWhere(ctx context.Context, req require.Requirement, where, orderBy string, ...) (*User, error)
- func (tbl DbUserTable) SelectWhere(ctx context.Context, req require.Requirement, where, orderBy string, ...) ([]*User, error)
- func (tbl DbUserTable) SliceAddressid(ctx context.Context, req require.Requirement, wh where.Expression, ...) ([]int64, error)
- func (tbl DbUserTable) SliceAvatar(ctx context.Context, req require.Requirement, wh where.Expression, ...) ([]string, error)
- func (tbl DbUserTable) SliceEmailaddress(ctx context.Context, req require.Requirement, wh where.Expression, ...) ([]string, error)
- func (tbl DbUserTable) SliceF32(ctx context.Context, req require.Requirement, wh where.Expression, ...) ([]float32, error)
- func (tbl DbUserTable) SliceF64(ctx context.Context, req require.Requirement, wh where.Expression, ...) ([]float64, error)
- func (tbl DbUserTable) SliceI16(ctx context.Context, req require.Requirement, wh where.Expression, ...) ([]int16, error)
- func (tbl DbUserTable) SliceI32(ctx context.Context, req require.Requirement, wh where.Expression, ...) ([]int32, error)
- func (tbl DbUserTable) SliceI64(ctx context.Context, req require.Requirement, wh where.Expression, ...) ([]int64, error)
- func (tbl DbUserTable) SliceI8(ctx context.Context, req require.Requirement, wh where.Expression, ...) ([]int8, error)
- func (tbl DbUserTable) SliceLastupdated(ctx context.Context, req require.Requirement, wh where.Expression, ...) ([]int64, error)
- func (tbl DbUserTable) SliceName(ctx context.Context, req require.Requirement, wh where.Expression, ...) ([]string, error)
- func (tbl DbUserTable) SliceRole(ctx context.Context, req require.Requirement, wh where.Expression, ...) ([]Role, error)
- func (tbl DbUserTable) SliceU16(ctx context.Context, req require.Requirement, wh where.Expression, ...) ([]uint16, error)
- func (tbl DbUserTable) SliceU32(ctx context.Context, req require.Requirement, wh where.Expression, ...) ([]uint32, error)
- func (tbl DbUserTable) SliceU64(ctx context.Context, req require.Requirement, wh where.Expression, ...) ([]uint64, error)
- func (tbl DbUserTable) SliceU8(ctx context.Context, req require.Requirement, wh where.Expression, ...) ([]uint8, error)
- func (tbl DbUserTable) SliceUid(ctx context.Context, req require.Requirement, wh where.Expression, ...) ([]int64, error)
- func (tbl DbUserTable) Transact(ctx context.Context, txOptions *pgx.TxOptions, fn func(DbUserQueryer) error) error
- func (tbl DbUserTable) Truncate(ctx context.Context, force bool) (err error)
- func (tbl DbUserTable) Tx() pgxapi.SqlTx
- func (tbl DbUserTable) Update(ctx context.Context, req require.Requirement, vv ...*User) (int64, error)
- func (tbl DbUserTable) UpdateByAddressid(ctx context.Context, req require.Requirement, addressid int64, ...) (int64, error)
- func (tbl DbUserTable) UpdateByAvatar(ctx context.Context, req require.Requirement, avatar string, ...) (int64, error)
- func (tbl DbUserTable) UpdateByEmailaddress(ctx context.Context, req require.Requirement, emailaddress string, ...) (int64, error)
- func (tbl DbUserTable) UpdateByF32(ctx context.Context, req require.Requirement, f32 float32, ...) (int64, error)
- func (tbl DbUserTable) UpdateByF64(ctx context.Context, req require.Requirement, f64 float64, ...) (int64, error)
- func (tbl DbUserTable) UpdateByI16(ctx context.Context, req require.Requirement, i16 int16, ...) (int64, error)
- func (tbl DbUserTable) UpdateByI32(ctx context.Context, req require.Requirement, i32 int32, ...) (int64, error)
- func (tbl DbUserTable) UpdateByI64(ctx context.Context, req require.Requirement, i64 int64, ...) (int64, error)
- func (tbl DbUserTable) UpdateByI8(ctx context.Context, req require.Requirement, i8 int8, fields ...sql.NamedArg) (int64, error)
- func (tbl DbUserTable) UpdateByLastupdated(ctx context.Context, req require.Requirement, lastupdated int64, ...) (int64, error)
- func (tbl DbUserTable) UpdateByName(ctx context.Context, req require.Requirement, name string, ...) (int64, error)
- func (tbl DbUserTable) UpdateByRole(ctx context.Context, req require.Requirement, role Role, ...) (int64, error)
- func (tbl DbUserTable) UpdateByU16(ctx context.Context, req require.Requirement, u16 uint16, ...) (int64, error)
- func (tbl DbUserTable) UpdateByU32(ctx context.Context, req require.Requirement, u32 uint32, ...) (int64, error)
- func (tbl DbUserTable) UpdateByU64(ctx context.Context, req require.Requirement, u64 uint64, ...) (int64, error)
- func (tbl DbUserTable) UpdateByU8(ctx context.Context, req require.Requirement, u8 uint8, fields ...sql.NamedArg) (int64, error)
- func (tbl DbUserTable) UpdateByUid(ctx context.Context, req require.Requirement, uid int64, ...) (int64, error)
- func (tbl DbUserTable) UpdateFields(ctx context.Context, req require.Requirement, wh where.Expression, ...) (int64, error)
- func (tbl DbUserTable) Upsert(ctx context.Context, v *User, wh where.Expression) error
- func (tbl DbUserTable) Using(tx pgxapi.Execer) DbUserQueryer
- func (tbl DbUserTable) WithConstraint(cc ...constraint.Constraint) DbUserTabler
- func (tbl DbUserTable) WithPrefix(pfx string) DbUserTabler
- type DbUserTabler
- type Numbers
- type Role
- type User
- func (u *User) PostGet() error
- func (u *User) PreInsert() error
- func (u *User) PreUpdate() error
- func (v *User) SetActive(x bool) *User
- func (v *User) SetAddressId(x int64) *User
- func (v *User) SetAdmin(x bool) *User
- func (v *User) SetAvatar(x string) *User
- func (v *User) SetEmailAddress(x string) *User
- func (v *User) SetF32(x float32) *User
- func (v *User) SetF64(x float64) *User
- func (v *User) SetFave(x big.Int) *User
- func (v *User) SetI16(x int16) *User
- func (v *User) SetI32(x int32) *User
- func (v *User) SetI64(x int64) *User
- func (v *User) SetI8(x int8) *User
- func (v *User) SetLastUpdated(x int64) *User
- func (v *User) SetName(x string) *User
- func (v *User) SetRole(x Role) *User
- func (v *User) SetU16(x uint16) *User
- func (v *User) SetU32(x uint32) *User
- func (v *User) SetU64(x uint64) *User
- func (v *User) SetU8(x uint8) *User
- func (v *User) SetUid(x int64) *User
- func (v *User) Setsecret(x string) *User
- func (v *User) Settoken(x string) *User
Constants ¶
const AddressTableColumnNames = "id,lines,town,postcode,uprn"
AddressTableColumnNames is the list of columns in AddressTable.
const AddressTableDataColumnNames = "lines,town,postcode,uprn"
AddressTableDataColumnNames is the list of data columns in AddressTable.
const DbUserTableColumnNames = "uid,name,emailaddress,addressid,avatar,role,active,admin,fave,lastupdated,i8,u8,i16,u16,i32,u32,i64,u64,f32,f64,token,secret"
DbUserTableColumnNames is the list of columns in DbUserTable.
const DbUserTableDataColumnNames = "name,emailaddress,addressid,avatar,role,active,admin,fave,lastupdated,i8,u8,i16,u16,i32,u32,i64,u64,f32,f64,token,secret"
DbUserTableDataColumnNames is the list of data columns in DbUserTable.
const NumAddressTableColumns = 5
NumAddressTableColumns is the total number of columns in AddressTable.
const NumAddressTableDataColumns = 4
NumAddressTableDataColumns is the number of columns in AddressTable not including the auto-increment key.
const NumDbUserTableColumns = 22
NumDbUserTableColumns is the total number of columns in DbUserTable.
const NumDbUserTableDataColumns = 21
NumDbUserTableDataColumns is the number of columns in DbUserTable not including the auto-increment key.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Address ¶
type Address struct {
Id int64 `sql:"pk: true, auto: true"`
AddressFields
}
func ScanAddresses ¶ added in v0.50.0
func ScanAddresses(query string, rows pgxapi.SqlRows, firstOnly bool) (vv []*Address, n int64, err error)
ScanAddresses reads rows from the database and returns a slice of corresponding values. It also returns a number indicating how many rows were read; this will be larger than the length of the slice if reading stopped after the first row.
type AddressFields ¶ added in v0.60.0
type AddressQueryer ¶ added in v0.60.0
type AddressQueryer interface {
pgxapi.Table
// Using returns a modified AddressQueryer using the Execer supplied,
// which will typically be a transaction (i.e. SqlTx).
Using(tx pgxapi.Execer) AddressQueryer
// Transact runs the function provided within a transaction. The transction is committed
// unless an error occurs.
Transact(ctx context.Context, txOptions *pgx.TxOptions, fn func(AddressQueryer) error) error
// Exec executes a query without returning any rows.
Exec(ctx context.Context, req require.Requirement, query string, args ...interface{}) (int64, error)
// Query is the low-level request method for this table using an SQL query that must return all the columns
// necessary for Address values.
Query(ctx context.Context, req require.Requirement, query string, args ...interface{}) ([]*Address, error)
// QueryOneNullString is a low-level access method for one string, returning the first match.
QueryOneNullString(ctx context.Context, req require.Requirement, query string, args ...interface{}) (result sql.NullString, err error)
// QueryOneNullInt64 is a low-level access method for one int64, returning the first match.
QueryOneNullInt64(ctx context.Context, req require.Requirement, query string, args ...interface{}) (result sql.NullInt64, err error)
// QueryOneNullFloat64 is a low-level access method for one float64, returning the first match.
QueryOneNullFloat64(ctx context.Context, req require.Requirement, query string, args ...interface{}) (result sql.NullFloat64, err error)
// GetAddressById gets the record with a given primary key value.
GetAddressById(ctx context.Context, req require.Requirement, id int64) (*Address, error)
// GetAddressesById gets records from the table according to a list of primary keys.
GetAddressesById(ctx context.Context, req require.Requirement, qc where.QueryConstraint, id ...int64) (list []*Address, err error)
// GetAddressesByPostcode gets the records with a given postcode value.
GetAddressesByPostcode(ctx context.Context, req require.Requirement, qc where.QueryConstraint, postcode string) ([]*Address, error)
// GetAddressesByTown gets the records with a given town value.
GetAddressesByTown(ctx context.Context, req require.Requirement, qc where.QueryConstraint, town string) ([]*Address, error)
// GetAddressByUPRN gets the record with a given uprn value.
GetAddressByUPRN(ctx context.Context, req require.Requirement, uprn string) (*Address, error)
// GetAddressesByUPRN gets the record with a given uprn value.
GetAddressesByUPRN(ctx context.Context, req require.Requirement, qc where.QueryConstraint, uprn ...string) ([]*Address, error)
// Fetch fetches a list of Address based on a supplied query. This is mostly used for join queries that map its
// result columns to the fields of Address. Other queries might be better handled by GetXxx or Select methods.
Fetch(ctx context.Context, req require.Requirement, query string, args ...interface{}) ([]*Address, error)
// SelectOneWhere allows a single Address to be obtained from the table that matches a 'where' clause.
SelectOneWhere(ctx context.Context, req require.Requirement, where, orderBy string, args ...interface{}) (*Address, error)
// SelectOne allows a single Address to be obtained from the table that matches a 'where' clause.
SelectOne(ctx context.Context, req require.Requirement, wh where.Expression, qc where.QueryConstraint) (*Address, error)
// SelectWhere allows Addresses to be obtained from the table that match a 'where' clause.
SelectWhere(ctx context.Context, req require.Requirement, where, orderBy string, args ...interface{}) ([]*Address, error)
// Select allows Addresses to be obtained from the table that match a 'where' clause.
Select(ctx context.Context, req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]*Address, error)
// CountWhere counts Addresses in the table that match a 'where' clause.
CountWhere(ctx context.Context, where string, args ...interface{}) (count int64, err error)
// Count counts the Addresses in the table that match a 'where' clause.
Count(ctx context.Context, wh where.Expression) (count int64, err error)
// SliceId gets the id column for all rows that match the 'where' condition.
SliceId(ctx context.Context, req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int64, error)
// SliceTown gets the town column for all rows that match the 'where' condition.
SliceTown(ctx context.Context, req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
// SlicePostcode gets the postcode column for all rows that match the 'where' condition.
SlicePostcode(ctx context.Context, req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
// SliceUprn gets the uprn column for all rows that match the 'where' condition.
SliceUprn(ctx context.Context, req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
// Insert adds new records for the Addresses, setting the primary key field for each one.
Insert(ctx context.Context, req require.Requirement, vv ...*Address) error
// UpdateById updates one or more columns, given a id value.
UpdateById(ctx context.Context, req require.Requirement, id int64, fields ...sql.NamedArg) (int64, error)
// UpdateByTown updates one or more columns, given a town value.
UpdateByTown(ctx context.Context, req require.Requirement, town string, fields ...sql.NamedArg) (int64, error)
// UpdateByPostcode updates one or more columns, given a postcode value.
UpdateByPostcode(ctx context.Context, req require.Requirement, postcode string, fields ...sql.NamedArg) (int64, error)
// UpdateByUprn updates one or more columns, given a uprn value.
UpdateByUprn(ctx context.Context, req require.Requirement, uprn string, fields ...sql.NamedArg) (int64, error)
// UpdateFields updates one or more columns, given a 'where' clause.
UpdateFields(ctx context.Context, req require.Requirement, wh where.Expression, fields ...sql.NamedArg) (int64, error)
// Update updates records, matching them by primary key.
Update(ctx context.Context, req require.Requirement, vv ...*Address) (int64, error)
// Upsert inserts or updates a record, matching it using the expression supplied.
// This expression is used to search for an existing record based on some specified
// key column(s). It must match either zero or one existing record. If it matches
// none, a new record is inserted; otherwise the matching record is updated. An
// error results if these conditions are not met.
Upsert(ctx context.Context, v *Address, wh where.Expression) error
// DeleteById deletes rows from the table, given some id values.
// The list of ids can be arbitrarily long.
DeleteById(ctx context.Context, req require.Requirement, id ...int64) (int64, error)
// DeleteByTown deletes rows from the table, given some town values.
// The list of ids can be arbitrarily long.
DeleteByTown(ctx context.Context, req require.Requirement, town ...string) (int64, error)
// DeleteByPostcode deletes rows from the table, given some postcode values.
// The list of ids can be arbitrarily long.
DeleteByPostcode(ctx context.Context, req require.Requirement, postcode ...string) (int64, error)
// DeleteByUprn deletes rows from the table, given some uprn values.
// The list of ids can be arbitrarily long.
DeleteByUprn(ctx context.Context, req require.Requirement, uprn ...string) (int64, error)
// Delete deletes one or more rows from the table, given a 'where' clause.
// Use a nil value for the 'wh' argument if it is not needed (very risky!).
Delete(ctx context.Context, req require.Requirement, wh where.Expression) (int64, error)
}
AddressQueryer lists query methods provided by AddressTable.
type AddressTable ¶
type AddressTable struct {
// contains filtered or unexported fields
}
AddressTable holds a given table name with the database reference, providing access methods below. The Prefix field is often blank but can be used to hold a table name prefix (e.g. ending in '_'). Or it can specify the name of the schema, in which case it should have a trailing '.'.
func CopyTableAsAddressTable ¶
func CopyTableAsAddressTable(origin pgxapi.Table) AddressTable
CopyTableAsAddressTable copies a table instance, retaining the name etc but providing methods appropriate for 'Address'.It doesn't copy the constraints of the original table.
It serves to provide methods appropriate for 'Address'. This is most useful when this is used to represent a join result. In such cases, there won't be any need for DDL methods, nor Exec, Insert, Update or Delete.
func NewAddressTable ¶
func NewAddressTable(name string, d pgxapi.Database) AddressTable
NewAddressTable returns a new table instance. If a blank table name is supplied, the default name "addresses" will be used instead. The request context is initialised with the background.
func (AddressTable) Constraints ¶
func (tbl AddressTable) Constraints() constraint.Constraints
Constraints returns the table's constraints.
func (AddressTable) Count ¶
func (tbl AddressTable) Count(ctx context.Context, wh where.Expression) (count int64, err error)
Count counts the Addresses in the table that match a 'where' clause. Use a nil value for the 'wh' argument if it is not needed.
func (AddressTable) CountWhere ¶
func (tbl AddressTable) CountWhere(ctx context.Context, where string, args ...interface{}) (count int64, err error)
CountWhere counts Addresses in the table that match a 'where' clause. Use a blank string for the 'where' argument if it is not needed.
The args are for any placeholder parameters in the query.
func (AddressTable) CreateIndexes ¶
func (tbl AddressTable) CreateIndexes(ctx context.Context, ifNotExist bool) (err error)
CreateIndexes executes queries that create the indexes needed by the Address table.
func (AddressTable) CreatePostcodeIdxIndex ¶
func (tbl AddressTable) CreatePostcodeIdxIndex(ctx context.Context, ifNotExist bool) error
CreatePostcodeIdxIndex creates the postcodeIdx index.
func (AddressTable) CreateTable ¶
CreateTable creates the table.
func (AddressTable) CreateTableWithIndexes ¶
func (tbl AddressTable) CreateTableWithIndexes(ctx context.Context, ifNotExist bool) (err error)
CreateTableWithIndexes invokes CreateTable then CreateIndexes.
func (AddressTable) CreateTownIdxIndex ¶
func (tbl AddressTable) CreateTownIdxIndex(ctx context.Context, ifNotExist bool) error
CreateTownIdxIndex creates the townIdx index.
func (AddressTable) CreateUprnIdxIndex ¶ added in v0.60.0
func (tbl AddressTable) CreateUprnIdxIndex(ctx context.Context, ifNotExist bool) error
CreateUprnIdxIndex creates the uprn_idx index.
func (AddressTable) DB ¶
func (tbl AddressTable) DB() pgxapi.SqlDB
DB gets the wrapped database handle, provided this is not within a transaction. Panics if it is in the wrong state - use IsTx() if necessary.
func (AddressTable) Database ¶
func (tbl AddressTable) Database() pgxapi.Database
Database gets the shared database information.
func (AddressTable) Delete ¶
func (tbl AddressTable) Delete(ctx context.Context, req require.Requirement, wh where.Expression) (int64, error)
Delete deletes one or more rows from the table, given a 'where' clause. Use a nil value for the 'wh' argument if it is not needed (very risky!).
func (AddressTable) DeleteById ¶ added in v0.61.0
func (tbl AddressTable) DeleteById(ctx context.Context, req require.Requirement, id ...int64) (int64, error)
DeleteById deletes rows from the table, given some id values. The list of ids can be arbitrarily long.
func (AddressTable) DeleteByPostcode ¶ added in v0.61.0
func (tbl AddressTable) DeleteByPostcode(ctx context.Context, req require.Requirement, postcode ...string) (int64, error)
DeleteByPostcode deletes rows from the table, given some postcode values. The list of ids can be arbitrarily long.
func (AddressTable) DeleteByTown ¶ added in v0.61.0
func (tbl AddressTable) DeleteByTown(ctx context.Context, req require.Requirement, town ...string) (int64, error)
DeleteByTown deletes rows from the table, given some town values. The list of ids can be arbitrarily long.
func (AddressTable) DeleteByUprn ¶ added in v0.61.0
func (tbl AddressTable) DeleteByUprn(ctx context.Context, req require.Requirement, uprn ...string) (int64, error)
DeleteByUprn deletes rows from the table, given some uprn values. The list of ids can be arbitrarily long.
func (AddressTable) Dialect ¶
func (tbl AddressTable) Dialect() dialect.Dialect
Dialect gets the database dialect.
func (AddressTable) DropIndexes ¶
func (tbl AddressTable) DropIndexes(ctx context.Context, ifExist bool) (err error)
DropIndexes executes queries that drop the indexes on by the Address table.
func (AddressTable) DropPostcodeIdxIndex ¶
func (tbl AddressTable) DropPostcodeIdxIndex(ctx context.Context, ifExists bool) error
DropPostcodeIdxIndex drops the postcodeIdx index.
func (AddressTable) DropTownIdxIndex ¶
func (tbl AddressTable) DropTownIdxIndex(ctx context.Context, ifExists bool) error
DropTownIdxIndex drops the townIdx index.
func (AddressTable) DropUprnIdxIndex ¶ added in v0.60.0
func (tbl AddressTable) DropUprnIdxIndex(ctx context.Context, ifExists bool) error
DropUprnIdxIndex drops the uprn_idx index.
func (AddressTable) Exec ¶
func (tbl AddressTable) Exec(ctx context.Context, req require.Requirement, query string, args ...interface{}) (int64, error)
Exec executes a query without returning any rows. It returns the number of rows affected (if the database driver supports this).
The args are for any placeholder parameters in the query.
If the context ctx is nil, it defaults to context.Background().
func (AddressTable) Execer ¶
func (tbl AddressTable) Execer() pgxapi.Execer
Execer gets the wrapped database or transaction handle.
func (AddressTable) Fetch ¶
func (tbl AddressTable) Fetch(ctx context.Context, req require.Requirement, query string, args ...interface{}) ([]*Address, error)
Fetch fetches a list of Address based on a supplied query. This is mostly used for join queries that map its result columns to the fields of Address. Other queries might be better handled by GetXxx or Select methods.
func (AddressTable) GetAddressById ¶
func (tbl AddressTable) GetAddressById(ctx context.Context, req require.Requirement, id int64) (*Address, error)
GetAddressById gets the record with a given primary key value. If not found, *Address will be nil.
func (AddressTable) GetAddressByUPRN ¶ added in v0.60.0
func (tbl AddressTable) GetAddressByUPRN(ctx context.Context, req require.Requirement, uprn string) (*Address, error)
GetAddressByUPRN gets the record with a given uprn value. If not found, *Address will be nil.
func (AddressTable) GetAddressesById ¶
func (tbl AddressTable) GetAddressesById(ctx context.Context, req require.Requirement, qc where.QueryConstraint, id ...int64) (list []*Address, err error)
GetAddressesById gets records from the table according to a list of primary keys. Although the list of ids can be arbitrarily long, there are practical limits; note that Oracle DB has a limit of 1000.
It places a requirement, which may be nil, on the size of the expected results: in particular, require.All controls whether an error is generated not all the ids produce a result.
func (AddressTable) GetAddressesByPostcode ¶
func (tbl AddressTable) GetAddressesByPostcode(ctx context.Context, req require.Requirement, qc where.QueryConstraint, postcode string) ([]*Address, error)
GetAddressesByPostcode gets the records with a given postcode value. If not found, the resulting slice will be empty (nil).
func (AddressTable) GetAddressesByTown ¶
func (tbl AddressTable) GetAddressesByTown(ctx context.Context, req require.Requirement, qc where.QueryConstraint, town string) ([]*Address, error)
GetAddressesByTown gets the records with a given town value. If not found, the resulting slice will be empty (nil).
func (AddressTable) GetAddressesByUPRN ¶ added in v0.61.0
func (tbl AddressTable) GetAddressesByUPRN(ctx context.Context, req require.Requirement, qc where.QueryConstraint, uprn ...string) ([]*Address, error)
GetAddressesByUPRN gets the record with a given uprn value.
func (AddressTable) Insert ¶
func (tbl AddressTable) Insert(ctx context.Context, req require.Requirement, vv ...*Address) error
Insert adds new records for the Addresses.// The Addresses have their primary key fields set to the new record identifiers. The Address.PreInsert() method will be called, if it exists.
func (AddressTable) IsTx ¶
func (tbl AddressTable) IsTx() bool
IsTx tests whether this is within a transaction.
func (AddressTable) Logger ¶
func (tbl AddressTable) Logger() pgxapi.Logger
Logger gets the trace logger.
func (AddressTable) Name ¶
func (tbl AddressTable) Name() pgxapi.TableName
Name gets the table name.
func (AddressTable) PkColumn ¶
func (tbl AddressTable) PkColumn() string
PkColumn gets the column name used as a primary key.
func (AddressTable) Query ¶
func (tbl AddressTable) Query(ctx context.Context, req require.Requirement, query string, args ...interface{}) ([]*Address, error)
Query is the low-level request method for this table. The SQL query must return all the columns necessary for Address values. Placeholders should be vanilla '?' marks, which will be replaced if necessary according to the chosen dialect.
The query is logged using whatever logger is configured. If an error arises, this too is logged.
The args are for any placeholder parameters in the query.
The support API provides a core 'support.Query' function, on which this method depends. If appropriate, use that function directly; wrap the result in *pgxapi.Rows if you need to access its data as a map.
If the context ctx is nil, it defaults to context.Background().
func (AddressTable) QueryOneNullFloat64 ¶
func (tbl AddressTable) QueryOneNullFloat64(ctx context.Context, req require.Requirement, query string, args ...interface{}) (result sql.NullFloat64, err error)
QueryOneNullFloat64 is a low-level access method for one float64. This can be used for 'AVG(...)' queries and such like. If the query selected many rows, only the first is returned; the rest are discarded. If not found, the result will be invalid.
Note that this applies ReplaceTableName to the query string.
The args are for any placeholder parameters in the query.
func (AddressTable) QueryOneNullInt64 ¶
func (tbl AddressTable) QueryOneNullInt64(ctx context.Context, req require.Requirement, query string, args ...interface{}) (result sql.NullInt64, err error)
QueryOneNullInt64 is a low-level access method for one int64. This can be used for 'COUNT(1)' queries and such like. If the query selected many rows, only the first is returned; the rest are discarded. If not found, the result will be invalid.
Note that this applies ReplaceTableName to the query string.
The args are for any placeholder parameters in the query.
func (AddressTable) QueryOneNullString ¶
func (tbl AddressTable) QueryOneNullString(ctx context.Context, req require.Requirement, query string, args ...interface{}) (result sql.NullString, err error)
QueryOneNullString is a low-level access method for one string. This can be used for function queries and such like. If the query selected many rows, only the first is returned; the rest are discarded. If not found, the result will be invalid.
Note that this applies ReplaceTableName to the query string.
The args are for any placeholder parameters in the query.
func (AddressTable) Select ¶
func (tbl AddressTable) Select(ctx context.Context, req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]*Address, error)
Select allows Addresses to be obtained from the table that match a 'where' clause. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
It places a requirement, which may be nil, on the size of the expected results: for example require.AtLeastOne controls whether an error is generated when no result is found.
func (AddressTable) SelectOne ¶
func (tbl AddressTable) SelectOne(ctx context.Context, req require.Requirement, wh where.Expression, qc where.QueryConstraint) (*Address, error)
SelectOne allows a single Address to be obtained from the table that matches a 'where' clause. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed. If not found, *Example will be nil.
It places a requirement, which may be nil, on the size of the expected results: for example require.One controls whether an error is generated when no result is found.
func (AddressTable) SelectOneWhere ¶
func (tbl AddressTable) SelectOneWhere(ctx context.Context, req require.Requirement, where, orderBy string, args ...interface{}) (*Address, error)
SelectOneWhere allows a single Address to be obtained from the table that matches a 'where' clause and some limit. Any order, limit or offset clauses can be supplied in 'orderBy'. Use blank strings for the 'where' and/or 'orderBy' arguments if they are not needed. If not found, *Example will be nil.
It places a requirement, which may be nil, on the size of the expected results: for example require.One controls whether an error is generated when no result is found.
The args are for any placeholder parameters in the query.
func (AddressTable) SelectWhere ¶
func (tbl AddressTable) SelectWhere(ctx context.Context, req require.Requirement, where, orderBy string, args ...interface{}) ([]*Address, error)
SelectWhere allows Addresses to be obtained from the table that match a 'where' clause. Any order, limit or offset clauses can be supplied in 'orderBy'. Use blank strings for the 'where' and/or 'orderBy' arguments if they are not needed.
It places a requirement, which may be nil, on the size of the expected results: for example require.AtLeastOne controls whether an error is generated when no result is found.
The args are for any placeholder parameters in the query.
func (AddressTable) SliceId ¶
func (tbl AddressTable) SliceId(ctx context.Context, req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int64, error)
SliceId gets the id column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (AddressTable) SlicePostcode ¶
func (tbl AddressTable) SlicePostcode(ctx context.Context, req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
SlicePostcode gets the postcode column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (AddressTable) SliceTown ¶
func (tbl AddressTable) SliceTown(ctx context.Context, req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
SliceTown gets the town column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (AddressTable) SliceUprn ¶ added in v0.60.0
func (tbl AddressTable) SliceUprn(ctx context.Context, req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
SliceUprn gets the uprn column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (AddressTable) Transact ¶ added in v0.51.0
func (tbl AddressTable) Transact(ctx context.Context, txOptions *pgx.TxOptions, fn func(AddressQueryer) error) error
Transact runs the function provided within a transaction. If the function completes without error, the transaction is committed. If there is an error or a panic, the transaction is rolled back.
The options can be nil, in which case the default behaviour is that of the underlying connection.
Nested transactions (i.e. within 'fn') are permitted: they execute within the outermost transaction. Therefore they do not commit until the outermost transaction commits.
func (AddressTable) Truncate ¶
func (tbl AddressTable) Truncate(ctx context.Context, force bool) (err error)
Truncate drops every record from the table, if possible. It might fail if constraints exist that prevent some or all rows from being deleted; use the force option to override this.
When 'force' is set true, be aware of the following consequences. When using Mysql, foreign keys in other tables can be left dangling. When using Postgres, a cascade happens, so all 'adjacent' tables (i.e. linked by foreign keys) are also truncated.
func (AddressTable) Tx ¶
func (tbl AddressTable) Tx() pgxapi.SqlTx
Tx gets the wrapped transaction handle, provided this is within a transaction. Panics if it is in the wrong state - use IsTx() if necessary.
func (AddressTable) Update ¶
func (tbl AddressTable) Update(ctx context.Context, req require.Requirement, vv ...*Address) (int64, error)
Update updates records, matching them by primary key. It returns the number of rows affected. The Address.PreUpdate(Execer) method will be called, if it exists.
func (AddressTable) UpdateById ¶ added in v0.61.0
func (tbl AddressTable) UpdateById(ctx context.Context, req require.Requirement, id int64, fields ...sql.NamedArg) (int64, error)
UpdateById updates one or more columns, given a id value.
func (AddressTable) UpdateByPostcode ¶ added in v0.61.0
func (tbl AddressTable) UpdateByPostcode(ctx context.Context, req require.Requirement, postcode string, fields ...sql.NamedArg) (int64, error)
UpdateByPostcode updates one or more columns, given a postcode value.
func (AddressTable) UpdateByTown ¶ added in v0.61.0
func (tbl AddressTable) UpdateByTown(ctx context.Context, req require.Requirement, town string, fields ...sql.NamedArg) (int64, error)
UpdateByTown updates one or more columns, given a town value.
func (AddressTable) UpdateByUprn ¶ added in v0.61.0
func (tbl AddressTable) UpdateByUprn(ctx context.Context, req require.Requirement, uprn string, fields ...sql.NamedArg) (int64, error)
UpdateByUprn updates one or more columns, given a uprn value.
func (AddressTable) UpdateFields ¶
func (tbl AddressTable) UpdateFields(ctx context.Context, req require.Requirement, wh where.Expression, fields ...sql.NamedArg) (int64, error)
UpdateFields updates one or more columns, given a 'where' clause. Use a nil value for the 'wh' argument if it is not needed (but note that this is risky!).
func (AddressTable) Upsert ¶
func (tbl AddressTable) Upsert(ctx context.Context, v *Address, wh where.Expression) error
Upsert inserts or updates a record, matching it using the expression supplied. This expression is used to search for an existing record based on some specified key column(s). It must match either zero or one existing record. If it matches none, a new record is inserted; otherwise the matching record is updated. An error results if these conditions are not met.
func (AddressTable) Using ¶
func (tbl AddressTable) Using(tx pgxapi.Execer) AddressQueryer
Using returns a modified AddressTabler using the the Execer supplied, which will typically be a transaction (i.e. SqlTx). This is needed when making multiple queries across several tables within a single transaction.
The result is a modified copy of the table; the original is unchanged.
func (AddressTable) WithConstraint ¶
func (tbl AddressTable) WithConstraint(cc ...constraint.Constraint) AddressTabler
WithConstraint returns a modified AddressTabler with added data consistency constraints.
func (AddressTable) WithPrefix ¶
func (tbl AddressTable) WithPrefix(pfx string) AddressTabler
WithPrefix sets the table name prefix for subsequent queries. The result is a modified copy of the table; the original is unchanged.
type AddressTabler ¶ added in v0.53.0
type AddressTabler interface {
pgxapi.Table
// Constraints returns the table's constraints.
Constraints() constraint.Constraints
// WithConstraint returns a modified AddressTabler with added data consistency constraints.
WithConstraint(cc ...constraint.Constraint) AddressTabler
// WithPrefix returns a modified AddressTabler with a given table name prefix.
WithPrefix(pfx string) AddressTabler
// CreateTable creates the table.
CreateTable(ctx context.Context, ifNotExists bool) (int64, error)
// DropTable drops the table, destroying all its data.
DropTable(ctx context.Context, ifExists bool) (int64, error)
// CreateTableWithIndexes invokes CreateTable then CreateIndexes.
CreateTableWithIndexes(ctx context.Context, ifNotExist bool) (err error)
// CreateIndexes executes queries that create the indexes needed by the Address table.
CreateIndexes(ctx context.Context, ifNotExist bool) (err error)
// CreatePostcodeIdxIndex creates the postcodeIdx index.
CreatePostcodeIdxIndex(ctx context.Context, ifNotExist bool) error
// DropPostcodeIdxIndex drops the postcodeIdx index.
DropPostcodeIdxIndex(ctx context.Context, ifExists bool) error
// CreateTownIdxIndex creates the townIdx index.
CreateTownIdxIndex(ctx context.Context, ifNotExist bool) error
// DropTownIdxIndex drops the townIdx index.
DropTownIdxIndex(ctx context.Context, ifExists bool) error
// CreateUprnIdxIndex creates the uprn_idx index.
CreateUprnIdxIndex(ctx context.Context, ifNotExist bool) error
// DropUprnIdxIndex drops the uprn_idx index.
DropUprnIdxIndex(ctx context.Context, ifExists bool) error
// Truncate drops every record from the table, if possible.
Truncate(ctx context.Context, force bool) (err error)
}
AddressTabler lists table methods provided by AddressTable.
type DbUserQueryer ¶ added in v0.60.0
type DbUserQueryer interface {
pgxapi.Table
// Using returns a modified DbUserQueryer using the Execer supplied,
// which will typically be a transaction (i.e. SqlTx).
Using(tx pgxapi.Execer) DbUserQueryer
// Transact runs the function provided within a transaction. The transction is committed
// unless an error occurs.
Transact(ctx context.Context, txOptions *pgx.TxOptions, fn func(DbUserQueryer) error) error
// Exec executes a query without returning any rows.
Exec(ctx context.Context, req require.Requirement, query string, args ...interface{}) (int64, error)
// Query is the low-level request method for this table using an SQL query that must return all the columns
// necessary for User values.
Query(ctx context.Context, req require.Requirement, query string, args ...interface{}) ([]*User, error)
// QueryOneNullString is a low-level access method for one string, returning the first match.
QueryOneNullString(ctx context.Context, req require.Requirement, query string, args ...interface{}) (result sql.NullString, err error)
// QueryOneNullInt64 is a low-level access method for one int64, returning the first match.
QueryOneNullInt64(ctx context.Context, req require.Requirement, query string, args ...interface{}) (result sql.NullInt64, err error)
// QueryOneNullFloat64 is a low-level access method for one float64, returning the first match.
QueryOneNullFloat64(ctx context.Context, req require.Requirement, query string, args ...interface{}) (result sql.NullFloat64, err error)
// GetUserByUid gets the record with a given primary key value.
GetUserByUid(ctx context.Context, req require.Requirement, id int64) (*User, error)
// GetUsersByUid gets records from the table according to a list of primary keys.
GetUsersByUid(ctx context.Context, req require.Requirement, qc where.QueryConstraint, id ...int64) (list []*User, err error)
// GetUserByEmailAddress gets the record with a given emailaddress value.
GetUserByEmailAddress(ctx context.Context, req require.Requirement, emailaddress string) (*User, error)
// GetUsersByEmailAddress gets the record with a given emailaddress value.
GetUsersByEmailAddress(ctx context.Context, req require.Requirement, qc where.QueryConstraint, emailaddress ...string) ([]*User, error)
// GetUserByName gets the record with a given name value.
GetUserByName(ctx context.Context, req require.Requirement, name string) (*User, error)
// GetUsersByName gets the record with a given name value.
GetUsersByName(ctx context.Context, req require.Requirement, qc where.QueryConstraint, name ...string) ([]*User, error)
// Fetch fetches a list of User based on a supplied query. This is mostly used for join queries that map its
// result columns to the fields of User. Other queries might be better handled by GetXxx or Select methods.
Fetch(ctx context.Context, req require.Requirement, query string, args ...interface{}) ([]*User, error)
// SelectOneWhere allows a single User to be obtained from the table that matches a 'where' clause.
SelectOneWhere(ctx context.Context, req require.Requirement, where, orderBy string, args ...interface{}) (*User, error)
// SelectOne allows a single User to be obtained from the table that matches a 'where' clause.
SelectOne(ctx context.Context, req require.Requirement, wh where.Expression, qc where.QueryConstraint) (*User, error)
// SelectWhere allows Users to be obtained from the table that match a 'where' clause.
SelectWhere(ctx context.Context, req require.Requirement, where, orderBy string, args ...interface{}) ([]*User, error)
// Select allows Users to be obtained from the table that match a 'where' clause.
Select(ctx context.Context, req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]*User, error)
// CountWhere counts Users in the table that match a 'where' clause.
CountWhere(ctx context.Context, where string, args ...interface{}) (count int64, err error)
// Count counts the Users in the table that match a 'where' clause.
Count(ctx context.Context, wh where.Expression) (count int64, err error)
// SliceUid gets the uid column for all rows that match the 'where' condition.
SliceUid(ctx context.Context, req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int64, error)
// SliceName gets the name column for all rows that match the 'where' condition.
SliceName(ctx context.Context, req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
// SliceEmailaddress gets the emailaddress column for all rows that match the 'where' condition.
SliceEmailaddress(ctx context.Context, req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
// SliceAddressid gets the addressid column for all rows that match the 'where' condition.
SliceAddressid(ctx context.Context, req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int64, error)
// SliceAvatar gets the avatar column for all rows that match the 'where' condition.
SliceAvatar(ctx context.Context, req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
// SliceLastupdated gets the lastupdated column for all rows that match the 'where' condition.
SliceLastupdated(ctx context.Context, req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int64, error)
// SliceI8 gets the i8 column for all rows that match the 'where' condition.
SliceI8(ctx context.Context, req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int8, error)
// SliceU8 gets the u8 column for all rows that match the 'where' condition.
SliceU8(ctx context.Context, req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]uint8, error)
// SliceI16 gets the i16 column for all rows that match the 'where' condition.
SliceI16(ctx context.Context, req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int16, error)
// SliceU16 gets the u16 column for all rows that match the 'where' condition.
SliceU16(ctx context.Context, req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]uint16, error)
// SliceI32 gets the i32 column for all rows that match the 'where' condition.
SliceI32(ctx context.Context, req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int32, error)
// SliceU32 gets the u32 column for all rows that match the 'where' condition.
SliceU32(ctx context.Context, req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]uint32, error)
// SliceI64 gets the i64 column for all rows that match the 'where' condition.
SliceI64(ctx context.Context, req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int64, error)
// SliceU64 gets the u64 column for all rows that match the 'where' condition.
SliceU64(ctx context.Context, req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]uint64, error)
// SliceRole gets the role column for all rows that match the 'where' condition.
SliceRole(ctx context.Context, req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]Role, error)
// SliceF32 gets the f32 column for all rows that match the 'where' condition.
SliceF32(ctx context.Context, req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]float32, error)
// SliceF64 gets the f64 column for all rows that match the 'where' condition.
SliceF64(ctx context.Context, req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]float64, error)
// Insert adds new records for the Users, setting the primary key field for each one.
Insert(ctx context.Context, req require.Requirement, vv ...*User) error
// UpdateByUid updates one or more columns, given a uid value.
UpdateByUid(ctx context.Context, req require.Requirement, uid int64, fields ...sql.NamedArg) (int64, error)
// UpdateByName updates one or more columns, given a name value.
UpdateByName(ctx context.Context, req require.Requirement, name string, fields ...sql.NamedArg) (int64, error)
// UpdateByEmailaddress updates one or more columns, given a emailaddress value.
UpdateByEmailaddress(ctx context.Context, req require.Requirement, emailaddress string, fields ...sql.NamedArg) (int64, error)
// UpdateByAddressid updates one or more columns, given a addressid value.
UpdateByAddressid(ctx context.Context, req require.Requirement, addressid int64, fields ...sql.NamedArg) (int64, error)
// UpdateByAvatar updates one or more columns, given a avatar value.
UpdateByAvatar(ctx context.Context, req require.Requirement, avatar string, fields ...sql.NamedArg) (int64, error)
// UpdateByRole updates one or more columns, given a role value.
UpdateByRole(ctx context.Context, req require.Requirement, role Role, fields ...sql.NamedArg) (int64, error)
// UpdateByLastupdated updates one or more columns, given a lastupdated value.
UpdateByLastupdated(ctx context.Context, req require.Requirement, lastupdated int64, fields ...sql.NamedArg) (int64, error)
// UpdateByI8 updates one or more columns, given a i8 value.
UpdateByI8(ctx context.Context, req require.Requirement, i8 int8, fields ...sql.NamedArg) (int64, error)
// UpdateByU8 updates one or more columns, given a u8 value.
UpdateByU8(ctx context.Context, req require.Requirement, u8 uint8, fields ...sql.NamedArg) (int64, error)
// UpdateByI16 updates one or more columns, given a i16 value.
UpdateByI16(ctx context.Context, req require.Requirement, i16 int16, fields ...sql.NamedArg) (int64, error)
// UpdateByU16 updates one or more columns, given a u16 value.
UpdateByU16(ctx context.Context, req require.Requirement, u16 uint16, fields ...sql.NamedArg) (int64, error)
// UpdateByI32 updates one or more columns, given a i32 value.
UpdateByI32(ctx context.Context, req require.Requirement, i32 int32, fields ...sql.NamedArg) (int64, error)
// UpdateByU32 updates one or more columns, given a u32 value.
UpdateByU32(ctx context.Context, req require.Requirement, u32 uint32, fields ...sql.NamedArg) (int64, error)
// UpdateByI64 updates one or more columns, given a i64 value.
UpdateByI64(ctx context.Context, req require.Requirement, i64 int64, fields ...sql.NamedArg) (int64, error)
// UpdateByU64 updates one or more columns, given a u64 value.
UpdateByU64(ctx context.Context, req require.Requirement, u64 uint64, fields ...sql.NamedArg) (int64, error)
// UpdateByF32 updates one or more columns, given a f32 value.
UpdateByF32(ctx context.Context, req require.Requirement, f32 float32, fields ...sql.NamedArg) (int64, error)
// UpdateByF64 updates one or more columns, given a f64 value.
UpdateByF64(ctx context.Context, req require.Requirement, f64 float64, fields ...sql.NamedArg) (int64, error)
// UpdateFields updates one or more columns, given a 'where' clause.
UpdateFields(ctx context.Context, req require.Requirement, wh where.Expression, fields ...sql.NamedArg) (int64, error)
// Update updates records, matching them by primary key.
Update(ctx context.Context, req require.Requirement, vv ...*User) (int64, error)
// Upsert inserts or updates a record, matching it using the expression supplied.
// This expression is used to search for an existing record based on some specified
// key column(s). It must match either zero or one existing record. If it matches
// none, a new record is inserted; otherwise the matching record is updated. An
// error results if these conditions are not met.
Upsert(ctx context.Context, v *User, wh where.Expression) error
// DeleteByUid deletes rows from the table, given some uid values.
// The list of ids can be arbitrarily long.
DeleteByUid(ctx context.Context, req require.Requirement, uid ...int64) (int64, error)
// DeleteByName deletes rows from the table, given some name values.
// The list of ids can be arbitrarily long.
DeleteByName(ctx context.Context, req require.Requirement, name ...string) (int64, error)
// DeleteByEmailaddress deletes rows from the table, given some emailaddress values.
// The list of ids can be arbitrarily long.
DeleteByEmailaddress(ctx context.Context, req require.Requirement, emailaddress ...string) (int64, error)
// DeleteByAddressid deletes rows from the table, given some addressid values.
// The list of ids can be arbitrarily long.
DeleteByAddressid(ctx context.Context, req require.Requirement, addressid ...int64) (int64, error)
// DeleteByAvatar deletes rows from the table, given some avatar values.
// The list of ids can be arbitrarily long.
DeleteByAvatar(ctx context.Context, req require.Requirement, avatar ...string) (int64, error)
// DeleteByRole deletes rows from the table, given some role values.
// The list of ids can be arbitrarily long.
DeleteByRole(ctx context.Context, req require.Requirement, role ...Role) (int64, error)
// DeleteByLastupdated deletes rows from the table, given some lastupdated values.
// The list of ids can be arbitrarily long.
DeleteByLastupdated(ctx context.Context, req require.Requirement, lastupdated ...int64) (int64, error)
// DeleteByI8 deletes rows from the table, given some i8 values.
// The list of ids can be arbitrarily long.
DeleteByI8(ctx context.Context, req require.Requirement, i8 ...int8) (int64, error)
// DeleteByU8 deletes rows from the table, given some u8 values.
// The list of ids can be arbitrarily long.
DeleteByU8(ctx context.Context, req require.Requirement, u8 ...uint8) (int64, error)
// DeleteByI16 deletes rows from the table, given some i16 values.
// The list of ids can be arbitrarily long.
DeleteByI16(ctx context.Context, req require.Requirement, i16 ...int16) (int64, error)
// DeleteByU16 deletes rows from the table, given some u16 values.
// The list of ids can be arbitrarily long.
DeleteByU16(ctx context.Context, req require.Requirement, u16 ...uint16) (int64, error)
// DeleteByI32 deletes rows from the table, given some i32 values.
// The list of ids can be arbitrarily long.
DeleteByI32(ctx context.Context, req require.Requirement, i32 ...int32) (int64, error)
// DeleteByU32 deletes rows from the table, given some u32 values.
// The list of ids can be arbitrarily long.
DeleteByU32(ctx context.Context, req require.Requirement, u32 ...uint32) (int64, error)
// DeleteByI64 deletes rows from the table, given some i64 values.
// The list of ids can be arbitrarily long.
DeleteByI64(ctx context.Context, req require.Requirement, i64 ...int64) (int64, error)
// DeleteByU64 deletes rows from the table, given some u64 values.
// The list of ids can be arbitrarily long.
DeleteByU64(ctx context.Context, req require.Requirement, u64 ...uint64) (int64, error)
// DeleteByF32 deletes rows from the table, given some f32 values.
// The list of ids can be arbitrarily long.
DeleteByF32(ctx context.Context, req require.Requirement, f32 ...float32) (int64, error)
// DeleteByF64 deletes rows from the table, given some f64 values.
// The list of ids can be arbitrarily long.
DeleteByF64(ctx context.Context, req require.Requirement, f64 ...float64) (int64, error)
// Delete deletes one or more rows from the table, given a 'where' clause.
// Use a nil value for the 'wh' argument if it is not needed (very risky!).
Delete(ctx context.Context, req require.Requirement, wh where.Expression) (int64, error)
}
DbUserQueryer lists query methods provided by DbUserTable.
type DbUserTable ¶
type DbUserTable struct {
// contains filtered or unexported fields
}
DbUserTable holds a given table name with the database reference, providing access methods below. The Prefix field is often blank but can be used to hold a table name prefix (e.g. ending in '_'). Or it can specify the name of the schema, in which case it should have a trailing '.'.
func CopyTableAsDbUserTable ¶
func CopyTableAsDbUserTable(origin pgxapi.Table) DbUserTable
CopyTableAsDbUserTable copies a table instance, retaining the name etc but providing methods appropriate for 'User'.It doesn't copy the constraints of the original table.
It serves to provide methods appropriate for 'User'. This is most useful when this is used to represent a join result. In such cases, there won't be any need for DDL methods, nor Exec, Insert, Update or Delete.
func NewDbUserTable ¶
func NewDbUserTable(name string, d pgxapi.Database) DbUserTable
NewDbUserTable returns a new table instance. If a blank table name is supplied, the default name "the_users" will be used instead. The request context is initialised with the background.
func (DbUserTable) Constraints ¶
func (tbl DbUserTable) Constraints() constraint.Constraints
Constraints returns the table's constraints.
func (DbUserTable) Count ¶
func (tbl DbUserTable) Count(ctx context.Context, wh where.Expression) (count int64, err error)
Count counts the Users in the table that match a 'where' clause. Use a nil value for the 'wh' argument if it is not needed.
func (DbUserTable) CountWhere ¶
func (tbl DbUserTable) CountWhere(ctx context.Context, where string, args ...interface{}) (count int64, err error)
CountWhere counts Users in the table that match a 'where' clause. Use a blank string for the 'where' argument if it is not needed.
The args are for any placeholder parameters in the query.
func (DbUserTable) CreateEmailaddressIdxIndex ¶
func (tbl DbUserTable) CreateEmailaddressIdxIndex(ctx context.Context, ifNotExist bool) error
CreateEmailaddressIdxIndex creates the emailaddress_idx index.
func (DbUserTable) CreateIndexes ¶
func (tbl DbUserTable) CreateIndexes(ctx context.Context, ifNotExist bool) (err error)
CreateIndexes executes queries that create the indexes needed by the User table.
func (DbUserTable) CreateTable ¶
CreateTable creates the table.
func (DbUserTable) CreateTableWithIndexes ¶
func (tbl DbUserTable) CreateTableWithIndexes(ctx context.Context, ifNotExist bool) (err error)
CreateTableWithIndexes invokes CreateTable then CreateIndexes.
func (DbUserTable) CreateUserLoginIndex ¶
func (tbl DbUserTable) CreateUserLoginIndex(ctx context.Context, ifNotExist bool) error
CreateUserLoginIndex creates the user_login index.
func (DbUserTable) DB ¶
func (tbl DbUserTable) DB() pgxapi.SqlDB
DB gets the wrapped database handle, provided this is not within a transaction. Panics if it is in the wrong state - use IsTx() if necessary.
func (DbUserTable) Database ¶
func (tbl DbUserTable) Database() pgxapi.Database
Database gets the shared database information.
func (DbUserTable) Delete ¶
func (tbl DbUserTable) Delete(ctx context.Context, req require.Requirement, wh where.Expression) (int64, error)
Delete deletes one or more rows from the table, given a 'where' clause. Use a nil value for the 'wh' argument if it is not needed (very risky!).
func (DbUserTable) DeleteByAddressid ¶ added in v0.61.0
func (tbl DbUserTable) DeleteByAddressid(ctx context.Context, req require.Requirement, addressid ...int64) (int64, error)
DeleteByAddressid deletes rows from the table, given some addressid values. The list of ids can be arbitrarily long.
func (DbUserTable) DeleteByAvatar ¶ added in v0.61.0
func (tbl DbUserTable) DeleteByAvatar(ctx context.Context, req require.Requirement, avatar ...string) (int64, error)
DeleteByAvatar deletes rows from the table, given some avatar values. The list of ids can be arbitrarily long.
func (DbUserTable) DeleteByEmailaddress ¶ added in v0.61.0
func (tbl DbUserTable) DeleteByEmailaddress(ctx context.Context, req require.Requirement, emailaddress ...string) (int64, error)
DeleteByEmailaddress deletes rows from the table, given some emailaddress values. The list of ids can be arbitrarily long.
func (DbUserTable) DeleteByF32 ¶ added in v0.61.0
func (tbl DbUserTable) DeleteByF32(ctx context.Context, req require.Requirement, f32 ...float32) (int64, error)
DeleteByF32 deletes rows from the table, given some f32 values. The list of ids can be arbitrarily long.
func (DbUserTable) DeleteByF64 ¶ added in v0.61.0
func (tbl DbUserTable) DeleteByF64(ctx context.Context, req require.Requirement, f64 ...float64) (int64, error)
DeleteByF64 deletes rows from the table, given some f64 values. The list of ids can be arbitrarily long.
func (DbUserTable) DeleteByI16 ¶ added in v0.61.0
func (tbl DbUserTable) DeleteByI16(ctx context.Context, req require.Requirement, i16 ...int16) (int64, error)
DeleteByI16 deletes rows from the table, given some i16 values. The list of ids can be arbitrarily long.
func (DbUserTable) DeleteByI32 ¶ added in v0.61.0
func (tbl DbUserTable) DeleteByI32(ctx context.Context, req require.Requirement, i32 ...int32) (int64, error)
DeleteByI32 deletes rows from the table, given some i32 values. The list of ids can be arbitrarily long.
func (DbUserTable) DeleteByI64 ¶ added in v0.61.0
func (tbl DbUserTable) DeleteByI64(ctx context.Context, req require.Requirement, i64 ...int64) (int64, error)
DeleteByI64 deletes rows from the table, given some i64 values. The list of ids can be arbitrarily long.
func (DbUserTable) DeleteByI8 ¶ added in v0.61.0
func (tbl DbUserTable) DeleteByI8(ctx context.Context, req require.Requirement, i8 ...int8) (int64, error)
DeleteByI8 deletes rows from the table, given some i8 values. The list of ids can be arbitrarily long.
func (DbUserTable) DeleteByLastupdated ¶ added in v0.61.0
func (tbl DbUserTable) DeleteByLastupdated(ctx context.Context, req require.Requirement, lastupdated ...int64) (int64, error)
DeleteByLastupdated deletes rows from the table, given some lastupdated values. The list of ids can be arbitrarily long.
func (DbUserTable) DeleteByName ¶ added in v0.61.0
func (tbl DbUserTable) DeleteByName(ctx context.Context, req require.Requirement, name ...string) (int64, error)
DeleteByName deletes rows from the table, given some name values. The list of ids can be arbitrarily long.
func (DbUserTable) DeleteByRole ¶ added in v0.61.0
func (tbl DbUserTable) DeleteByRole(ctx context.Context, req require.Requirement, role ...Role) (int64, error)
DeleteByRole deletes rows from the table, given some role values. The list of ids can be arbitrarily long.
func (DbUserTable) DeleteByU16 ¶ added in v0.61.0
func (tbl DbUserTable) DeleteByU16(ctx context.Context, req require.Requirement, u16 ...uint16) (int64, error)
DeleteByU16 deletes rows from the table, given some u16 values. The list of ids can be arbitrarily long.
func (DbUserTable) DeleteByU32 ¶ added in v0.61.0
func (tbl DbUserTable) DeleteByU32(ctx context.Context, req require.Requirement, u32 ...uint32) (int64, error)
DeleteByU32 deletes rows from the table, given some u32 values. The list of ids can be arbitrarily long.
func (DbUserTable) DeleteByU64 ¶ added in v0.61.0
func (tbl DbUserTable) DeleteByU64(ctx context.Context, req require.Requirement, u64 ...uint64) (int64, error)
DeleteByU64 deletes rows from the table, given some u64 values. The list of ids can be arbitrarily long.
func (DbUserTable) DeleteByU8 ¶ added in v0.61.0
func (tbl DbUserTable) DeleteByU8(ctx context.Context, req require.Requirement, u8 ...uint8) (int64, error)
DeleteByU8 deletes rows from the table, given some u8 values. The list of ids can be arbitrarily long.
func (DbUserTable) DeleteByUid ¶ added in v0.61.0
func (tbl DbUserTable) DeleteByUid(ctx context.Context, req require.Requirement, uid ...int64) (int64, error)
DeleteByUid deletes rows from the table, given some uid values. The list of ids can be arbitrarily long.
func (DbUserTable) Dialect ¶
func (tbl DbUserTable) Dialect() dialect.Dialect
Dialect gets the database dialect.
func (DbUserTable) DropEmailaddressIdxIndex ¶
func (tbl DbUserTable) DropEmailaddressIdxIndex(ctx context.Context, ifExists bool) error
DropEmailaddressIdxIndex drops the emailaddress_idx index.
func (DbUserTable) DropIndexes ¶
func (tbl DbUserTable) DropIndexes(ctx context.Context, ifExist bool) (err error)
DropIndexes executes queries that drop the indexes on by the User table.
func (DbUserTable) DropUserLoginIndex ¶
func (tbl DbUserTable) DropUserLoginIndex(ctx context.Context, ifExists bool) error
DropUserLoginIndex drops the user_login index.
func (DbUserTable) Exec ¶
func (tbl DbUserTable) Exec(ctx context.Context, req require.Requirement, query string, args ...interface{}) (int64, error)
Exec executes a query without returning any rows. It returns the number of rows affected (if the database driver supports this).
The args are for any placeholder parameters in the query.
If the context ctx is nil, it defaults to context.Background().
func (DbUserTable) Execer ¶
func (tbl DbUserTable) Execer() pgxapi.Execer
Execer gets the wrapped database or transaction handle.
func (DbUserTable) Fetch ¶
func (tbl DbUserTable) Fetch(ctx context.Context, req require.Requirement, query string, args ...interface{}) ([]*User, error)
Fetch fetches a list of User based on a supplied query. This is mostly used for join queries that map its result columns to the fields of User. Other queries might be better handled by GetXxx or Select methods.
func (DbUserTable) GetUserByEmailAddress ¶
func (tbl DbUserTable) GetUserByEmailAddress(ctx context.Context, req require.Requirement, emailaddress string) (*User, error)
GetUserByEmailAddress gets the record with a given emailaddress value. If not found, *User will be nil.
func (DbUserTable) GetUserByName ¶
func (tbl DbUserTable) GetUserByName(ctx context.Context, req require.Requirement, name string) (*User, error)
GetUserByName gets the record with a given name value. If not found, *User will be nil.
func (DbUserTable) GetUserByUid ¶
func (tbl DbUserTable) GetUserByUid(ctx context.Context, req require.Requirement, id int64) (*User, error)
GetUserByUid gets the record with a given primary key value. If not found, *User will be nil.
func (DbUserTable) GetUsersByEmailAddress ¶ added in v0.61.0
func (tbl DbUserTable) GetUsersByEmailAddress(ctx context.Context, req require.Requirement, qc where.QueryConstraint, emailaddress ...string) ([]*User, error)
GetUsersByEmailAddress gets the record with a given emailaddress value.
func (DbUserTable) GetUsersByName ¶ added in v0.61.0
func (tbl DbUserTable) GetUsersByName(ctx context.Context, req require.Requirement, qc where.QueryConstraint, name ...string) ([]*User, error)
GetUsersByName gets the record with a given name value.
func (DbUserTable) GetUsersByUid ¶
func (tbl DbUserTable) GetUsersByUid(ctx context.Context, req require.Requirement, qc where.QueryConstraint, uid ...int64) (list []*User, err error)
GetUsersByUid gets records from the table according to a list of primary keys. Although the list of ids can be arbitrarily long, there are practical limits; note that Oracle DB has a limit of 1000.
It places a requirement, which may be nil, on the size of the expected results: in particular, require.All controls whether an error is generated not all the ids produce a result.
func (DbUserTable) Insert ¶
func (tbl DbUserTable) Insert(ctx context.Context, req require.Requirement, vv ...*User) error
Insert adds new records for the Users.// The Users have their primary key fields set to the new record identifiers. The User.PreInsert() method will be called, if it exists.
func (DbUserTable) IsTx ¶
func (tbl DbUserTable) IsTx() bool
IsTx tests whether this is within a transaction.
func (DbUserTable) Logger ¶
func (tbl DbUserTable) Logger() pgxapi.Logger
Logger gets the trace logger.
func (DbUserTable) PkColumn ¶
func (tbl DbUserTable) PkColumn() string
PkColumn gets the column name used as a primary key.
func (DbUserTable) Query ¶
func (tbl DbUserTable) Query(ctx context.Context, req require.Requirement, query string, args ...interface{}) ([]*User, error)
Query is the low-level request method for this table. The SQL query must return all the columns necessary for User values. Placeholders should be vanilla '?' marks, which will be replaced if necessary according to the chosen dialect.
The query is logged using whatever logger is configured. If an error arises, this too is logged.
The args are for any placeholder parameters in the query.
The support API provides a core 'support.Query' function, on which this method depends. If appropriate, use that function directly; wrap the result in *pgxapi.Rows if you need to access its data as a map.
If the context ctx is nil, it defaults to context.Background().
func (DbUserTable) QueryOneNullFloat64 ¶
func (tbl DbUserTable) QueryOneNullFloat64(ctx context.Context, req require.Requirement, query string, args ...interface{}) (result sql.NullFloat64, err error)
QueryOneNullFloat64 is a low-level access method for one float64. This can be used for 'AVG(...)' queries and such like. If the query selected many rows, only the first is returned; the rest are discarded. If not found, the result will be invalid.
Note that this applies ReplaceTableName to the query string.
The args are for any placeholder parameters in the query.
func (DbUserTable) QueryOneNullInt64 ¶
func (tbl DbUserTable) QueryOneNullInt64(ctx context.Context, req require.Requirement, query string, args ...interface{}) (result sql.NullInt64, err error)
QueryOneNullInt64 is a low-level access method for one int64. This can be used for 'COUNT(1)' queries and such like. If the query selected many rows, only the first is returned; the rest are discarded. If not found, the result will be invalid.
Note that this applies ReplaceTableName to the query string.
The args are for any placeholder parameters in the query.
func (DbUserTable) QueryOneNullString ¶
func (tbl DbUserTable) QueryOneNullString(ctx context.Context, req require.Requirement, query string, args ...interface{}) (result sql.NullString, err error)
QueryOneNullString is a low-level access method for one string. This can be used for function queries and such like. If the query selected many rows, only the first is returned; the rest are discarded. If not found, the result will be invalid.
Note that this applies ReplaceTableName to the query string.
The args are for any placeholder parameters in the query.
func (DbUserTable) Select ¶
func (tbl DbUserTable) Select(ctx context.Context, req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]*User, error)
Select allows Users to be obtained from the table that match a 'where' clause. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
It places a requirement, which may be nil, on the size of the expected results: for example require.AtLeastOne controls whether an error is generated when no result is found.
func (DbUserTable) SelectOne ¶
func (tbl DbUserTable) SelectOne(ctx context.Context, req require.Requirement, wh where.Expression, qc where.QueryConstraint) (*User, error)
SelectOne allows a single User to be obtained from the table that matches a 'where' clause. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed. If not found, *Example will be nil.
It places a requirement, which may be nil, on the size of the expected results: for example require.One controls whether an error is generated when no result is found.
func (DbUserTable) SelectOneWhere ¶
func (tbl DbUserTable) SelectOneWhere(ctx context.Context, req require.Requirement, where, orderBy string, args ...interface{}) (*User, error)
SelectOneWhere allows a single User to be obtained from the table that matches a 'where' clause and some limit. Any order, limit or offset clauses can be supplied in 'orderBy'. Use blank strings for the 'where' and/or 'orderBy' arguments if they are not needed. If not found, *Example will be nil.
It places a requirement, which may be nil, on the size of the expected results: for example require.One controls whether an error is generated when no result is found.
The args are for any placeholder parameters in the query.
func (DbUserTable) SelectWhere ¶
func (tbl DbUserTable) SelectWhere(ctx context.Context, req require.Requirement, where, orderBy string, args ...interface{}) ([]*User, error)
SelectWhere allows Users to be obtained from the table that match a 'where' clause. Any order, limit or offset clauses can be supplied in 'orderBy'. Use blank strings for the 'where' and/or 'orderBy' arguments if they are not needed.
It places a requirement, which may be nil, on the size of the expected results: for example require.AtLeastOne controls whether an error is generated when no result is found.
The args are for any placeholder parameters in the query.
func (DbUserTable) SliceAddressid ¶
func (tbl DbUserTable) SliceAddressid(ctx context.Context, req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int64, error)
SliceAddressid gets the addressid column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (DbUserTable) SliceAvatar ¶
func (tbl DbUserTable) SliceAvatar(ctx context.Context, req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
SliceAvatar gets the avatar column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (DbUserTable) SliceEmailaddress ¶
func (tbl DbUserTable) SliceEmailaddress(ctx context.Context, req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
SliceEmailaddress gets the emailaddress column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (DbUserTable) SliceF32 ¶
func (tbl DbUserTable) SliceF32(ctx context.Context, req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]float32, error)
SliceF32 gets the f32 column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (DbUserTable) SliceF64 ¶
func (tbl DbUserTable) SliceF64(ctx context.Context, req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]float64, error)
SliceF64 gets the f64 column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (DbUserTable) SliceI16 ¶
func (tbl DbUserTable) SliceI16(ctx context.Context, req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int16, error)
SliceI16 gets the i16 column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (DbUserTable) SliceI32 ¶
func (tbl DbUserTable) SliceI32(ctx context.Context, req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int32, error)
SliceI32 gets the i32 column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (DbUserTable) SliceI64 ¶
func (tbl DbUserTable) SliceI64(ctx context.Context, req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int64, error)
SliceI64 gets the i64 column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (DbUserTable) SliceI8 ¶
func (tbl DbUserTable) SliceI8(ctx context.Context, req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int8, error)
SliceI8 gets the i8 column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (DbUserTable) SliceLastupdated ¶
func (tbl DbUserTable) SliceLastupdated(ctx context.Context, req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int64, error)
SliceLastupdated gets the lastupdated column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (DbUserTable) SliceName ¶
func (tbl DbUserTable) SliceName(ctx context.Context, req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
SliceName gets the name column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (DbUserTable) SliceRole ¶
func (tbl DbUserTable) SliceRole(ctx context.Context, req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]Role, error)
SliceRole gets the role column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (DbUserTable) SliceU16 ¶
func (tbl DbUserTable) SliceU16(ctx context.Context, req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]uint16, error)
SliceU16 gets the u16 column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (DbUserTable) SliceU32 ¶
func (tbl DbUserTable) SliceU32(ctx context.Context, req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]uint32, error)
SliceU32 gets the u32 column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (DbUserTable) SliceU64 ¶
func (tbl DbUserTable) SliceU64(ctx context.Context, req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]uint64, error)
SliceU64 gets the u64 column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (DbUserTable) SliceU8 ¶
func (tbl DbUserTable) SliceU8(ctx context.Context, req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]uint8, error)
SliceU8 gets the u8 column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (DbUserTable) SliceUid ¶
func (tbl DbUserTable) SliceUid(ctx context.Context, req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int64, error)
SliceUid gets the uid column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (DbUserTable) Transact ¶ added in v0.51.0
func (tbl DbUserTable) Transact(ctx context.Context, txOptions *pgx.TxOptions, fn func(DbUserQueryer) error) error
Transact runs the function provided within a transaction. If the function completes without error, the transaction is committed. If there is an error or a panic, the transaction is rolled back.
The options can be nil, in which case the default behaviour is that of the underlying connection.
Nested transactions (i.e. within 'fn') are permitted: they execute within the outermost transaction. Therefore they do not commit until the outermost transaction commits.
func (DbUserTable) Truncate ¶
func (tbl DbUserTable) Truncate(ctx context.Context, force bool) (err error)
Truncate drops every record from the table, if possible. It might fail if constraints exist that prevent some or all rows from being deleted; use the force option to override this.
When 'force' is set true, be aware of the following consequences. When using Mysql, foreign keys in other tables can be left dangling. When using Postgres, a cascade happens, so all 'adjacent' tables (i.e. linked by foreign keys) are also truncated.
func (DbUserTable) Tx ¶
func (tbl DbUserTable) Tx() pgxapi.SqlTx
Tx gets the wrapped transaction handle, provided this is within a transaction. Panics if it is in the wrong state - use IsTx() if necessary.
func (DbUserTable) Update ¶
func (tbl DbUserTable) Update(ctx context.Context, req require.Requirement, vv ...*User) (int64, error)
Update updates records, matching them by primary key. It returns the number of rows affected. The User.PreUpdate(Execer) method will be called, if it exists.
func (DbUserTable) UpdateByAddressid ¶ added in v0.61.0
func (tbl DbUserTable) UpdateByAddressid(ctx context.Context, req require.Requirement, addressid int64, fields ...sql.NamedArg) (int64, error)
UpdateByAddressid updates one or more columns, given a addressid value.
func (DbUserTable) UpdateByAvatar ¶ added in v0.61.0
func (tbl DbUserTable) UpdateByAvatar(ctx context.Context, req require.Requirement, avatar string, fields ...sql.NamedArg) (int64, error)
UpdateByAvatar updates one or more columns, given a avatar value.
func (DbUserTable) UpdateByEmailaddress ¶ added in v0.61.0
func (tbl DbUserTable) UpdateByEmailaddress(ctx context.Context, req require.Requirement, emailaddress string, fields ...sql.NamedArg) (int64, error)
UpdateByEmailaddress updates one or more columns, given a emailaddress value.
func (DbUserTable) UpdateByF32 ¶ added in v0.61.0
func (tbl DbUserTable) UpdateByF32(ctx context.Context, req require.Requirement, f32 float32, fields ...sql.NamedArg) (int64, error)
UpdateByF32 updates one or more columns, given a f32 value.
func (DbUserTable) UpdateByF64 ¶ added in v0.61.0
func (tbl DbUserTable) UpdateByF64(ctx context.Context, req require.Requirement, f64 float64, fields ...sql.NamedArg) (int64, error)
UpdateByF64 updates one or more columns, given a f64 value.
func (DbUserTable) UpdateByI16 ¶ added in v0.61.0
func (tbl DbUserTable) UpdateByI16(ctx context.Context, req require.Requirement, i16 int16, fields ...sql.NamedArg) (int64, error)
UpdateByI16 updates one or more columns, given a i16 value.
func (DbUserTable) UpdateByI32 ¶ added in v0.61.0
func (tbl DbUserTable) UpdateByI32(ctx context.Context, req require.Requirement, i32 int32, fields ...sql.NamedArg) (int64, error)
UpdateByI32 updates one or more columns, given a i32 value.
func (DbUserTable) UpdateByI64 ¶ added in v0.61.0
func (tbl DbUserTable) UpdateByI64(ctx context.Context, req require.Requirement, i64 int64, fields ...sql.NamedArg) (int64, error)
UpdateByI64 updates one or more columns, given a i64 value.
func (DbUserTable) UpdateByI8 ¶ added in v0.61.0
func (tbl DbUserTable) UpdateByI8(ctx context.Context, req require.Requirement, i8 int8, fields ...sql.NamedArg) (int64, error)
UpdateByI8 updates one or more columns, given a i8 value.
func (DbUserTable) UpdateByLastupdated ¶ added in v0.61.0
func (tbl DbUserTable) UpdateByLastupdated(ctx context.Context, req require.Requirement, lastupdated int64, fields ...sql.NamedArg) (int64, error)
UpdateByLastupdated updates one or more columns, given a lastupdated value.
func (DbUserTable) UpdateByName ¶ added in v0.61.0
func (tbl DbUserTable) UpdateByName(ctx context.Context, req require.Requirement, name string, fields ...sql.NamedArg) (int64, error)
UpdateByName updates one or more columns, given a name value.
func (DbUserTable) UpdateByRole ¶ added in v0.61.0
func (tbl DbUserTable) UpdateByRole(ctx context.Context, req require.Requirement, role Role, fields ...sql.NamedArg) (int64, error)
UpdateByRole updates one or more columns, given a role value.
func (DbUserTable) UpdateByU16 ¶ added in v0.61.0
func (tbl DbUserTable) UpdateByU16(ctx context.Context, req require.Requirement, u16 uint16, fields ...sql.NamedArg) (int64, error)
UpdateByU16 updates one or more columns, given a u16 value.
func (DbUserTable) UpdateByU32 ¶ added in v0.61.0
func (tbl DbUserTable) UpdateByU32(ctx context.Context, req require.Requirement, u32 uint32, fields ...sql.NamedArg) (int64, error)
UpdateByU32 updates one or more columns, given a u32 value.
func (DbUserTable) UpdateByU64 ¶ added in v0.61.0
func (tbl DbUserTable) UpdateByU64(ctx context.Context, req require.Requirement, u64 uint64, fields ...sql.NamedArg) (int64, error)
UpdateByU64 updates one or more columns, given a u64 value.
func (DbUserTable) UpdateByU8 ¶ added in v0.61.0
func (tbl DbUserTable) UpdateByU8(ctx context.Context, req require.Requirement, u8 uint8, fields ...sql.NamedArg) (int64, error)
UpdateByU8 updates one or more columns, given a u8 value.
func (DbUserTable) UpdateByUid ¶ added in v0.61.0
func (tbl DbUserTable) UpdateByUid(ctx context.Context, req require.Requirement, uid int64, fields ...sql.NamedArg) (int64, error)
UpdateByUid updates one or more columns, given a uid value.
func (DbUserTable) UpdateFields ¶
func (tbl DbUserTable) UpdateFields(ctx context.Context, req require.Requirement, wh where.Expression, fields ...sql.NamedArg) (int64, error)
UpdateFields updates one or more columns, given a 'where' clause. Use a nil value for the 'wh' argument if it is not needed (but note that this is risky!).
func (DbUserTable) Upsert ¶
func (tbl DbUserTable) Upsert(ctx context.Context, v *User, wh where.Expression) error
Upsert inserts or updates a record, matching it using the expression supplied. This expression is used to search for an existing record based on some specified key column(s). It must match either zero or one existing record. If it matches none, a new record is inserted; otherwise the matching record is updated. An error results if these conditions are not met.
func (DbUserTable) Using ¶
func (tbl DbUserTable) Using(tx pgxapi.Execer) DbUserQueryer
Using returns a modified DbUserTabler using the the Execer supplied, which will typically be a transaction (i.e. SqlTx). This is needed when making multiple queries across several tables within a single transaction.
The result is a modified copy of the table; the original is unchanged.
func (DbUserTable) WithConstraint ¶
func (tbl DbUserTable) WithConstraint(cc ...constraint.Constraint) DbUserTabler
WithConstraint returns a modified DbUserTabler with added data consistency constraints.
func (DbUserTable) WithPrefix ¶
func (tbl DbUserTable) WithPrefix(pfx string) DbUserTabler
WithPrefix sets the table name prefix for subsequent queries. The result is a modified copy of the table; the original is unchanged.
type DbUserTabler ¶ added in v0.53.0
type DbUserTabler interface {
pgxapi.Table
// Constraints returns the table's constraints.
Constraints() constraint.Constraints
// WithConstraint returns a modified DbUserTabler with added data consistency constraints.
WithConstraint(cc ...constraint.Constraint) DbUserTabler
// WithPrefix returns a modified DbUserTabler with a given table name prefix.
WithPrefix(pfx string) DbUserTabler
// CreateTable creates the table.
CreateTable(ctx context.Context, ifNotExists bool) (int64, error)
// DropTable drops the table, destroying all its data.
DropTable(ctx context.Context, ifExists bool) (int64, error)
// CreateTableWithIndexes invokes CreateTable then CreateIndexes.
CreateTableWithIndexes(ctx context.Context, ifNotExist bool) (err error)
// CreateIndexes executes queries that create the indexes needed by the User table.
CreateIndexes(ctx context.Context, ifNotExist bool) (err error)
// CreateEmailaddressIdxIndex creates the emailaddress_idx index.
CreateEmailaddressIdxIndex(ctx context.Context, ifNotExist bool) error
// DropEmailaddressIdxIndex drops the emailaddress_idx index.
DropEmailaddressIdxIndex(ctx context.Context, ifExists bool) error
// CreateUserLoginIndex creates the user_login index.
CreateUserLoginIndex(ctx context.Context, ifNotExist bool) error
// DropUserLoginIndex drops the user_login index.
DropUserLoginIndex(ctx context.Context, ifExists bool) error
// Truncate drops every record from the table, if possible.
Truncate(ctx context.Context, force bool) (err error)
}
DbUserTabler lists table methods provided by DbUserTable.
type Numbers ¶
type Numbers struct {
I8 int8 `sql:"default: -8"`
U8 uint8 `sql:"default: 8"`
I16 int16 `sql:"default: -16"`
U16 uint16 `sql:"default: 16"`
I32 int32 `sql:"default: -32"`
U32 uint32 `sql:"default: 32"`
I64 int64 `sql:"default: -64"`
U64 uint64 `sql:"default: 64"`
F32 float32 `sql:"default: 3.2"`
F64 float64 `sql:"default: 6.4"`
}
type User ¶
type User struct {
Uid int64 `sql:"pk: true, auto: true"`
Name string `sql:"unique: user_login"`
EmailAddress string `sql:"nk: true"`
AddressId *int64 `sql:"fk: addresses.id, onupdate: restrict, ondelete: restrict"`
Avatar *string
Role *Role `sql:"type: text, size: 20"`
Active bool
Admin bool
Fave *big.Int `sql:"encode: json"`
LastUpdated int64
// something just to aid test coverage
Numbers Numbers
// contains filtered or unexported fields
}
func ScanDbUsers ¶ added in v0.50.0
func ScanDbUsers(query string, rows pgxapi.SqlRows, firstOnly bool) (vv []*User, n int64, err error)
ScanDbUsers reads rows from the database and returns a slice of corresponding values. It also returns a number indicating how many rows were read; this will be larger than the length of the slice if reading stopped after the first row.
func (*User) PreInsert ¶
These hooks are just used here for testing, but you could put whatever you like in them.
func (*User) SetAddressId ¶
SetAddressId sets the AddressId field and returns the modified User.
func (*User) SetEmailAddress ¶
SetEmailAddress sets the EmailAddress field and returns the modified User.
func (*User) SetLastUpdated ¶
SetLastUpdated sets the LastUpdated field and returns the modified User.