Documentation ¶
Index ¶
- Constants
- type Address
- type AddressFields
- type AddressQueryer
- type AddressTable
- func (tbl AddressTable) Constraints() constraint.Constraints
- func (tbl AddressTable) Count(wh where.Expression) (count int64, err error)
- func (tbl AddressTable) CountWhere(where string, args ...interface{}) (count int64, err error)
- func (tbl AddressTable) CreateIndexes(ifNotExist bool) (err error)
- func (tbl AddressTable) CreatePostcodeIdxIndex(ifNotExist bool) error
- func (tbl AddressTable) CreateTable(ifNotExists bool) (int64, error)
- func (tbl AddressTable) CreateTableWithIndexes(ifNotExist bool) (err error)
- func (tbl AddressTable) CreateTownIdxIndex(ifNotExist bool) error
- func (tbl AddressTable) CreateUprnIdxIndex(ifNotExist bool) error
- func (tbl AddressTable) Ctx() context.Context
- func (tbl AddressTable) Delete(req require.Requirement, wh where.Expression) (int64, error)
- func (tbl AddressTable) DeleteByID(req require.Requirement, id ...int64) (int64, error)
- func (tbl AddressTable) DeleteByPostcode(req require.Requirement, postcode ...string) (int64, error)
- func (tbl AddressTable) DeleteByTown(req require.Requirement, town ...string) (int64, error)
- func (tbl AddressTable) DeleteByUprn(req require.Requirement, uprn ...string) (int64, error)
- func (tbl AddressTable) DropIndexes(ifExist bool) (err error)
- func (tbl AddressTable) DropPostcodeIdxIndex(ifExists bool) error
- func (tbl AddressTable) DropTable(ifExists bool) (int64, error)
- func (tbl AddressTable) DropTownIdxIndex(ifExists bool) error
- func (tbl AddressTable) DropUprnIdxIndex(ifExists bool) error
- func (tbl AddressTable) Exec(req require.Requirement, query string, args ...interface{}) (int64, error)
- func (tbl AddressTable) Fetch(req require.Requirement, query string, args ...interface{}) ([]*Address, error)
- func (tbl AddressTable) GetAddressById(req require.Requirement, id int64) (*Address, error)
- func (tbl AddressTable) GetAddressByUPRN(req require.Requirement, uprn string) (*Address, error)
- func (tbl AddressTable) GetAddressesById(req require.Requirement, qc where.QueryConstraint, id ...int64) (list []*Address, err error)
- func (tbl AddressTable) GetAddressesByPostcode(req require.Requirement, qc where.QueryConstraint, postcode string) ([]*Address, error)
- func (tbl AddressTable) GetAddressesByTown(req require.Requirement, qc where.QueryConstraint, town string) ([]*Address, error)
- func (tbl AddressTable) GetAddressesByUPRN(req require.Requirement, qc where.QueryConstraint, uprn ...string) ([]*Address, error)
- func (tbl AddressTable) Insert(req require.Requirement, vv ...*Address) error
- func (tbl AddressTable) PkColumn() string
- func (tbl AddressTable) Query(req require.Requirement, query string, args ...interface{}) ([]*Address, error)
- func (tbl AddressTable) QueryOneNullFloat64(req require.Requirement, query string, args ...interface{}) (result sql.NullFloat64, err error)
- func (tbl AddressTable) QueryOneNullInt64(req require.Requirement, query string, args ...interface{}) (result sql.NullInt64, err error)
- func (tbl AddressTable) QueryOneNullString(req require.Requirement, query string, args ...interface{}) (result sql.NullString, err error)
- func (tbl AddressTable) Select(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]*Address, error)
- func (tbl AddressTable) SelectOne(req require.Requirement, wh where.Expression, qc where.QueryConstraint) (*Address, error)
- func (tbl AddressTable) SelectOneWhere(req require.Requirement, where, orderBy string, args ...interface{}) (*Address, error)
- func (tbl AddressTable) SelectWhere(req require.Requirement, where, orderBy string, args ...interface{}) ([]*Address, error)
- func (tbl AddressTable) SliceID(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int64, error)
- func (tbl AddressTable) SlicePostcode(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
- func (tbl AddressTable) SliceTown(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
- func (tbl AddressTable) SliceUprn(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
- func (tbl AddressTable) Transact(txOptions *pgx.TxOptions, fn func(AddressQueryer) error) error
- func (tbl AddressTable) Truncate(force bool) (err error)
- func (tbl AddressTable) Update(req require.Requirement, vv ...*Address) (int64, error)
- func (tbl AddressTable) UpdateByID(req require.Requirement, id int64, fields ...sql.NamedArg) (int64, error)
- func (tbl AddressTable) UpdateByPostcode(req require.Requirement, postcode string, fields ...sql.NamedArg) (int64, error)
- func (tbl AddressTable) UpdateByTown(req require.Requirement, town string, fields ...sql.NamedArg) (int64, error)
- func (tbl AddressTable) UpdateByUprn(req require.Requirement, uprn string, fields ...sql.NamedArg) (int64, error)
- func (tbl AddressTable) UpdateFields(req require.Requirement, wh where.Expression, fields ...sql.NamedArg) (int64, error)
- func (tbl AddressTable) Upsert(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) WithContext(ctx context.Context) AddressTabler
- func (tbl AddressTable) WithPrefix(pfx string) AddressTabler
- type AddressTabler
- type DbUserQueryer
- type DbUserTable
- func (tbl DbUserTable) Constraints() constraint.Constraints
- func (tbl DbUserTable) Count(wh where.Expression) (count int64, err error)
- func (tbl DbUserTable) CountWhere(where string, args ...interface{}) (count int64, err error)
- func (tbl DbUserTable) CreateEmailaddressIdxIndex(ifNotExist bool) error
- func (tbl DbUserTable) CreateIndexes(ifNotExist bool) (err error)
- func (tbl DbUserTable) CreateTable(ifNotExists bool) (int64, error)
- func (tbl DbUserTable) CreateTableWithIndexes(ifNotExist bool) (err error)
- func (tbl DbUserTable) CreateUserLoginIndex(ifNotExist bool) error
- func (tbl DbUserTable) Ctx() context.Context
- func (tbl DbUserTable) Delete(req require.Requirement, wh where.Expression) (int64, error)
- func (tbl DbUserTable) DeleteByAddressid(req require.Requirement, addressid ...int64) (int64, error)
- func (tbl DbUserTable) DeleteByAvatar(req require.Requirement, avatar ...string) (int64, error)
- func (tbl DbUserTable) DeleteByEmailaddress(req require.Requirement, emailaddress ...string) (int64, error)
- func (tbl DbUserTable) DeleteByF32(req require.Requirement, f32 ...float32) (int64, error)
- func (tbl DbUserTable) DeleteByF64(req require.Requirement, f64 ...float64) (int64, error)
- func (tbl DbUserTable) DeleteByI16(req require.Requirement, i16 ...int16) (int64, error)
- func (tbl DbUserTable) DeleteByI32(req require.Requirement, i32 ...int32) (int64, error)
- func (tbl DbUserTable) DeleteByI64(req require.Requirement, i64 ...int64) (int64, error)
- func (tbl DbUserTable) DeleteByI8(req require.Requirement, i8 ...int8) (int64, error)
- func (tbl DbUserTable) DeleteByLastupdated(req require.Requirement, lastupdated ...int64) (int64, error)
- func (tbl DbUserTable) DeleteByName(req require.Requirement, name ...string) (int64, error)
- func (tbl DbUserTable) DeleteByRole(req require.Requirement, role ...Role) (int64, error)
- func (tbl DbUserTable) DeleteByU16(req require.Requirement, u16 ...uint16) (int64, error)
- func (tbl DbUserTable) DeleteByU32(req require.Requirement, u32 ...uint32) (int64, error)
- func (tbl DbUserTable) DeleteByU64(req require.Requirement, u64 ...uint64) (int64, error)
- func (tbl DbUserTable) DeleteByU8(req require.Requirement, u8 ...uint8) (int64, error)
- func (tbl DbUserTable) DeleteByUid(req require.Requirement, uid ...int64) (int64, error)
- func (tbl DbUserTable) DropEmailaddressIdxIndex(ifExists bool) error
- func (tbl DbUserTable) DropIndexes(ifExist bool) (err error)
- func (tbl DbUserTable) DropTable(ifExists bool) (int64, error)
- func (tbl DbUserTable) DropUserLoginIndex(ifExists bool) error
- func (tbl DbUserTable) Exec(req require.Requirement, query string, args ...interface{}) (int64, error)
- func (tbl DbUserTable) Fetch(req require.Requirement, query string, args ...interface{}) ([]*User, error)
- func (tbl DbUserTable) GetUserByEmailAddress(req require.Requirement, emailaddress string) (*User, error)
- func (tbl DbUserTable) GetUserByName(req require.Requirement, name string) (*User, error)
- func (tbl DbUserTable) GetUserByUid(req require.Requirement, id int64) (*User, error)
- func (tbl DbUserTable) GetUsersByEmailAddress(req require.Requirement, qc where.QueryConstraint, emailaddress ...string) ([]*User, error)
- func (tbl DbUserTable) GetUsersByName(req require.Requirement, qc where.QueryConstraint, name ...string) ([]*User, error)
- func (tbl DbUserTable) GetUsersByUid(req require.Requirement, qc where.QueryConstraint, uid ...int64) (list []*User, err error)
- func (tbl DbUserTable) Insert(req require.Requirement, vv ...*User) error
- func (tbl DbUserTable) PkColumn() string
- func (tbl DbUserTable) Query(req require.Requirement, query string, args ...interface{}) ([]*User, error)
- func (tbl DbUserTable) QueryOneNullFloat64(req require.Requirement, query string, args ...interface{}) (result sql.NullFloat64, err error)
- func (tbl DbUserTable) QueryOneNullInt64(req require.Requirement, query string, args ...interface{}) (result sql.NullInt64, err error)
- func (tbl DbUserTable) QueryOneNullString(req require.Requirement, query string, args ...interface{}) (result sql.NullString, err error)
- func (tbl DbUserTable) Select(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]*User, error)
- func (tbl DbUserTable) SelectOne(req require.Requirement, wh where.Expression, qc where.QueryConstraint) (*User, error)
- func (tbl DbUserTable) SelectOneWhere(req require.Requirement, where, orderBy string, args ...interface{}) (*User, error)
- func (tbl DbUserTable) SelectWhere(req require.Requirement, where, orderBy string, args ...interface{}) ([]*User, error)
- func (tbl DbUserTable) SliceAddressid(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int64, error)
- func (tbl DbUserTable) SliceAvatar(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
- func (tbl DbUserTable) SliceEmailaddress(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
- func (tbl DbUserTable) SliceF32(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]float32, error)
- func (tbl DbUserTable) SliceF64(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]float64, error)
- func (tbl DbUserTable) SliceI16(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int16, error)
- func (tbl DbUserTable) SliceI32(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int32, error)
- func (tbl DbUserTable) SliceI64(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int64, error)
- func (tbl DbUserTable) SliceI8(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int8, error)
- func (tbl DbUserTable) SliceLastupdated(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int64, error)
- func (tbl DbUserTable) SliceName(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
- func (tbl DbUserTable) SliceRole(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]Role, error)
- func (tbl DbUserTable) SliceU16(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]uint16, error)
- func (tbl DbUserTable) SliceU32(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]uint32, error)
- func (tbl DbUserTable) SliceU64(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]uint64, error)
- func (tbl DbUserTable) SliceU8(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]uint8, error)
- func (tbl DbUserTable) SliceUid(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int64, error)
- func (tbl DbUserTable) Transact(txOptions *pgx.TxOptions, fn func(DbUserQueryer) error) error
- func (tbl DbUserTable) Truncate(force bool) (err error)
- func (tbl DbUserTable) Update(req require.Requirement, vv ...*User) (int64, error)
- func (tbl DbUserTable) UpdateByAddressid(req require.Requirement, addressid int64, fields ...sql.NamedArg) (int64, error)
- func (tbl DbUserTable) UpdateByAvatar(req require.Requirement, avatar string, fields ...sql.NamedArg) (int64, error)
- func (tbl DbUserTable) UpdateByEmailaddress(req require.Requirement, emailaddress string, fields ...sql.NamedArg) (int64, error)
- func (tbl DbUserTable) UpdateByF32(req require.Requirement, f32 float32, fields ...sql.NamedArg) (int64, error)
- func (tbl DbUserTable) UpdateByF64(req require.Requirement, f64 float64, fields ...sql.NamedArg) (int64, error)
- func (tbl DbUserTable) UpdateByI16(req require.Requirement, i16 int16, fields ...sql.NamedArg) (int64, error)
- func (tbl DbUserTable) UpdateByI32(req require.Requirement, i32 int32, fields ...sql.NamedArg) (int64, error)
- func (tbl DbUserTable) UpdateByI64(req require.Requirement, i64 int64, fields ...sql.NamedArg) (int64, error)
- func (tbl DbUserTable) UpdateByI8(req require.Requirement, i8 int8, fields ...sql.NamedArg) (int64, error)
- func (tbl DbUserTable) UpdateByLastupdated(req require.Requirement, lastupdated int64, fields ...sql.NamedArg) (int64, error)
- func (tbl DbUserTable) UpdateByName(req require.Requirement, name string, fields ...sql.NamedArg) (int64, error)
- func (tbl DbUserTable) UpdateByRole(req require.Requirement, role Role, fields ...sql.NamedArg) (int64, error)
- func (tbl DbUserTable) UpdateByU16(req require.Requirement, u16 uint16, fields ...sql.NamedArg) (int64, error)
- func (tbl DbUserTable) UpdateByU32(req require.Requirement, u32 uint32, fields ...sql.NamedArg) (int64, error)
- func (tbl DbUserTable) UpdateByU64(req require.Requirement, u64 uint64, fields ...sql.NamedArg) (int64, error)
- func (tbl DbUserTable) UpdateByU8(req require.Requirement, u8 uint8, fields ...sql.NamedArg) (int64, error)
- func (tbl DbUserTable) UpdateByUid(req require.Requirement, uid int64, fields ...sql.NamedArg) (int64, error)
- func (tbl DbUserTable) UpdateFields(req require.Requirement, wh where.Expression, fields ...sql.NamedArg) (int64, error)
- func (tbl DbUserTable) Upsert(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) WithContext(ctx context.Context) 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(txOptions *pgx.TxOptions, fn func(AddressQueryer) error) error // Exec executes a query without returning any rows. Exec(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(req require.Requirement, query string, args ...interface{}) ([]*Address, error) // QueryOneNullString is a low-level access method for one string, returning the first match. QueryOneNullString(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(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(req require.Requirement, query string, args ...interface{}) (result sql.NullFloat64, err error) // GetAddressById gets the record with a given primary key value. GetAddressById(req require.Requirement, id int64) (*Address, error) // GetAddressesById gets records from the table according to a list of primary keys. GetAddressesById(req require.Requirement, qc where.QueryConstraint, id ...int64) (list []*Address, err error) // GetAddressesByPostcode gets the records with a given postcode value. GetAddressesByPostcode(req require.Requirement, qc where.QueryConstraint, postcode string) ([]*Address, error) // GetAddressesByTown gets the records with a given town value. GetAddressesByTown(req require.Requirement, qc where.QueryConstraint, town string) ([]*Address, error) // GetAddressByUPRN gets the record with a given uprn value. GetAddressByUPRN(req require.Requirement, uprn string) (*Address, error) // GetAddressesByUPRN gets the record with a given uprn value. GetAddressesByUPRN(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(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(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(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(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(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]*Address, error) // CountWhere counts Addresses in the table that match a 'where' clause. CountWhere(where string, args ...interface{}) (count int64, err error) // Count counts the Addresses in the table that match a 'where' clause. Count(wh where.Expression) (count int64, err error) // SliceID gets the id column for all rows that match the 'where' condition. SliceID(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(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(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(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(req require.Requirement, vv ...*Address) error // UpdateByID updates one or more columns, given a id value. UpdateByID(req require.Requirement, id int64, fields ...sql.NamedArg) (int64, error) // UpdateByTown updates one or more columns, given a town value. UpdateByTown(req require.Requirement, town string, fields ...sql.NamedArg) (int64, error) // UpdateByPostcode updates one or more columns, given a postcode value. UpdateByPostcode(req require.Requirement, postcode string, fields ...sql.NamedArg) (int64, error) // UpdateByUprn updates one or more columns, given a uprn value. UpdateByUprn(req require.Requirement, uprn string, fields ...sql.NamedArg) (int64, error) // UpdateFields updates one or more columns, given a 'where' clause. UpdateFields(req require.Requirement, wh where.Expression, fields ...sql.NamedArg) (int64, error) // Update updates records, matching them by primary key. Update(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(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(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(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(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(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(req require.Requirement, wh where.Expression) (int64, error) }
AddressQueryer lists query methods provided by AddressTable.
type AddressTable ¶
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.SqlDB) 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(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(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(ifNotExist bool) (err error)
CreateIndexes executes queries that create the indexes needed by the Address table.
func (AddressTable) CreatePostcodeIdxIndex ¶
func (tbl AddressTable) CreatePostcodeIdxIndex(ifNotExist bool) error
CreatePostcodeIdxIndex creates the postcodeIdx index.
func (AddressTable) CreateTable ¶
func (tbl AddressTable) CreateTable(ifNotExists bool) (int64, error)
CreateTable creates the table.
func (AddressTable) CreateTableWithIndexes ¶
func (tbl AddressTable) CreateTableWithIndexes(ifNotExist bool) (err error)
CreateTableWithIndexes invokes CreateTable then CreateIndexes.
func (AddressTable) CreateTownIdxIndex ¶
func (tbl AddressTable) CreateTownIdxIndex(ifNotExist bool) error
CreateTownIdxIndex creates the townIdx index.
func (AddressTable) CreateUprnIdxIndex ¶ added in v0.60.0
func (tbl AddressTable) CreateUprnIdxIndex(ifNotExist bool) error
CreateUprnIdxIndex creates the uprn_idx index.
func (AddressTable) Ctx ¶
func (tbl AddressTable) Ctx() context.Context
Ctx gets the current request context.
func (AddressTable) Delete ¶
func (tbl AddressTable) Delete(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.71.0
func (tbl AddressTable) DeleteByID(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(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(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(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) DropIndexes ¶
func (tbl AddressTable) DropIndexes(ifExist bool) (err error)
DropIndexes executes queries that drop the indexes on by the Address table.
func (AddressTable) DropPostcodeIdxIndex ¶
func (tbl AddressTable) DropPostcodeIdxIndex(ifExists bool) error
DropPostcodeIdxIndex drops the postcodeIdx index.
func (AddressTable) DropTable ¶
func (tbl AddressTable) DropTable(ifExists bool) (int64, error)
DropTable drops the table, destroying all its data.
func (AddressTable) DropTownIdxIndex ¶
func (tbl AddressTable) DropTownIdxIndex(ifExists bool) error
DropTownIdxIndex drops the townIdx index.
func (AddressTable) DropUprnIdxIndex ¶ added in v0.60.0
func (tbl AddressTable) DropUprnIdxIndex(ifExists bool) error
DropUprnIdxIndex drops the uprn_idx index.
func (AddressTable) Exec ¶
func (tbl AddressTable) Exec(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.
func (AddressTable) Fetch ¶
func (tbl AddressTable) Fetch(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(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(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(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(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(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(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(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) PkColumn ¶
func (tbl AddressTable) PkColumn() string
PkColumn gets the column name used as a primary key.
func (AddressTable) Query ¶
func (tbl AddressTable) Query(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.
If you need a context other than the background, use WithContext before calling Query.
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.
func (AddressTable) QueryOneNullFloat64 ¶
func (tbl AddressTable) QueryOneNullFloat64(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(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(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(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(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(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(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 ¶ added in v0.71.0
func (tbl AddressTable) SliceID(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(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(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(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(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(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) Update ¶
func (tbl AddressTable) Update(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.71.0
func (tbl AddressTable) UpdateByID(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(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(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(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(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(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) WithContext ¶
func (tbl AddressTable) WithContext(ctx context.Context) AddressTabler
WithContext sets the context for subsequent queries via this table. The result is a modified copy of the table; the original is unchanged.
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 // WithContext returns a modified AddressTabler with a given context. WithContext(ctx context.Context) AddressTabler // CreateTable creates the table. CreateTable(ifNotExists bool) (int64, error) // DropTable drops the table, destroying all its data. DropTable(ifExists bool) (int64, error) // CreateTableWithIndexes invokes CreateTable then CreateIndexes. CreateTableWithIndexes(ifNotExist bool) (err error) // CreateIndexes executes queries that create the indexes needed by the Address table. CreateIndexes(ifNotExist bool) (err error) // CreatePostcodeIdxIndex creates the postcodeIdx index. CreatePostcodeIdxIndex(ifNotExist bool) error // DropPostcodeIdxIndex drops the postcodeIdx index. DropPostcodeIdxIndex(ifExists bool) error // CreateTownIdxIndex creates the townIdx index. CreateTownIdxIndex(ifNotExist bool) error // DropTownIdxIndex drops the townIdx index. DropTownIdxIndex(ifExists bool) error // CreateUprnIdxIndex creates the uprn_idx index. CreateUprnIdxIndex(ifNotExist bool) error // DropUprnIdxIndex drops the uprn_idx index. DropUprnIdxIndex(ifExists bool) error // Truncate drops every record from the table, if possible. Truncate(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(txOptions *pgx.TxOptions, fn func(DbUserQueryer) error) error // Exec executes a query without returning any rows. Exec(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(req require.Requirement, query string, args ...interface{}) ([]*User, error) // QueryOneNullString is a low-level access method for one string, returning the first match. QueryOneNullString(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(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(req require.Requirement, query string, args ...interface{}) (result sql.NullFloat64, err error) // GetUserByUid gets the record with a given primary key value. GetUserByUid(req require.Requirement, id int64) (*User, error) // GetUsersByUid gets records from the table according to a list of primary keys. GetUsersByUid(req require.Requirement, qc where.QueryConstraint, id ...int64) (list []*User, err error) // GetUserByEmailAddress gets the record with a given emailaddress value. GetUserByEmailAddress(req require.Requirement, emailaddress string) (*User, error) // GetUsersByEmailAddress gets the record with a given emailaddress value. GetUsersByEmailAddress(req require.Requirement, qc where.QueryConstraint, emailaddress ...string) ([]*User, error) // GetUserByName gets the record with a given name value. GetUserByName(req require.Requirement, name string) (*User, error) // GetUsersByName gets the record with a given name value. GetUsersByName(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(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(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(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(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(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]*User, error) // CountWhere counts Users in the table that match a 'where' clause. CountWhere(where string, args ...interface{}) (count int64, err error) // Count counts the Users in the table that match a 'where' clause. Count(wh where.Expression) (count int64, err error) // SliceUid gets the uid column for all rows that match the 'where' condition. SliceUid(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(req require.Requirement, vv ...*User) error // UpdateByUid updates one or more columns, given a uid value. UpdateByUid(req require.Requirement, uid int64, fields ...sql.NamedArg) (int64, error) // UpdateByName updates one or more columns, given a name value. UpdateByName(req require.Requirement, name string, fields ...sql.NamedArg) (int64, error) // UpdateByEmailaddress updates one or more columns, given a emailaddress value. UpdateByEmailaddress(req require.Requirement, emailaddress string, fields ...sql.NamedArg) (int64, error) // UpdateByAddressid updates one or more columns, given a addressid value. UpdateByAddressid(req require.Requirement, addressid int64, fields ...sql.NamedArg) (int64, error) // UpdateByAvatar updates one or more columns, given a avatar value. UpdateByAvatar(req require.Requirement, avatar string, fields ...sql.NamedArg) (int64, error) // UpdateByRole updates one or more columns, given a role value. UpdateByRole(req require.Requirement, role Role, fields ...sql.NamedArg) (int64, error) // UpdateByLastupdated updates one or more columns, given a lastupdated value. UpdateByLastupdated(req require.Requirement, lastupdated int64, fields ...sql.NamedArg) (int64, error) // UpdateByI8 updates one or more columns, given a i8 value. UpdateByI8(req require.Requirement, i8 int8, fields ...sql.NamedArg) (int64, error) // UpdateByU8 updates one or more columns, given a u8 value. UpdateByU8(req require.Requirement, u8 uint8, fields ...sql.NamedArg) (int64, error) // UpdateByI16 updates one or more columns, given a i16 value. UpdateByI16(req require.Requirement, i16 int16, fields ...sql.NamedArg) (int64, error) // UpdateByU16 updates one or more columns, given a u16 value. UpdateByU16(req require.Requirement, u16 uint16, fields ...sql.NamedArg) (int64, error) // UpdateByI32 updates one or more columns, given a i32 value. UpdateByI32(req require.Requirement, i32 int32, fields ...sql.NamedArg) (int64, error) // UpdateByU32 updates one or more columns, given a u32 value. UpdateByU32(req require.Requirement, u32 uint32, fields ...sql.NamedArg) (int64, error) // UpdateByI64 updates one or more columns, given a i64 value. UpdateByI64(req require.Requirement, i64 int64, fields ...sql.NamedArg) (int64, error) // UpdateByU64 updates one or more columns, given a u64 value. UpdateByU64(req require.Requirement, u64 uint64, fields ...sql.NamedArg) (int64, error) // UpdateByF32 updates one or more columns, given a f32 value. UpdateByF32(req require.Requirement, f32 float32, fields ...sql.NamedArg) (int64, error) // UpdateByF64 updates one or more columns, given a f64 value. UpdateByF64(req require.Requirement, f64 float64, fields ...sql.NamedArg) (int64, error) // UpdateFields updates one or more columns, given a 'where' clause. UpdateFields(req require.Requirement, wh where.Expression, fields ...sql.NamedArg) (int64, error) // Update updates records, matching them by primary key. Update(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(req require.Requirement, wh where.Expression) (int64, error) }
DbUserQueryer lists query methods provided by DbUserTable.
type DbUserTable ¶
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.SqlDB) 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(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(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(ifNotExist bool) error
CreateEmailaddressIdxIndex creates the emailaddress_idx index.
func (DbUserTable) CreateIndexes ¶
func (tbl DbUserTable) CreateIndexes(ifNotExist bool) (err error)
CreateIndexes executes queries that create the indexes needed by the User table.
func (DbUserTable) CreateTable ¶
func (tbl DbUserTable) CreateTable(ifNotExists bool) (int64, error)
CreateTable creates the table.
func (DbUserTable) CreateTableWithIndexes ¶
func (tbl DbUserTable) CreateTableWithIndexes(ifNotExist bool) (err error)
CreateTableWithIndexes invokes CreateTable then CreateIndexes.
func (DbUserTable) CreateUserLoginIndex ¶
func (tbl DbUserTable) CreateUserLoginIndex(ifNotExist bool) error
CreateUserLoginIndex creates the user_login index.
func (DbUserTable) Ctx ¶
func (tbl DbUserTable) Ctx() context.Context
Ctx gets the current request context.
func (DbUserTable) Delete ¶
func (tbl DbUserTable) Delete(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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) DropEmailaddressIdxIndex ¶
func (tbl DbUserTable) DropEmailaddressIdxIndex(ifExists bool) error
DropEmailaddressIdxIndex drops the emailaddress_idx index.
func (DbUserTable) DropIndexes ¶
func (tbl DbUserTable) DropIndexes(ifExist bool) (err error)
DropIndexes executes queries that drop the indexes on by the User table.
func (DbUserTable) DropTable ¶
func (tbl DbUserTable) DropTable(ifExists bool) (int64, error)
DropTable drops the table, destroying all its data.
func (DbUserTable) DropUserLoginIndex ¶
func (tbl DbUserTable) DropUserLoginIndex(ifExists bool) error
DropUserLoginIndex drops the user_login index.
func (DbUserTable) Exec ¶
func (tbl DbUserTable) Exec(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.
func (DbUserTable) Fetch ¶
func (tbl DbUserTable) Fetch(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(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(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(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(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(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(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(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) PkColumn ¶
func (tbl DbUserTable) PkColumn() string
PkColumn gets the column name used as a primary key.
func (DbUserTable) Query ¶
func (tbl DbUserTable) Query(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.
If you need a context other than the background, use WithContext before calling Query.
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.
func (DbUserTable) QueryOneNullFloat64 ¶
func (tbl DbUserTable) QueryOneNullFloat64(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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) Update ¶
func (tbl DbUserTable) Update(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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) WithContext ¶
func (tbl DbUserTable) WithContext(ctx context.Context) DbUserTabler
WithContext sets the context for subsequent queries via this table. The result is a modified copy of the table; the original is unchanged.
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 // WithContext returns a modified DbUserTabler with a given context. WithContext(ctx context.Context) DbUserTabler // CreateTable creates the table. CreateTable(ifNotExists bool) (int64, error) // DropTable drops the table, destroying all its data. DropTable(ifExists bool) (int64, error) // CreateTableWithIndexes invokes CreateTable then CreateIndexes. CreateTableWithIndexes(ifNotExist bool) (err error) // CreateIndexes executes queries that create the indexes needed by the User table. CreateIndexes(ifNotExist bool) (err error) // CreateEmailaddressIdxIndex creates the emailaddress_idx index. CreateEmailaddressIdxIndex(ifNotExist bool) error // DropEmailaddressIdxIndex drops the emailaddress_idx index. DropEmailaddressIdxIndex(ifExists bool) error // CreateUserLoginIndex creates the user_login index. CreateUserLoginIndex(ifNotExist bool) error // DropUserLoginIndex drops the user_login index. DropUserLoginIndex(ifExists bool) error // Truncate drops every record from the table, if possible. Truncate(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.