demo

package
v0.63.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 12, 2019 License: BSD-2-Clause Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const AUserTableColumnNames = "uid,name,emailaddress,addressid,avatar,role,active,admin,fave,lastupdated,i8,u8,i16,u16,i32,u32,i64,u64,f32,f64,token,secret"

AUserTableColumnNames is the list of columns in AUserTable.

View Source
const AUserTableDataColumnNames = "name,emailaddress,addressid,avatar,role,active,admin,fave,lastupdated,i8,u8,i16,u16,i32,u32,i64,u64,f32,f64,token,secret"

AUserTableDataColumnNames is the list of data columns in AUserTable.

View Source
const AddressTableColumnNames = "id,lines,town,postcode,uprn"

AddressTableColumnNames is the list of columns in AddressTable.

View Source
const AddressTableDataColumnNames = "lines,town,postcode,uprn"

AddressTableDataColumnNames is the list of data columns in AddressTable.

View Source
const AssociationTableColumnNames = "id,name,quality,ref1,ref2,category"

AssociationTableColumnNames is the list of columns in AssociationTable.

View Source
const AssociationTableDataColumnNames = "name,quality,ref1,ref2,category"

AssociationTableDataColumnNames is the list of data columns in AssociationTable.

View Source
const CUserTableColumnNames = "uid,name,emailaddress,addressid,avatar,role,active,admin,fave,lastupdated,i8,u8,i16,u16,i32,u32,i64,u64,f32,f64,token,secret"

CUserTableColumnNames is the list of columns in CUserTable.

View Source
const CUserTableDataColumnNames = "name,emailaddress,addressid,avatar,role,active,admin,fave,lastupdated,i8,u8,i16,u16,i32,u32,i64,u64,f32,f64,token,secret"

CUserTableDataColumnNames is the list of data columns in CUserTable.

View Source
const DUserTableColumnNames = "uid,name,emailaddress,addressid,avatar,role,active,admin,fave,lastupdated,i8,u8,i16,u16,i32,u32,i64,u64,f32,f64,token,secret"

DUserTableColumnNames is the list of columns in DUserTable.

View Source
const DUserTableDataColumnNames = "name,emailaddress,addressid,avatar,role,active,admin,fave,lastupdated,i8,u8,i16,u16,i32,u32,i64,u64,f32,f64,token,secret"

DUserTableDataColumnNames is the list of data columns in DUserTable.

View Source
const DatesTableColumnNames = "id,integer,string"

DatesTableColumnNames is the list of columns in DatesTable.

View Source
const DatesTableDataColumnNames = "integer,string"

DatesTableDataColumnNames is the list of data columns in DatesTable.

View Source
const DbCompoundTableColumnNames = "alpha,beta,category"

DbCompoundTableColumnNames is the list of columns in DbCompoundTable.

View Source
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.

View Source
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.

View Source
const EUserTableColumnNames = "uid,name,emailaddress,addressid,avatar,role,active,admin,fave,lastupdated,i8,u8,i16,u16,i32,u32,i64,u64,f32,f64,token,secret"

EUserTableColumnNames is the list of columns in EUserTable.

View Source
const EUserTableDataColumnNames = "name,emailaddress,addressid,avatar,role,active,admin,fave,lastupdated,i8,u8,i16,u16,i32,u32,i64,u64,f32,f64,token,secret"

EUserTableDataColumnNames is the list of data columns in EUserTable.

View Source
const HookTableColumnNames = "" /* 242-byte string literal not displayed */

HookTableColumnNames is the list of columns in HookTable.

View Source
const HookTableDataColumnNames = "" /* 239-byte string literal not displayed */

HookTableDataColumnNames is the list of data columns in HookTable.

View Source
const IUserTableColumnNames = "uid,name,emailaddress,addressid,avatar,role,active,admin,fave,lastupdated,i8,u8,i16,u16,i32,u32,i64,u64,f32,f64,token,secret"

IUserTableColumnNames is the list of columns in IUserTable.

View Source
const IUserTableDataColumnNames = "name,emailaddress,addressid,avatar,role,active,admin,fave,lastupdated,i8,u8,i16,u16,i32,u32,i64,u64,f32,f64,token,secret"

IUserTableDataColumnNames is the list of data columns in IUserTable.

View Source
const IssueTableColumnNames = "id,number,date,title,bigbody,assignee,state,labels"

IssueTableColumnNames is the list of columns in IssueTable.

View Source
const IssueTableDataColumnNames = "number,date,title,bigbody,assignee,state,labels"

IssueTableDataColumnNames is the list of data columns in IssueTable.

View Source
const LUserTableColumnNames = "uid,name,emailaddress,addressid,avatar,role,active,admin,fave,lastupdated,i8,u8,i16,u16,i32,u32,i64,u64,f32,f64,token,secret"

LUserTableColumnNames is the list of columns in LUserTable.

View Source
const LUserTableDataColumnNames = "name,emailaddress,addressid,avatar,role,active,admin,fave,lastupdated,i8,u8,i16,u16,i32,u32,i64,u64,f32,f64,token,secret"

LUserTableDataColumnNames is the list of data columns in LUserTable.

View Source
const NumAUserTableColumns = 22

NumAUserTableColumns is the total number of columns in AUserTable.

View Source
const NumAUserTableDataColumns = 21

NumAUserTableDataColumns is the number of columns in AUserTable not including the auto-increment key.

View Source
const NumAddressTableColumns = 5

NumAddressTableColumns is the total number of columns in AddressTable.

View Source
const NumAddressTableDataColumns = 4

NumAddressTableDataColumns is the number of columns in AddressTable not including the auto-increment key.

View Source
const NumAssociationTableColumns = 6

NumAssociationTableColumns is the total number of columns in AssociationTable.

View Source
const NumAssociationTableDataColumns = 5

NumAssociationTableDataColumns is the number of columns in AssociationTable not including the auto-increment key.

View Source
const NumCUserTableColumns = 22

NumCUserTableColumns is the total number of columns in CUserTable.

View Source
const NumCUserTableDataColumns = 21

NumCUserTableDataColumns is the number of columns in CUserTable not including the auto-increment key.

View Source
const NumDUserTableColumns = 22

NumDUserTableColumns is the total number of columns in DUserTable.

View Source
const NumDUserTableDataColumns = 21

NumDUserTableDataColumns is the number of columns in DUserTable not including the auto-increment key.

View Source
const NumDatesTableColumns = 3

NumDatesTableColumns is the total number of columns in DatesTable.

View Source
const NumDatesTableDataColumns = 2

NumDatesTableDataColumns is the number of columns in DatesTable not including the auto-increment key.

View Source
const NumDbCompoundTableColumns = 3

NumDbCompoundTableColumns is the total number of columns in DbCompoundTable.

View Source
const NumDbCompoundTableDataColumns = 3

NumDbCompoundTableDataColumns is the number of columns in DbCompoundTable not including the auto-increment key.

View Source
const NumDbUserTableColumns = 22

NumDbUserTableColumns is the total number of columns in DbUserTable.

View Source
const NumDbUserTableDataColumns = 21

NumDbUserTableDataColumns is the number of columns in DbUserTable not including the auto-increment key.

View Source
const NumEUserTableColumns = 22

NumEUserTableColumns is the total number of columns in EUserTable.

View Source
const NumEUserTableDataColumns = 21

NumEUserTableDataColumns is the number of columns in EUserTable not including the auto-increment key.

View Source
const NumHookTableColumns = 17

NumHookTableColumns is the total number of columns in HookTable.

View Source
const NumHookTableDataColumns = 16

NumHookTableDataColumns is the number of columns in HookTable not including the auto-increment key.

View Source
const NumIUserTableColumns = 22

NumIUserTableColumns is the total number of columns in IUserTable.

View Source
const NumIUserTableDataColumns = 21

NumIUserTableDataColumns is the number of columns in IUserTable not including the auto-increment key.

View Source
const NumIssueTableColumns = 8

NumIssueTableColumns is the total number of columns in IssueTable.

View Source
const NumIssueTableDataColumns = 7

NumIssueTableDataColumns is the number of columns in IssueTable not including the auto-increment key.

View Source
const NumLUserTableColumns = 22

NumLUserTableColumns is the total number of columns in LUserTable.

View Source
const NumLUserTableDataColumns = 21

NumLUserTableDataColumns is the number of columns in LUserTable not including the auto-increment key.

View Source
const NumPUserTableColumns = 22

NumPUserTableColumns is the total number of columns in PUserTable.

View Source
const NumPUserTableDataColumns = 21

NumPUserTableDataColumns is the number of columns in PUserTable not including the auto-increment key.

View Source
const NumQUserTableColumns = 22

NumQUserTableColumns is the total number of columns in QUserTable.

View Source
const NumQUserTableDataColumns = 21

NumQUserTableDataColumns is the number of columns in QUserTable not including the auto-increment key.

View Source
const NumSUserTableColumns = 22

NumSUserTableColumns is the total number of columns in SUserTable.

View Source
const NumSUserTableDataColumns = 21

NumSUserTableDataColumns is the number of columns in SUserTable not including the auto-increment key.

View Source
const NumUUserTableColumns = 22

NumUUserTableColumns is the total number of columns in UUserTable.

View Source
const NumUUserTableDataColumns = 21

NumUUserTableDataColumns is the number of columns in UUserTable not including the auto-increment key.

View Source
const NumUserAddressJoinColumns = 13

NumUserAddressJoinColumns is the total number of columns in UserAddressJoin.

View Source
const NumUserAddressJoinDataColumns = 12

NumUserAddressJoinDataColumns is the number of columns in UserAddressJoin not including the auto-increment key.

View Source
const NumXUserTableColumns = 22

NumXUserTableColumns is the total number of columns in XUserTable.

View Source
const NumXUserTableDataColumns = 21

NumXUserTableDataColumns is the number of columns in XUserTable not including the auto-increment key.

View Source
const PUserTableColumnNames = "uid,name,emailaddress,addressid,avatar,role,active,admin,fave,lastupdated,i8,u8,i16,u16,i32,u32,i64,u64,f32,f64,token,secret"

PUserTableColumnNames is the list of columns in PUserTable.

View Source
const PUserTableDataColumnNames = "name,emailaddress,addressid,avatar,role,active,admin,fave,lastupdated,i8,u8,i16,u16,i32,u32,i64,u64,f32,f64,token,secret"

PUserTableDataColumnNames is the list of data columns in PUserTable.

View Source
const QUserTableColumnNames = "uid,name,emailaddress,addressid,avatar,role,active,admin,fave,lastupdated,i8,u8,i16,u16,i32,u32,i64,u64,f32,f64,token,secret"

QUserTableColumnNames is the list of columns in QUserTable.

View Source
const QUserTableDataColumnNames = "name,emailaddress,addressid,avatar,role,active,admin,fave,lastupdated,i8,u8,i16,u16,i32,u32,i64,u64,f32,f64,token,secret"

QUserTableDataColumnNames is the list of data columns in QUserTable.

View Source
const SUserTableColumnNames = "uid,name,emailaddress,addressid,avatar,role,active,admin,fave,lastupdated,i8,u8,i16,u16,i32,u32,i64,u64,f32,f64,token,secret"

SUserTableColumnNames is the list of columns in SUserTable.

View Source
const SUserTableDataColumnNames = "name,emailaddress,addressid,avatar,role,active,admin,fave,lastupdated,i8,u8,i16,u16,i32,u32,i64,u64,f32,f64,token,secret"

SUserTableDataColumnNames is the list of data columns in SUserTable.

View Source
const UUserTableColumnNames = "uid,name,emailaddress,addressid,avatar,role,active,admin,fave,lastupdated,i8,u8,i16,u16,i32,u32,i64,u64,f32,f64,token,secret"

UUserTableColumnNames is the list of columns in UUserTable.

View Source
const UUserTableDataColumnNames = "name,emailaddress,addressid,avatar,role,active,admin,fave,lastupdated,i8,u8,i16,u16,i32,u32,i64,u64,f32,f64,token,secret"

UUserTableDataColumnNames is the list of data columns in UUserTable.

View Source
const UserAddressJoinColumnNames = "uid,name,emailaddress,lines,town,postcode,uprn,avatar,role,active,admin,fave,lastupdated"

UserAddressJoinColumnNames is the list of columns in UserAddressJoin.

View Source
const UserAddressJoinDataColumnNames = "name,emailaddress,lines,town,postcode,uprn,avatar,role,active,admin,fave,lastupdated"

UserAddressJoinDataColumnNames is the list of data columns in UserAddressJoin.

View Source
const XUserTableColumnNames = "uid,name,emailaddress,addressid,avatar,role,active,admin,fave,lastupdated,i8,u8,i16,u16,i32,u32,i64,u64,f32,f64,token,secret"

XUserTableColumnNames is the list of columns in XUserTable.

View Source
const XUserTableDataColumnNames = "name,emailaddress,addressid,avatar,role,active,admin,fave,lastupdated,i8,u8,i16,u16,i32,u32,i64,u64,f32,f64,token,secret"

XUserTableDataColumnNames is the list of data columns in XUserTable.

Variables

This section is empty.

Functions

This section is empty.

Types

type AUserQueryer added in v0.60.0

type AUserQueryer interface {
	// Using returns a modified AUserTabler using the transaction supplied.
	Using(tx sqlapi.SqlTx) AUserQueryer

	// Transact runs the function provided within a transaction.
	Transact(txOptions *sql.TxOptions, fn func(AUserQueryer) error) error

	// Tx gets the wrapped transaction handle, provided this is within a transaction.
	// Panics if it is in the wrong state - use IsTx() if necessary.
	Tx() sqlapi.SqlTx

	// IsTx tests whether this is within a transaction.
	IsTx() bool

	// 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)

	// 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)
}

AUserQueryer lists query methods provided by AUserTable.

type AUserTable added in v0.8.0

type AUserTable struct {
	// contains filtered or unexported fields
}

AUserTable 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 CopyTableAsAUserTable added in v0.8.0

func CopyTableAsAUserTable(origin sqlapi.Table) AUserTable

CopyTableAsAUserTable 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 NewAUserTable added in v0.8.0

func NewAUserTable(name string, d sqlapi.Database) AUserTable

NewAUserTable returns a new table instance. If a blank table name is supplied, the default name "users" will be used instead. The request context is initialised with the background.

func (AUserTable) Constraints added in v0.14.0

func (tbl AUserTable) Constraints() constraint.Constraints

Constraints returns the table's constraints.

func (AUserTable) Count added in v0.8.0

func (tbl AUserTable) 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 (AUserTable) CountWhere added in v0.9.0

func (tbl AUserTable) 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 (AUserTable) CreateEmailaddressIdxIndex added in v0.16.0

func (tbl AUserTable) CreateEmailaddressIdxIndex(ifNotExist bool) error

CreateEmailaddressIdxIndex creates the emailaddress_idx index.

func (AUserTable) CreateIndexes added in v0.8.0

func (tbl AUserTable) CreateIndexes(ifNotExist bool) (err error)

CreateIndexes executes queries that create the indexes needed by the User table.

func (AUserTable) CreateTable added in v0.8.0

func (tbl AUserTable) CreateTable(ifNotExists bool) (int64, error)

CreateTable creates the table.

func (AUserTable) CreateTableWithIndexes added in v0.8.0

func (tbl AUserTable) CreateTableWithIndexes(ifNotExist bool) (err error)

CreateTableWithIndexes invokes CreateTable then CreateIndexes.

func (AUserTable) CreateUserLoginIndex added in v0.8.0

func (tbl AUserTable) CreateUserLoginIndex(ifNotExist bool) error

CreateUserLoginIndex creates the user_login index.

func (AUserTable) Ctx added in v0.8.0

func (tbl AUserTable) Ctx() context.Context

Ctx gets the current request context.

func (AUserTable) DB added in v0.8.0

func (tbl AUserTable) DB() sqlapi.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 (AUserTable) Database added in v0.12.0

func (tbl AUserTable) Database() sqlapi.Database

Database gets the shared database information.

func (AUserTable) Delete added in v0.8.0

func (tbl AUserTable) 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 (AUserTable) DeleteByAddressid added in v0.61.0

func (tbl AUserTable) 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 (AUserTable) DeleteByAvatar added in v0.61.0

func (tbl AUserTable) 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 (AUserTable) DeleteByEmailaddress added in v0.61.0

func (tbl AUserTable) 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 (AUserTable) DeleteByF32 added in v0.61.0

func (tbl AUserTable) 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 (AUserTable) DeleteByF64 added in v0.61.0

func (tbl AUserTable) 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 (AUserTable) DeleteByI16 added in v0.61.0

func (tbl AUserTable) 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 (AUserTable) DeleteByI32 added in v0.61.0

func (tbl AUserTable) 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 (AUserTable) DeleteByI64 added in v0.61.0

func (tbl AUserTable) 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 (AUserTable) DeleteByI8 added in v0.61.0

func (tbl AUserTable) 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 (AUserTable) DeleteByLastupdated added in v0.61.0

func (tbl AUserTable) 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 (AUserTable) DeleteByName added in v0.61.0

func (tbl AUserTable) 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 (AUserTable) DeleteByRole added in v0.61.0

func (tbl AUserTable) 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 (AUserTable) DeleteByU16 added in v0.61.0

func (tbl AUserTable) 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 (AUserTable) DeleteByU32 added in v0.61.0

func (tbl AUserTable) 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 (AUserTable) DeleteByU64 added in v0.61.0

func (tbl AUserTable) 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 (AUserTable) DeleteByU8 added in v0.61.0

func (tbl AUserTable) 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 (AUserTable) DeleteByUid added in v0.61.0

func (tbl AUserTable) 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 (AUserTable) Dialect added in v0.8.0

func (tbl AUserTable) Dialect() dialect.Dialect

Dialect gets the database dialect.

func (AUserTable) DropEmailaddressIdxIndex added in v0.16.0

func (tbl AUserTable) DropEmailaddressIdxIndex(ifExists bool) error

DropEmailaddressIdxIndex drops the emailaddress_idx index.

func (AUserTable) DropIndexes added in v0.8.0

func (tbl AUserTable) DropIndexes(ifExist bool) (err error)

DropIndexes executes queries that drop the indexes on by the User table.

func (AUserTable) DropTable added in v0.8.0

func (tbl AUserTable) DropTable(ifExists bool) (int64, error)

DropTable drops the table, destroying all its data.

func (AUserTable) DropUserLoginIndex added in v0.8.0

func (tbl AUserTable) DropUserLoginIndex(ifExists bool) error

DropUserLoginIndex drops the user_login index.

func (AUserTable) Exec added in v0.8.0

func (tbl AUserTable) 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 (AUserTable) Execer added in v0.12.0

func (tbl AUserTable) Execer() sqlapi.Execer

Execer gets the wrapped database or transaction handle.

func (AUserTable) Fetch added in v0.17.0

func (tbl AUserTable) 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 (AUserTable) GetUserByEmailAddress added in v0.16.0

func (tbl AUserTable) 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 (AUserTable) GetUserByName added in v0.16.0

func (tbl AUserTable) 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 (AUserTable) GetUserByUid added in v0.16.0

func (tbl AUserTable) 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 (AUserTable) GetUsersByEmailAddress added in v0.61.0

func (tbl AUserTable) GetUsersByEmailAddress(req require.Requirement, qc where.QueryConstraint, emailaddress ...string) ([]*User, error)

GetUsersByEmailAddress gets the record with a given emailaddress value.

func (AUserTable) GetUsersByName added in v0.61.0

func (tbl AUserTable) GetUsersByName(req require.Requirement, qc where.QueryConstraint, name ...string) ([]*User, error)

GetUsersByName gets the record with a given name value.

func (AUserTable) GetUsersByUid added in v0.16.0

func (tbl AUserTable) 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 (AUserTable) Insert added in v0.8.0

func (tbl AUserTable) 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 (AUserTable) IsTx added in v0.8.0

func (tbl AUserTable) IsTx() bool

IsTx tests whether this is within a transaction.

func (AUserTable) Logger added in v0.8.0

func (tbl AUserTable) Logger() sqlapi.Logger

Logger gets the trace logger.

func (AUserTable) Name added in v0.8.0

func (tbl AUserTable) Name() sqlapi.TableName

Name gets the table name.

func (AUserTable) PkColumn added in v0.25.0

func (tbl AUserTable) PkColumn() string

PkColumn gets the column name used as a primary key.

func (AUserTable) Query added in v0.8.0

func (tbl AUserTable) 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 *sqlapi.Rows if you need to access its data as a map.

func (AUserTable) QueryOneNullFloat64 added in v0.9.0

func (tbl AUserTable) 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 (AUserTable) QueryOneNullInt64 added in v0.9.0

func (tbl AUserTable) 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 (AUserTable) QueryOneNullString added in v0.9.0

func (tbl AUserTable) 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 (AUserTable) Select added in v0.8.0

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 (AUserTable) SelectOne added in v0.8.0

func (tbl AUserTable) 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 (AUserTable) SelectOneWhere added in v0.9.0

func (tbl AUserTable) 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 (AUserTable) SelectWhere added in v0.9.0

func (tbl AUserTable) 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 (AUserTable) SliceAddressid added in v0.12.0

func (tbl AUserTable) 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 (AUserTable) SliceAvatar added in v0.8.0

func (tbl AUserTable) 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 (AUserTable) SliceEmailaddress added in v0.8.0

func (tbl AUserTable) 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 (AUserTable) SliceF32 added in v0.19.0

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 (AUserTable) SliceF64 added in v0.19.0

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 (AUserTable) SliceI16 added in v0.19.0

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 (AUserTable) SliceI32 added in v0.19.0

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 (AUserTable) SliceI64 added in v0.19.0

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 (AUserTable) SliceI8 added in v0.19.0

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 (AUserTable) SliceLastupdated added in v0.8.0

func (tbl AUserTable) 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 (AUserTable) SliceName added in v0.16.0

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 (AUserTable) SliceRole added in v0.10.0

func (tbl AUserTable) 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 (AUserTable) SliceU16 added in v0.19.0

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 (AUserTable) SliceU32 added in v0.19.0

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 (AUserTable) SliceU64 added in v0.19.0

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 (AUserTable) SliceU8 added in v0.19.0

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 (AUserTable) SliceUid added in v0.8.0

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 (AUserTable) Transact added in v0.51.0

func (tbl AUserTable) Transact(txOptions *sql.TxOptions, fn func(AUserQueryer) 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 (AUserTable) Truncate added in v0.8.0

func (tbl AUserTable) 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 (AUserTable) Tx added in v0.8.0

func (tbl AUserTable) Tx() sqlapi.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 (AUserTable) Update added in v0.8.0

func (tbl AUserTable) 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 (AUserTable) UpdateByAddressid added in v0.61.0

func (tbl AUserTable) UpdateByAddressid(req require.Requirement, addressid int64, fields ...sql.NamedArg) (int64, error)

UpdateByAddressid updates one or more columns, given a addressid value.

func (AUserTable) UpdateByAvatar added in v0.61.0

func (tbl AUserTable) UpdateByAvatar(req require.Requirement, avatar string, fields ...sql.NamedArg) (int64, error)

UpdateByAvatar updates one or more columns, given a avatar value.

func (AUserTable) UpdateByEmailaddress added in v0.61.0

func (tbl AUserTable) UpdateByEmailaddress(req require.Requirement, emailaddress string, fields ...sql.NamedArg) (int64, error)

UpdateByEmailaddress updates one or more columns, given a emailaddress value.

func (AUserTable) UpdateByF32 added in v0.61.0

func (tbl AUserTable) UpdateByF32(req require.Requirement, f32 float32, fields ...sql.NamedArg) (int64, error)

UpdateByF32 updates one or more columns, given a f32 value.

func (AUserTable) UpdateByF64 added in v0.61.0

func (tbl AUserTable) UpdateByF64(req require.Requirement, f64 float64, fields ...sql.NamedArg) (int64, error)

UpdateByF64 updates one or more columns, given a f64 value.

func (AUserTable) UpdateByI16 added in v0.61.0

func (tbl AUserTable) UpdateByI16(req require.Requirement, i16 int16, fields ...sql.NamedArg) (int64, error)

UpdateByI16 updates one or more columns, given a i16 value.

func (AUserTable) UpdateByI32 added in v0.61.0

func (tbl AUserTable) UpdateByI32(req require.Requirement, i32 int32, fields ...sql.NamedArg) (int64, error)

UpdateByI32 updates one or more columns, given a i32 value.

func (AUserTable) UpdateByI64 added in v0.61.0

func (tbl AUserTable) UpdateByI64(req require.Requirement, i64 int64, fields ...sql.NamedArg) (int64, error)

UpdateByI64 updates one or more columns, given a i64 value.

func (AUserTable) UpdateByI8 added in v0.61.0

func (tbl AUserTable) UpdateByI8(req require.Requirement, i8 int8, fields ...sql.NamedArg) (int64, error)

UpdateByI8 updates one or more columns, given a i8 value.

func (AUserTable) UpdateByLastupdated added in v0.61.0

func (tbl AUserTable) UpdateByLastupdated(req require.Requirement, lastupdated int64, fields ...sql.NamedArg) (int64, error)

UpdateByLastupdated updates one or more columns, given a lastupdated value.

func (AUserTable) UpdateByName added in v0.61.0

func (tbl AUserTable) UpdateByName(req require.Requirement, name string, fields ...sql.NamedArg) (int64, error)

UpdateByName updates one or more columns, given a name value.

func (AUserTable) UpdateByRole added in v0.61.0

func (tbl AUserTable) UpdateByRole(req require.Requirement, role Role, fields ...sql.NamedArg) (int64, error)

UpdateByRole updates one or more columns, given a role value.

func (AUserTable) UpdateByU16 added in v0.61.0

func (tbl AUserTable) UpdateByU16(req require.Requirement, u16 uint16, fields ...sql.NamedArg) (int64, error)

UpdateByU16 updates one or more columns, given a u16 value.

func (AUserTable) UpdateByU32 added in v0.61.0

func (tbl AUserTable) UpdateByU32(req require.Requirement, u32 uint32, fields ...sql.NamedArg) (int64, error)

UpdateByU32 updates one or more columns, given a u32 value.

func (AUserTable) UpdateByU64 added in v0.61.0

func (tbl AUserTable) UpdateByU64(req require.Requirement, u64 uint64, fields ...sql.NamedArg) (int64, error)

UpdateByU64 updates one or more columns, given a u64 value.

func (AUserTable) UpdateByU8 added in v0.61.0

func (tbl AUserTable) UpdateByU8(req require.Requirement, u8 uint8, fields ...sql.NamedArg) (int64, error)

UpdateByU8 updates one or more columns, given a u8 value.

func (AUserTable) UpdateByUid added in v0.61.0

func (tbl AUserTable) UpdateByUid(req require.Requirement, uid int64, fields ...sql.NamedArg) (int64, error)

UpdateByUid updates one or more columns, given a uid value.

func (AUserTable) UpdateFields added in v0.8.0

func (tbl AUserTable) 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 (AUserTable) Upsert added in v0.49.0

func (tbl AUserTable) 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 (AUserTable) Using added in v0.9.0

func (tbl AUserTable) Using(tx sqlapi.SqlTx) AUserQueryer

Using returns a modified AUserTabler using the transaction supplied. 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 (AUserTable) WithConstraint added in v0.12.0

func (tbl AUserTable) WithConstraint(cc ...constraint.Constraint) AUserTabler

WithConstraint returns a modified AUserTabler with added data consistency constraints.

func (AUserTable) WithContext added in v0.8.0

func (tbl AUserTable) WithContext(ctx context.Context) AUserTabler

WithContext sets the context for subsequent queries via this table. The result is a modified copy of the table; the original is unchanged.

The shared context in the *Database is not altered by this method. So it is possible to use different contexts for different (groups of) queries.

func (AUserTable) WithPrefix added in v0.8.0

func (tbl AUserTable) WithPrefix(pfx string) AUserTabler

WithPrefix sets the table name prefix for subsequent queries. The result is a modified copy of the table; the original is unchanged.

type AUserTabler added in v0.53.0

type AUserTabler interface {
	sqlapi.Table

	// Constraints returns the table's constraints.
	Constraints() constraint.Constraints

	// WithConstraint returns a modified AUserTabler with added data consistency constraints.
	WithConstraint(cc ...constraint.Constraint) AUserTabler

	// WithPrefix returns a modified AUserTabler with a given table name prefix.
	WithPrefix(pfx string) AUserTabler

	// WithContext returns a modified AUserTabler with a given context.
	WithContext(ctx context.Context) AUserTabler

	// 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)
}

AUserTabler lists table methods provided by AUserTable.

type Address added in v0.12.0

type Address struct {
	Id int64 `sql:"pk: true, auto: true"`
	AddressFields
}

func ScanAddresses added in v0.50.0

func ScanAddresses(query string, rows sqlapi.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.53.0

type AddressFields struct {
	Lines    []string `sql:"encode: json"`
	Town     *string  `sql:"size: 80, index: townIdx"`
	Postcode string   `sql:"size: 20, index: postcodeIdx"`
	UPRN     string   `sql:"nk: true, size: 20"`
}

type AddressQueryer added in v0.60.0

type AddressQueryer interface {
	// Using returns a modified AddressTabler using the transaction supplied.
	Using(tx sqlapi.SqlTx) AddressQueryer

	// Transact runs the function provided within a transaction.
	Transact(txOptions *sql.TxOptions, fn func(AddressQueryer) error) error

	// Tx gets the wrapped transaction handle, provided this is within a transaction.
	// Panics if it is in the wrong state - use IsTx() if necessary.
	Tx() sqlapi.SqlTx

	// IsTx tests whether this is within a transaction.
	IsTx() bool

	// 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)

	// 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 added in v0.12.0

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 added in v0.12.0

func CopyTableAsAddressTable(origin sqlapi.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 added in v0.12.0

func NewAddressTable(name string, d sqlapi.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 added in v0.14.0

func (tbl AddressTable) Constraints() constraint.Constraints

Constraints returns the table's constraints.

func (AddressTable) Count added in v0.12.0

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 added in v0.12.0

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 added in v0.12.0

func (tbl AddressTable) CreateIndexes(ifNotExist bool) (err error)

CreateIndexes executes queries that create the indexes needed by the Address table.

func (AddressTable) CreatePostcodeIdxIndex added in v0.12.0

func (tbl AddressTable) CreatePostcodeIdxIndex(ifNotExist bool) error

CreatePostcodeIdxIndex creates the postcodeIdx index.

func (AddressTable) CreateTable added in v0.12.0

func (tbl AddressTable) CreateTable(ifNotExists bool) (int64, error)

CreateTable creates the table.

func (AddressTable) CreateTableWithIndexes added in v0.12.0

func (tbl AddressTable) CreateTableWithIndexes(ifNotExist bool) (err error)

CreateTableWithIndexes invokes CreateTable then CreateIndexes.

func (AddressTable) CreateTownIdxIndex added in v0.16.0

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 added in v0.12.0

func (tbl AddressTable) Ctx() context.Context

Ctx gets the current request context.

func (AddressTable) DB added in v0.12.0

func (tbl AddressTable) DB() sqlapi.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 added in v0.12.0

func (tbl AddressTable) Database() sqlapi.Database

Database gets the shared database information.

func (AddressTable) Delete added in v0.12.0

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.61.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) Dialect added in v0.12.0

func (tbl AddressTable) Dialect() dialect.Dialect

Dialect gets the database dialect.

func (AddressTable) DropIndexes added in v0.12.0

func (tbl AddressTable) DropIndexes(ifExist bool) (err error)

DropIndexes executes queries that drop the indexes on by the Address table.

func (AddressTable) DropPostcodeIdxIndex added in v0.12.0

func (tbl AddressTable) DropPostcodeIdxIndex(ifExists bool) error

DropPostcodeIdxIndex drops the postcodeIdx index.

func (AddressTable) DropTable added in v0.12.0

func (tbl AddressTable) DropTable(ifExists bool) (int64, error)

DropTable drops the table, destroying all its data.

func (AddressTable) DropTownIdxIndex added in v0.16.0

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 added in v0.12.0

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) Execer added in v0.12.0

func (tbl AddressTable) Execer() sqlapi.Execer

Execer gets the wrapped database or transaction handle.

func (AddressTable) Fetch added in v0.17.0

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 added in v0.16.0

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 added in v0.16.0

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 added in v0.16.0

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 added in v0.16.0

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 added in v0.12.0

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) IsTx added in v0.12.0

func (tbl AddressTable) IsTx() bool

IsTx tests whether this is within a transaction.

func (AddressTable) Logger added in v0.12.0

func (tbl AddressTable) Logger() sqlapi.Logger

Logger gets the trace logger.

func (AddressTable) Name added in v0.12.0

func (tbl AddressTable) Name() sqlapi.TableName

Name gets the table name.

func (AddressTable) PkColumn added in v0.25.0

func (tbl AddressTable) PkColumn() string

PkColumn gets the column name used as a primary key.

func (AddressTable) Query added in v0.12.0

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 *sqlapi.Rows if you need to access its data as a map.

func (AddressTable) QueryOneNullFloat64 added in v0.12.0

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 added in v0.12.0

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 added in v0.12.0

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 added in v0.12.0

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 added in v0.12.0

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 added in v0.12.0

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 added in v0.12.0

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.12.0

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 added in v0.12.0

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 added in v0.16.0

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

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 *sql.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 added in v0.12.0

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) Tx added in v0.12.0

func (tbl AddressTable) Tx() sqlapi.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 added in v0.12.0

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.61.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 added in v0.12.0

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 added in v0.49.0

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 added in v0.12.0

func (tbl AddressTable) Using(tx sqlapi.SqlTx) AddressQueryer

Using returns a modified AddressTabler using the transaction supplied. 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 added in v0.12.0

func (tbl AddressTable) WithConstraint(cc ...constraint.Constraint) AddressTabler

WithConstraint returns a modified AddressTabler with added data consistency constraints.

func (AddressTable) WithContext added in v0.12.0

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.

The shared context in the *Database is not altered by this method. So it is possible to use different contexts for different (groups of) queries.

func (AddressTable) WithPrefix added in v0.12.0

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 {
	sqlapi.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 Association

type Association struct {
	Id       int64 `sql:"pk: true, auto: true"`
	Name     *string
	Quality  *QualName
	Ref1     *int64
	Ref2     *int64
	Category *Category
}

func ScanAssociations added in v0.50.0

func ScanAssociations(query string, rows sqlapi.SqlRows, firstOnly bool) (vv []*Association, n int64, err error)

ScanAssociations 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 AssociationQueryer added in v0.60.0

type AssociationQueryer interface {
	// Using returns a modified AssociationTabler using the transaction supplied.
	Using(tx sqlapi.SqlTx) AssociationQueryer

	// Transact runs the function provided within a transaction.
	Transact(txOptions *sql.TxOptions, fn func(AssociationQueryer) error) error

	// Tx gets the wrapped transaction handle, provided this is within a transaction.
	// Panics if it is in the wrong state - use IsTx() if necessary.
	Tx() sqlapi.SqlTx

	// IsTx tests whether this is within a transaction.
	IsTx() bool

	// Query is the low-level request method for this table using an SQL query that must return all the columns
	// necessary for Association values.
	Query(req require.Requirement, query string, args ...interface{}) ([]*Association, 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)

	// GetAssociationById gets the record with a given primary key value.
	GetAssociationById(req require.Requirement, id int64) (*Association, error)

	// GetAssociationsById gets records from the table according to a list of primary keys.
	GetAssociationsById(req require.Requirement, qc where.QueryConstraint, id ...int64) (list []*Association, err error)

	// SelectOneWhere allows a single Association to be obtained from the table that matches a 'where' clause.
	SelectOneWhere(req require.Requirement, where, orderBy string, args ...interface{}) (*Association, error)

	// SelectOne allows a single Association to be obtained from the table that matches a 'where' clause.
	SelectOne(req require.Requirement, wh where.Expression, qc where.QueryConstraint) (*Association, error)

	// SelectWhere allows Associations to be obtained from the table that match a 'where' clause.
	SelectWhere(req require.Requirement, where, orderBy string, args ...interface{}) ([]*Association, error)

	// Select allows Associations to be obtained from the table that match a 'where' clause.
	Select(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]*Association, error)

	// CountWhere counts Associations in the table that match a 'where' clause.
	CountWhere(where string, args ...interface{}) (count int64, err error)

	// Count counts the Associations 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)

	// 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)

	// SliceRef1 gets the ref1 column for all rows that match the 'where' condition.
	SliceRef1(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int64, error)

	// SliceRef2 gets the ref2 column for all rows that match the 'where' condition.
	SliceRef2(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int64, error)

	// SliceQuality gets the quality column for all rows that match the 'where' condition.
	SliceQuality(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]QualName, error)

	// SliceCategory gets the category column for all rows that match the 'where' condition.
	SliceCategory(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]Category, error)

	// Insert adds new records for the Associations, setting the primary key field for each one.
	Insert(req require.Requirement, vv ...*Association) error

	// UpdateById updates one or more columns, given a id value.
	UpdateById(req require.Requirement, id 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)

	// UpdateByQuality updates one or more columns, given a quality value.
	UpdateByQuality(req require.Requirement, quality QualName, fields ...sql.NamedArg) (int64, error)

	// UpdateByRef1 updates one or more columns, given a ref1 value.
	UpdateByRef1(req require.Requirement, ref1 int64, fields ...sql.NamedArg) (int64, error)

	// UpdateByRef2 updates one or more columns, given a ref2 value.
	UpdateByRef2(req require.Requirement, ref2 int64, fields ...sql.NamedArg) (int64, error)

	// UpdateByCategory updates one or more columns, given a category value.
	UpdateByCategory(req require.Requirement, category Category, 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 ...*Association) (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 *Association, 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)

	// 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)

	// DeleteByQuality deletes rows from the table, given some quality values.
	// The list of ids can be arbitrarily long.
	DeleteByQuality(req require.Requirement, quality ...QualName) (int64, error)

	// DeleteByRef1 deletes rows from the table, given some ref1 values.
	// The list of ids can be arbitrarily long.
	DeleteByRef1(req require.Requirement, ref1 ...int64) (int64, error)

	// DeleteByRef2 deletes rows from the table, given some ref2 values.
	// The list of ids can be arbitrarily long.
	DeleteByRef2(req require.Requirement, ref2 ...int64) (int64, error)

	// DeleteByCategory deletes rows from the table, given some category values.
	// The list of ids can be arbitrarily long.
	DeleteByCategory(req require.Requirement, category ...Category) (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)
}

AssociationQueryer lists query methods provided by AssociationTable.

type AssociationTable

type AssociationTable struct {
	// contains filtered or unexported fields
}

AssociationTable 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 CopyTableAsAssociationTable added in v0.8.0

func CopyTableAsAssociationTable(origin sqlapi.Table) AssociationTable

CopyTableAsAssociationTable copies a table instance, retaining the name etc but providing methods appropriate for 'Association'. It doesn't copy the constraints of the original table.

It serves to provide methods appropriate for 'Association'. 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 NewAssociationTable

func NewAssociationTable(name string, d sqlapi.Database) AssociationTable

NewAssociationTable returns a new table instance. If a blank table name is supplied, the default name "associations" will be used instead. The request context is initialised with the background.

func (AssociationTable) Constraints added in v0.14.0

func (tbl AssociationTable) Constraints() constraint.Constraints

Constraints returns the table's constraints.

func (AssociationTable) Count

func (tbl AssociationTable) Count(wh where.Expression) (count int64, err error)

Count counts the Associations in the table that match a 'where' clause. Use a nil value for the 'wh' argument if it is not needed.

func (AssociationTable) CountWhere added in v0.9.0

func (tbl AssociationTable) CountWhere(where string, args ...interface{}) (count int64, err error)

CountWhere counts Associations 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 (AssociationTable) CreateTable

func (tbl AssociationTable) CreateTable(ifNotExists bool) (int64, error)

CreateTable creates the table.

func (AssociationTable) Ctx

func (tbl AssociationTable) Ctx() context.Context

Ctx gets the current request context.

func (AssociationTable) DB

func (tbl AssociationTable) DB() sqlapi.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 (AssociationTable) Database added in v0.12.0

func (tbl AssociationTable) Database() sqlapi.Database

Database gets the shared database information.

func (AssociationTable) Delete

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 (AssociationTable) DeleteByCategory added in v0.61.0

func (tbl AssociationTable) DeleteByCategory(req require.Requirement, category ...Category) (int64, error)

DeleteByCategory deletes rows from the table, given some category values. The list of ids can be arbitrarily long.

func (AssociationTable) DeleteById added in v0.61.0

func (tbl AssociationTable) 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 (AssociationTable) DeleteByName added in v0.61.0

func (tbl AssociationTable) 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 (AssociationTable) DeleteByQuality added in v0.61.0

func (tbl AssociationTable) DeleteByQuality(req require.Requirement, quality ...QualName) (int64, error)

DeleteByQuality deletes rows from the table, given some quality values. The list of ids can be arbitrarily long.

func (AssociationTable) DeleteByRef1 added in v0.61.0

func (tbl AssociationTable) DeleteByRef1(req require.Requirement, ref1 ...int64) (int64, error)

DeleteByRef1 deletes rows from the table, given some ref1 values. The list of ids can be arbitrarily long.

func (AssociationTable) DeleteByRef2 added in v0.61.0

func (tbl AssociationTable) DeleteByRef2(req require.Requirement, ref2 ...int64) (int64, error)

DeleteByRef2 deletes rows from the table, given some ref2 values. The list of ids can be arbitrarily long.

func (AssociationTable) Dialect

func (tbl AssociationTable) Dialect() dialect.Dialect

Dialect gets the database dialect.

func (AssociationTable) DropTable

func (tbl AssociationTable) DropTable(ifExists bool) (int64, error)

DropTable drops the table, destroying all its data.

func (AssociationTable) Exec

func (tbl AssociationTable) 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 (AssociationTable) Execer added in v0.12.0

func (tbl AssociationTable) Execer() sqlapi.Execer

Execer gets the wrapped database or transaction handle.

func (AssociationTable) Fetch added in v0.17.0

func (tbl AssociationTable) Fetch(req require.Requirement, query string, args ...interface{}) ([]*Association, error)

Fetch fetches a list of Association based on a supplied query. This is mostly used for join queries that map its result columns to the fields of Association. Other queries might be better handled by GetXxx or Select methods.

func (AssociationTable) GetAssociationById added in v0.16.0

func (tbl AssociationTable) GetAssociationById(req require.Requirement, id int64) (*Association, error)

GetAssociationById gets the record with a given primary key value. If not found, *Association will be nil.

func (AssociationTable) GetAssociationsById added in v0.16.0

func (tbl AssociationTable) GetAssociationsById(req require.Requirement, qc where.QueryConstraint, id ...int64) (list []*Association, err error)

GetAssociationsById 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 (AssociationTable) Insert

func (tbl AssociationTable) Insert(req require.Requirement, vv ...*Association) error

Insert adds new records for the Associations.// The Associations have their primary key fields set to the new record identifiers. The Association.PreInsert() method will be called, if it exists.

func (AssociationTable) IsTx

func (tbl AssociationTable) IsTx() bool

IsTx tests whether this is within a transaction.

func (AssociationTable) Logger

func (tbl AssociationTable) Logger() sqlapi.Logger

Logger gets the trace logger.

func (AssociationTable) Name

func (tbl AssociationTable) Name() sqlapi.TableName

Name gets the table name.

func (AssociationTable) PkColumn added in v0.25.0

func (tbl AssociationTable) PkColumn() string

PkColumn gets the column name used as a primary key.

func (AssociationTable) Query

func (tbl AssociationTable) Query(req require.Requirement, query string, args ...interface{}) ([]*Association, error)

Query is the low-level request method for this table. The SQL query must return all the columns necessary for Association 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 *sqlapi.Rows if you need to access its data as a map.

func (AssociationTable) QueryOneNullFloat64 added in v0.9.0

func (tbl AssociationTable) 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 (AssociationTable) QueryOneNullInt64 added in v0.9.0

func (tbl AssociationTable) 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 (AssociationTable) QueryOneNullString added in v0.9.0

func (tbl AssociationTable) 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 (AssociationTable) Select

Select allows Associations 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 (AssociationTable) SelectOne

SelectOne allows a single Association 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 (AssociationTable) SelectOneWhere added in v0.9.0

func (tbl AssociationTable) SelectOneWhere(req require.Requirement, where, orderBy string, args ...interface{}) (*Association, error)

SelectOneWhere allows a single Association 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 (AssociationTable) SelectWhere added in v0.9.0

func (tbl AssociationTable) SelectWhere(req require.Requirement, where, orderBy string, args ...interface{}) ([]*Association, error)

SelectWhere allows Associations 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 (AssociationTable) SliceCategory

SliceCategory gets the category 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 (AssociationTable) SliceId

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 (AssociationTable) SliceName

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 (AssociationTable) SliceQuality

SliceQuality gets the quality 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 (AssociationTable) SliceRef1

SliceRef1 gets the ref1 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 (AssociationTable) SliceRef2

SliceRef2 gets the ref2 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 (AssociationTable) Transact added in v0.51.0

func (tbl AssociationTable) Transact(txOptions *sql.TxOptions, fn func(AssociationQueryer) 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 (AssociationTable) Truncate

func (tbl AssociationTable) 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 (AssociationTable) Tx

func (tbl AssociationTable) Tx() sqlapi.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 (AssociationTable) Update

func (tbl AssociationTable) Update(req require.Requirement, vv ...*Association) (int64, error)

Update updates records, matching them by primary key. It returns the number of rows affected. The Association.PreUpdate(Execer) method will be called, if it exists.

func (AssociationTable) UpdateByCategory added in v0.61.0

func (tbl AssociationTable) UpdateByCategory(req require.Requirement, category Category, fields ...sql.NamedArg) (int64, error)

UpdateByCategory updates one or more columns, given a category value.

func (AssociationTable) UpdateById added in v0.61.0

func (tbl AssociationTable) UpdateById(req require.Requirement, id int64, fields ...sql.NamedArg) (int64, error)

UpdateById updates one or more columns, given a id value.

func (AssociationTable) UpdateByName added in v0.61.0

func (tbl AssociationTable) UpdateByName(req require.Requirement, name string, fields ...sql.NamedArg) (int64, error)

UpdateByName updates one or more columns, given a name value.

func (AssociationTable) UpdateByQuality added in v0.61.0

func (tbl AssociationTable) UpdateByQuality(req require.Requirement, quality QualName, fields ...sql.NamedArg) (int64, error)

UpdateByQuality updates one or more columns, given a quality value.

func (AssociationTable) UpdateByRef1 added in v0.61.0

func (tbl AssociationTable) UpdateByRef1(req require.Requirement, ref1 int64, fields ...sql.NamedArg) (int64, error)

UpdateByRef1 updates one or more columns, given a ref1 value.

func (AssociationTable) UpdateByRef2 added in v0.61.0

func (tbl AssociationTable) UpdateByRef2(req require.Requirement, ref2 int64, fields ...sql.NamedArg) (int64, error)

UpdateByRef2 updates one or more columns, given a ref2 value.

func (AssociationTable) UpdateFields

func (tbl AssociationTable) 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 (AssociationTable) Upsert added in v0.49.0

func (tbl AssociationTable) Upsert(v *Association, 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 (AssociationTable) Using added in v0.9.0

Using returns a modified AssociationTabler using the transaction supplied. 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 (AssociationTable) WithConstraint added in v0.12.0

func (tbl AssociationTable) WithConstraint(cc ...constraint.Constraint) AssociationTabler

WithConstraint returns a modified AssociationTabler with added data consistency constraints.

func (AssociationTable) WithContext

func (tbl AssociationTable) WithContext(ctx context.Context) AssociationTabler

WithContext sets the context for subsequent queries via this table. The result is a modified copy of the table; the original is unchanged.

The shared context in the *Database is not altered by this method. So it is possible to use different contexts for different (groups of) queries.

func (AssociationTable) WithPrefix

func (tbl AssociationTable) WithPrefix(pfx string) AssociationTabler

WithPrefix sets the table name prefix for subsequent queries. The result is a modified copy of the table; the original is unchanged.

type AssociationTabler added in v0.53.0

type AssociationTabler interface {
	sqlapi.Table

	// Constraints returns the table's constraints.
	Constraints() constraint.Constraints

	// WithConstraint returns a modified AssociationTabler with added data consistency constraints.
	WithConstraint(cc ...constraint.Constraint) AssociationTabler

	// WithPrefix returns a modified AssociationTabler with a given table name prefix.
	WithPrefix(pfx string) AssociationTabler

	// WithContext returns a modified AssociationTabler with a given context.
	WithContext(ctx context.Context) AssociationTabler

	// CreateTable creates the table.
	CreateTable(ifNotExists bool) (int64, error)

	// DropTable drops the table, destroying all its data.
	DropTable(ifExists bool) (int64, error)

	// Truncate drops every record from the table, if possible.
	Truncate(force bool) (err error)
}

AssociationTabler lists table methods provided by AssociationTable.

type Author

type Author struct {
	Name     string `sql:"prefixed: true"`
	Email    Email  `sql:"prefixed: true"`
	Username string `sql:"prefixed: true"`
}

type Bounds added in v0.49.0

type Bounds struct {
	After  string `sql:"size: 20"`
	Before string `sql:"size: 20"`
}

type CUserQueryer added in v0.60.0

type CUserQueryer interface {
	// Using returns a modified CUserTabler using the transaction supplied.
	Using(tx sqlapi.SqlTx) CUserQueryer

	// Transact runs the function provided within a transaction.
	Transact(txOptions *sql.TxOptions, fn func(CUserQueryer) error) error

	// Tx gets the wrapped transaction handle, provided this is within a transaction.
	// Panics if it is in the wrong state - use IsTx() if necessary.
	Tx() sqlapi.SqlTx

	// IsTx tests whether this is within a transaction.
	IsTx() bool

	// 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)
}

CUserQueryer lists query methods provided by CUserTable.

type CUserTable added in v0.8.0

type CUserTable struct {
	// contains filtered or unexported fields
}

CUserTable 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 CopyTableAsCUserTable added in v0.8.0

func CopyTableAsCUserTable(origin sqlapi.Table) CUserTable

CopyTableAsCUserTable 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 NewCUserTable added in v0.8.0

func NewCUserTable(name string, d sqlapi.Database) CUserTable

NewCUserTable returns a new table instance. If a blank table name is supplied, the default name "users" will be used instead. The request context is initialised with the background.

func (CUserTable) Constraints added in v0.14.0

func (tbl CUserTable) Constraints() constraint.Constraints

Constraints returns the table's constraints.

func (CUserTable) Count added in v0.49.0

func (tbl CUserTable) 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 (CUserTable) CountWhere added in v0.49.0

func (tbl CUserTable) 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 (CUserTable) Ctx added in v0.8.0

func (tbl CUserTable) Ctx() context.Context

Ctx gets the current request context.

func (CUserTable) DB added in v0.8.0

func (tbl CUserTable) DB() sqlapi.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 (CUserTable) Database added in v0.12.0

func (tbl CUserTable) Database() sqlapi.Database

Database gets the shared database information.

func (CUserTable) Dialect added in v0.8.0

func (tbl CUserTable) Dialect() dialect.Dialect

Dialect gets the database dialect.

func (CUserTable) Execer added in v0.12.0

func (tbl CUserTable) Execer() sqlapi.Execer

Execer gets the wrapped database or transaction handle.

func (CUserTable) IsTx added in v0.8.0

func (tbl CUserTable) IsTx() bool

IsTx tests whether this is within a transaction.

func (CUserTable) Logger added in v0.8.0

func (tbl CUserTable) Logger() sqlapi.Logger

Logger gets the trace logger.

func (CUserTable) Name added in v0.8.0

func (tbl CUserTable) Name() sqlapi.TableName

Name gets the table name.

func (CUserTable) PkColumn added in v0.25.0

func (tbl CUserTable) PkColumn() string

PkColumn gets the column name used as a primary key.

func (CUserTable) Transact added in v0.51.0

func (tbl CUserTable) Transact(txOptions *sql.TxOptions, fn func(CUserQueryer) 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 (CUserTable) Tx added in v0.8.0

func (tbl CUserTable) Tx() sqlapi.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 (CUserTable) Using added in v0.9.0

func (tbl CUserTable) Using(tx sqlapi.SqlTx) CUserQueryer

Using returns a modified CUserTabler using the transaction supplied. 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 (CUserTable) WithConstraint added in v0.12.0

func (tbl CUserTable) WithConstraint(cc ...constraint.Constraint) CUserTabler

WithConstraint returns a modified CUserTabler with added data consistency constraints.

func (CUserTable) WithContext added in v0.8.0

func (tbl CUserTable) WithContext(ctx context.Context) CUserTabler

WithContext sets the context for subsequent queries via this table. The result is a modified copy of the table; the original is unchanged.

The shared context in the *Database is not altered by this method. So it is possible to use different contexts for different (groups of) queries.

func (CUserTable) WithPrefix added in v0.8.0

func (tbl CUserTable) WithPrefix(pfx string) CUserTabler

WithPrefix sets the table name prefix for subsequent queries. The result is a modified copy of the table; the original is unchanged.

type CUserTabler added in v0.53.0

type CUserTabler interface {
	sqlapi.Table

	// Constraints returns the table's constraints.
	Constraints() constraint.Constraints

	// WithConstraint returns a modified CUserTabler with added data consistency constraints.
	WithConstraint(cc ...constraint.Constraint) CUserTabler

	// WithPrefix returns a modified CUserTabler with a given table name prefix.
	WithPrefix(pfx string) CUserTabler

	// WithContext returns a modified CUserTabler with a given context.
	WithContext(ctx context.Context) CUserTabler
}

CUserTabler lists table methods provided by CUserTable.

type Category

type Category uint8
const (
	Alpha Category = iota
	Beta
	Gamma
	Delta
)

type Commit

type Commit struct {
	ID        string `sql:"name: commit_id"`
	Message   string
	Timestamp string
	Author    *Author
	Committer *Author
}

type Compound

type Compound struct {
	Alpha    string `sql:"unique: alpha_beta"`
	Beta     string `sql:"unique: alpha_beta"`
	Category Category
}

func ScanDbCompounds added in v0.50.0

func ScanDbCompounds(query string, rows sqlapi.SqlRows, firstOnly bool) (vv []*Compound, n int64, err error)

ScanDbCompounds 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 DUserQueryer added in v0.60.0

type DUserQueryer interface {
	// Using returns a modified DUserTabler using the transaction supplied.
	Using(tx sqlapi.SqlTx) DUserQueryer

	// Transact runs the function provided within a transaction.
	Transact(txOptions *sql.TxOptions, fn func(DUserQueryer) error) error

	// Tx gets the wrapped transaction handle, provided this is within a transaction.
	// Panics if it is in the wrong state - use IsTx() if necessary.
	Tx() sqlapi.SqlTx

	// IsTx tests whether this is within a transaction.
	IsTx() bool

	// 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)
}

DUserQueryer lists query methods provided by DUserTable.

type DUserTable added in v0.8.0

type DUserTable struct {
	// contains filtered or unexported fields
}

DUserTable 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 CopyTableAsDUserTable added in v0.8.0

func CopyTableAsDUserTable(origin sqlapi.Table) DUserTable

CopyTableAsDUserTable 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 NewDUserTable added in v0.8.0

func NewDUserTable(name string, d sqlapi.Database) DUserTable

NewDUserTable returns a new table instance. If a blank table name is supplied, the default name "users" will be used instead. The request context is initialised with the background.

func (DUserTable) Constraints added in v0.14.0

func (tbl DUserTable) Constraints() constraint.Constraints

Constraints returns the table's constraints.

func (DUserTable) Ctx added in v0.8.0

func (tbl DUserTable) Ctx() context.Context

Ctx gets the current request context.

func (DUserTable) DB added in v0.8.0

func (tbl DUserTable) DB() sqlapi.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 (DUserTable) Database added in v0.12.0

func (tbl DUserTable) Database() sqlapi.Database

Database gets the shared database information.

func (DUserTable) Delete added in v0.8.0

func (tbl DUserTable) 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 (DUserTable) DeleteByAddressid added in v0.61.0

func (tbl DUserTable) 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 (DUserTable) DeleteByAvatar added in v0.61.0

func (tbl DUserTable) 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 (DUserTable) DeleteByEmailaddress added in v0.61.0

func (tbl DUserTable) 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 (DUserTable) DeleteByF32 added in v0.61.0

func (tbl DUserTable) 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 (DUserTable) DeleteByF64 added in v0.61.0

func (tbl DUserTable) 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 (DUserTable) DeleteByI16 added in v0.61.0

func (tbl DUserTable) 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 (DUserTable) DeleteByI32 added in v0.61.0

func (tbl DUserTable) 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 (DUserTable) DeleteByI64 added in v0.61.0

func (tbl DUserTable) 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 (DUserTable) DeleteByI8 added in v0.61.0

func (tbl DUserTable) 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 (DUserTable) DeleteByLastupdated added in v0.61.0

func (tbl DUserTable) 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 (DUserTable) DeleteByName added in v0.61.0

func (tbl DUserTable) 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 (DUserTable) DeleteByRole added in v0.61.0

func (tbl DUserTable) 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 (DUserTable) DeleteByU16 added in v0.61.0

func (tbl DUserTable) 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 (DUserTable) DeleteByU32 added in v0.61.0

func (tbl DUserTable) 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 (DUserTable) DeleteByU64 added in v0.61.0

func (tbl DUserTable) 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 (DUserTable) DeleteByU8 added in v0.61.0

func (tbl DUserTable) 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 (DUserTable) DeleteByUid added in v0.61.0

func (tbl DUserTable) 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 (DUserTable) Dialect added in v0.8.0

func (tbl DUserTable) Dialect() dialect.Dialect

Dialect gets the database dialect.

func (DUserTable) Exec added in v0.8.0

func (tbl DUserTable) 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 (DUserTable) Execer added in v0.12.0

func (tbl DUserTable) Execer() sqlapi.Execer

Execer gets the wrapped database or transaction handle.

func (DUserTable) IsTx added in v0.8.0

func (tbl DUserTable) IsTx() bool

IsTx tests whether this is within a transaction.

func (DUserTable) Logger added in v0.8.0

func (tbl DUserTable) Logger() sqlapi.Logger

Logger gets the trace logger.

func (DUserTable) Name added in v0.8.0

func (tbl DUserTable) Name() sqlapi.TableName

Name gets the table name.

func (DUserTable) PkColumn added in v0.25.0

func (tbl DUserTable) PkColumn() string

PkColumn gets the column name used as a primary key.

func (DUserTable) Transact added in v0.51.0

func (tbl DUserTable) Transact(txOptions *sql.TxOptions, fn func(DUserQueryer) 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 (DUserTable) Tx added in v0.8.0

func (tbl DUserTable) Tx() sqlapi.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 (DUserTable) Using added in v0.9.0

func (tbl DUserTable) Using(tx sqlapi.SqlTx) DUserQueryer

Using returns a modified DUserTabler using the transaction supplied. 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 (DUserTable) WithConstraint added in v0.12.0

func (tbl DUserTable) WithConstraint(cc ...constraint.Constraint) DUserTabler

WithConstraint returns a modified DUserTabler with added data consistency constraints.

func (DUserTable) WithContext added in v0.8.0

func (tbl DUserTable) WithContext(ctx context.Context) DUserTabler

WithContext sets the context for subsequent queries via this table. The result is a modified copy of the table; the original is unchanged.

The shared context in the *Database is not altered by this method. So it is possible to use different contexts for different (groups of) queries.

func (DUserTable) WithPrefix added in v0.8.0

func (tbl DUserTable) WithPrefix(pfx string) DUserTabler

WithPrefix sets the table name prefix for subsequent queries. The result is a modified copy of the table; the original is unchanged.

type DUserTabler added in v0.53.0

type DUserTabler interface {
	sqlapi.Table

	// Constraints returns the table's constraints.
	Constraints() constraint.Constraints

	// WithConstraint returns a modified DUserTabler with added data consistency constraints.
	WithConstraint(cc ...constraint.Constraint) DUserTabler

	// WithPrefix returns a modified DUserTabler with a given table name prefix.
	WithPrefix(pfx string) DUserTabler

	// WithContext returns a modified DUserTabler with a given context.
	WithContext(ctx context.Context) DUserTabler
}

DUserTabler lists table methods provided by DUserTable.

type Date

type Date struct {
	// contains filtered or unexported fields
}

type Dates

type Dates struct {
	Id      uint64          `sql:"pk: true, auto: true"`
	Integer date.Date       `sql:"type: integer"`
	String  date.DateString `sql:"type: text"`
}

func NewDates added in v0.49.0

func NewDates(d date.Date) *Dates

func ScanDatess added in v0.50.0

func ScanDatess(query string, rows sqlapi.SqlRows, firstOnly bool) (vv []*Dates, n int64, err error)

ScanDatess 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 DatesQueryer added in v0.60.0

type DatesQueryer interface {
	// Using returns a modified DatesTabler using the transaction supplied.
	Using(tx sqlapi.SqlTx) DatesQueryer

	// Transact runs the function provided within a transaction.
	Transact(txOptions *sql.TxOptions, fn func(DatesQueryer) error) error

	// Tx gets the wrapped transaction handle, provided this is within a transaction.
	// Panics if it is in the wrong state - use IsTx() if necessary.
	Tx() sqlapi.SqlTx

	// IsTx tests whether this is within a transaction.
	IsTx() bool

	// Query is the low-level request method for this table using an SQL query that must return all the columns
	// necessary for Dates values.
	Query(req require.Requirement, query string, args ...interface{}) ([]*Dates, 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)

	// GetDatesById gets the record with a given primary key value.
	GetDatesById(req require.Requirement, id uint64) (*Dates, error)

	// GetDatessById gets records from the table according to a list of primary keys.
	GetDatessById(req require.Requirement, qc where.QueryConstraint, id ...uint64) (list []*Dates, err error)

	// SelectOneWhere allows a single Dates to be obtained from the table that matches a 'where' clause.
	SelectOneWhere(req require.Requirement, where, orderBy string, args ...interface{}) (*Dates, error)

	// SelectOne allows a single Dates to be obtained from the table that matches a 'where' clause.
	SelectOne(req require.Requirement, wh where.Expression, qc where.QueryConstraint) (*Dates, error)

	// SelectWhere allows Datess to be obtained from the table that match a 'where' clause.
	SelectWhere(req require.Requirement, where, orderBy string, args ...interface{}) ([]*Dates, error)

	// Select allows Datess to be obtained from the table that match a 'where' clause.
	Select(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]*Dates, error)

	// CountWhere counts Datess in the table that match a 'where' clause.
	CountWhere(where string, args ...interface{}) (count int64, err error)

	// Count counts the Datess 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) ([]uint64, error)

	// SliceInteger gets the integer column for all rows that match the 'where' condition.
	SliceInteger(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]date.Date, error)

	// SliceString gets the string column for all rows that match the 'where' condition.
	SliceString(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]date.DateString, error)

	// Insert adds new records for the Datess, setting the primary key field for each one.
	Insert(req require.Requirement, vv ...*Dates) error

	// UpdateById updates one or more columns, given a id value.
	UpdateById(req require.Requirement, id uint64, fields ...sql.NamedArg) (int64, error)

	// UpdateByInteger updates one or more columns, given a integer value.
	UpdateByInteger(req require.Requirement, integer date.Date, fields ...sql.NamedArg) (int64, error)

	// UpdateByString updates one or more columns, given a string value.
	UpdateByString(req require.Requirement, string date.DateString, 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 ...*Dates) (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 *Dates, 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 ...uint64) (int64, error)

	// DeleteByInteger deletes rows from the table, given some integer values.
	// The list of ids can be arbitrarily long.
	DeleteByInteger(req require.Requirement, integer ...date.Date) (int64, error)

	// DeleteByString deletes rows from the table, given some string values.
	// The list of ids can be arbitrarily long.
	DeleteByString(req require.Requirement, string ...date.DateString) (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)
}

DatesQueryer lists query methods provided by DatesTable.

type DatesTable added in v0.49.0

type DatesTable struct {
	// contains filtered or unexported fields
}

DatesTable 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 CopyTableAsDatesTable added in v0.49.0

func CopyTableAsDatesTable(origin sqlapi.Table) DatesTable

CopyTableAsDatesTable copies a table instance, retaining the name etc but providing methods appropriate for 'Dates'. It doesn't copy the constraints of the original table.

It serves to provide methods appropriate for 'Dates'. 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 NewDatesTable added in v0.49.0

func NewDatesTable(name string, d sqlapi.Database) DatesTable

NewDatesTable returns a new table instance. If a blank table name is supplied, the default name "datess" will be used instead. The request context is initialised with the background.

func (DatesTable) Constraints added in v0.49.0

func (tbl DatesTable) Constraints() constraint.Constraints

Constraints returns the table's constraints.

func (DatesTable) Count added in v0.49.0

func (tbl DatesTable) Count(wh where.Expression) (count int64, err error)

Count counts the Datess in the table that match a 'where' clause. Use a nil value for the 'wh' argument if it is not needed.

func (DatesTable) CountWhere added in v0.49.0

func (tbl DatesTable) CountWhere(where string, args ...interface{}) (count int64, err error)

CountWhere counts Datess 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 (DatesTable) CreateTable added in v0.49.0

func (tbl DatesTable) CreateTable(ifNotExists bool) (int64, error)

CreateTable creates the table.

func (DatesTable) Ctx added in v0.49.0

func (tbl DatesTable) Ctx() context.Context

Ctx gets the current request context.

func (DatesTable) DB added in v0.49.0

func (tbl DatesTable) DB() sqlapi.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 (DatesTable) Database added in v0.49.0

func (tbl DatesTable) Database() sqlapi.Database

Database gets the shared database information.

func (DatesTable) Delete added in v0.49.0

func (tbl DatesTable) 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 (DatesTable) DeleteById added in v0.61.0

func (tbl DatesTable) DeleteById(req require.Requirement, id ...uint64) (int64, error)

DeleteById deletes rows from the table, given some id values. The list of ids can be arbitrarily long.

func (DatesTable) DeleteByInteger added in v0.61.0

func (tbl DatesTable) DeleteByInteger(req require.Requirement, integer ...date.Date) (int64, error)

DeleteByInteger deletes rows from the table, given some integer values. The list of ids can be arbitrarily long.

func (DatesTable) DeleteByString added in v0.61.0

func (tbl DatesTable) DeleteByString(req require.Requirement, string ...date.DateString) (int64, error)

DeleteByString deletes rows from the table, given some string values. The list of ids can be arbitrarily long.

func (DatesTable) Dialect added in v0.49.0

func (tbl DatesTable) Dialect() dialect.Dialect

Dialect gets the database dialect.

func (DatesTable) DropTable added in v0.49.0

func (tbl DatesTable) DropTable(ifExists bool) (int64, error)

DropTable drops the table, destroying all its data.

func (DatesTable) Exec added in v0.49.0

func (tbl DatesTable) 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 (DatesTable) Execer added in v0.49.0

func (tbl DatesTable) Execer() sqlapi.Execer

Execer gets the wrapped database or transaction handle.

func (DatesTable) Fetch added in v0.49.0

func (tbl DatesTable) Fetch(req require.Requirement, query string, args ...interface{}) ([]*Dates, error)

Fetch fetches a list of Dates based on a supplied query. This is mostly used for join queries that map its result columns to the fields of Dates. Other queries might be better handled by GetXxx or Select methods.

func (DatesTable) GetDatesById added in v0.49.0

func (tbl DatesTable) GetDatesById(req require.Requirement, id uint64) (*Dates, error)

GetDatesById gets the record with a given primary key value. If not found, *Dates will be nil.

func (DatesTable) GetDatessById added in v0.49.0

func (tbl DatesTable) GetDatessById(req require.Requirement, qc where.QueryConstraint, id ...uint64) (list []*Dates, err error)

GetDatessById 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 (DatesTable) Insert added in v0.49.0

func (tbl DatesTable) Insert(req require.Requirement, vv ...*Dates) error

Insert adds new records for the Datess.// The Datess have their primary key fields set to the new record identifiers. The Dates.PreInsert() method will be called, if it exists.

func (DatesTable) IsTx added in v0.49.0

func (tbl DatesTable) IsTx() bool

IsTx tests whether this is within a transaction.

func (DatesTable) Logger added in v0.49.0

func (tbl DatesTable) Logger() sqlapi.Logger

Logger gets the trace logger.

func (DatesTable) Name added in v0.49.0

func (tbl DatesTable) Name() sqlapi.TableName

Name gets the table name.

func (DatesTable) PkColumn added in v0.49.0

func (tbl DatesTable) PkColumn() string

PkColumn gets the column name used as a primary key.

func (DatesTable) Query added in v0.49.0

func (tbl DatesTable) Query(req require.Requirement, query string, args ...interface{}) ([]*Dates, error)

Query is the low-level request method for this table. The SQL query must return all the columns necessary for Dates 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 *sqlapi.Rows if you need to access its data as a map.

func (DatesTable) QueryOneNullFloat64 added in v0.49.0

func (tbl DatesTable) 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 (DatesTable) QueryOneNullInt64 added in v0.49.0

func (tbl DatesTable) 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 (DatesTable) QueryOneNullString added in v0.49.0

func (tbl DatesTable) 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 (DatesTable) Select added in v0.49.0

Select allows Datess 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 (DatesTable) SelectOne added in v0.49.0

SelectOne allows a single Dates 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 (DatesTable) SelectOneWhere added in v0.49.0

func (tbl DatesTable) SelectOneWhere(req require.Requirement, where, orderBy string, args ...interface{}) (*Dates, error)

SelectOneWhere allows a single Dates 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 (DatesTable) SelectWhere added in v0.49.0

func (tbl DatesTable) SelectWhere(req require.Requirement, where, orderBy string, args ...interface{}) ([]*Dates, error)

SelectWhere allows Datess 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 (DatesTable) SliceId added in v0.49.0

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 (DatesTable) SliceInteger added in v0.49.0

func (tbl DatesTable) SliceInteger(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]date.Date, error)

SliceInteger gets the integer 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 (DatesTable) SliceString added in v0.49.0

SliceString gets the string 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 (DatesTable) Transact added in v0.51.0

func (tbl DatesTable) Transact(txOptions *sql.TxOptions, fn func(DatesQueryer) 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 (DatesTable) Truncate added in v0.49.0

func (tbl DatesTable) 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 (DatesTable) Tx added in v0.49.0

func (tbl DatesTable) Tx() sqlapi.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 (DatesTable) Update added in v0.49.0

func (tbl DatesTable) Update(req require.Requirement, vv ...*Dates) (int64, error)

Update updates records, matching them by primary key. It returns the number of rows affected. The Dates.PreUpdate(Execer) method will be called, if it exists.

func (DatesTable) UpdateById added in v0.61.0

func (tbl DatesTable) UpdateById(req require.Requirement, id uint64, fields ...sql.NamedArg) (int64, error)

UpdateById updates one or more columns, given a id value.

func (DatesTable) UpdateByInteger added in v0.61.0

func (tbl DatesTable) UpdateByInteger(req require.Requirement, integer date.Date, fields ...sql.NamedArg) (int64, error)

UpdateByInteger updates one or more columns, given a integer value.

func (DatesTable) UpdateByString added in v0.61.0

func (tbl DatesTable) UpdateByString(req require.Requirement, string date.DateString, fields ...sql.NamedArg) (int64, error)

UpdateByString updates one or more columns, given a string value.

func (DatesTable) UpdateFields added in v0.49.0

func (tbl DatesTable) 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 (DatesTable) Upsert added in v0.49.0

func (tbl DatesTable) Upsert(v *Dates, 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 (DatesTable) Using added in v0.49.0

func (tbl DatesTable) Using(tx sqlapi.SqlTx) DatesQueryer

Using returns a modified DatesTabler using the transaction supplied. 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 (DatesTable) WithConstraint added in v0.49.0

func (tbl DatesTable) WithConstraint(cc ...constraint.Constraint) DatesTabler

WithConstraint returns a modified DatesTabler with added data consistency constraints.

func (DatesTable) WithContext added in v0.49.0

func (tbl DatesTable) WithContext(ctx context.Context) DatesTabler

WithContext sets the context for subsequent queries via this table. The result is a modified copy of the table; the original is unchanged.

The shared context in the *Database is not altered by this method. So it is possible to use different contexts for different (groups of) queries.

func (DatesTable) WithPrefix added in v0.49.0

func (tbl DatesTable) WithPrefix(pfx string) DatesTabler

WithPrefix sets the table name prefix for subsequent queries. The result is a modified copy of the table; the original is unchanged.

type DatesTabler added in v0.53.0

type DatesTabler interface {
	sqlapi.Table

	// Constraints returns the table's constraints.
	Constraints() constraint.Constraints

	// WithConstraint returns a modified DatesTabler with added data consistency constraints.
	WithConstraint(cc ...constraint.Constraint) DatesTabler

	// WithPrefix returns a modified DatesTabler with a given table name prefix.
	WithPrefix(pfx string) DatesTabler

	// WithContext returns a modified DatesTabler with a given context.
	WithContext(ctx context.Context) DatesTabler

	// CreateTable creates the table.
	CreateTable(ifNotExists bool) (int64, error)

	// DropTable drops the table, destroying all its data.
	DropTable(ifExists bool) (int64, error)

	// Truncate drops every record from the table, if possible.
	Truncate(force bool) (err error)
}

DatesTabler lists table methods provided by DatesTable.

type DbCompoundQueryer added in v0.60.0

type DbCompoundQueryer interface {
	// Using returns a modified DbCompoundTabler using the transaction supplied.
	Using(tx sqlapi.SqlTx) DbCompoundQueryer

	// Transact runs the function provided within a transaction.
	Transact(txOptions *sql.TxOptions, fn func(DbCompoundQueryer) error) error

	// Tx gets the wrapped transaction handle, provided this is within a transaction.
	// Panics if it is in the wrong state - use IsTx() if necessary.
	Tx() sqlapi.SqlTx

	// IsTx tests whether this is within a transaction.
	IsTx() bool

	// Query is the low-level request method for this table using an SQL query that must return all the columns
	// necessary for Compound values.
	Query(req require.Requirement, query string, args ...interface{}) ([]*Compound, 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)

	// GetCompoundByAlphaAndBeta gets the record with given alpha+beta values.
	GetCompoundByAlphaAndBeta(req require.Requirement, alpha string, beta string) (*Compound, error)

	// SelectOneWhere allows a single Compound to be obtained from the table that matches a 'where' clause.
	SelectOneWhere(req require.Requirement, where, orderBy string, args ...interface{}) (*Compound, error)

	// SelectOne allows a single Compound to be obtained from the table that matches a 'where' clause.
	SelectOne(req require.Requirement, wh where.Expression, qc where.QueryConstraint) (*Compound, error)

	// SelectWhere allows Compounds to be obtained from the table that match a 'where' clause.
	SelectWhere(req require.Requirement, where, orderBy string, args ...interface{}) ([]*Compound, error)

	// Select allows Compounds to be obtained from the table that match a 'where' clause.
	Select(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]*Compound, error)

	// CountWhere counts Compounds in the table that match a 'where' clause.
	CountWhere(where string, args ...interface{}) (count int64, err error)

	// Count counts the Compounds in the table that match a 'where' clause.
	Count(wh where.Expression) (count int64, err error)

	// SliceAlpha gets the alpha column for all rows that match the 'where' condition.
	SliceAlpha(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)

	// SliceBeta gets the beta column for all rows that match the 'where' condition.
	SliceBeta(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)

	// SliceCategory gets the category column for all rows that match the 'where' condition.
	SliceCategory(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]Category, error)

	// Insert adds new records for the Compounds.
	Insert(req require.Requirement, vv ...*Compound) error

	// UpdateByAlpha updates one or more columns, given a alpha value.
	UpdateByAlpha(req require.Requirement, alpha string, fields ...sql.NamedArg) (int64, error)

	// UpdateByBeta updates one or more columns, given a beta value.
	UpdateByBeta(req require.Requirement, beta string, fields ...sql.NamedArg) (int64, error)

	// UpdateByCategory updates one or more columns, given a category value.
	UpdateByCategory(req require.Requirement, category Category, 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)

	// DeleteByAlpha deletes rows from the table, given some alpha values.
	// The list of ids can be arbitrarily long.
	DeleteByAlpha(req require.Requirement, alpha ...string) (int64, error)

	// DeleteByBeta deletes rows from the table, given some beta values.
	// The list of ids can be arbitrarily long.
	DeleteByBeta(req require.Requirement, beta ...string) (int64, error)

	// DeleteByCategory deletes rows from the table, given some category values.
	// The list of ids can be arbitrarily long.
	DeleteByCategory(req require.Requirement, category ...Category) (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)
}

DbCompoundQueryer lists query methods provided by DbCompoundTable.

type DbCompoundTable

type DbCompoundTable struct {
	// contains filtered or unexported fields
}

DbCompoundTable 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 CopyTableAsDbCompoundTable added in v0.8.0

func CopyTableAsDbCompoundTable(origin sqlapi.Table) DbCompoundTable

CopyTableAsDbCompoundTable copies a table instance, retaining the name etc but providing methods appropriate for 'Compound'. It doesn't copy the constraints of the original table.

It serves to provide methods appropriate for 'Compound'. 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 NewDbCompoundTable

func NewDbCompoundTable(name string, d sqlapi.Database) DbCompoundTable

NewDbCompoundTable returns a new table instance. If a blank table name is supplied, the default name "compounds" will be used instead. The request context is initialised with the background.

func (DbCompoundTable) Constraints added in v0.14.0

func (tbl DbCompoundTable) Constraints() constraint.Constraints

Constraints returns the table's constraints.

func (DbCompoundTable) Count

func (tbl DbCompoundTable) Count(wh where.Expression) (count int64, err error)

Count counts the Compounds in the table that match a 'where' clause. Use a nil value for the 'wh' argument if it is not needed.

func (DbCompoundTable) CountWhere added in v0.9.0

func (tbl DbCompoundTable) CountWhere(where string, args ...interface{}) (count int64, err error)

CountWhere counts Compounds 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 (DbCompoundTable) CreateAlphaBetaIndex

func (tbl DbCompoundTable) CreateAlphaBetaIndex(ifNotExist bool) error

CreateAlphaBetaIndex creates the alpha_beta index.

func (DbCompoundTable) CreateIndexes

func (tbl DbCompoundTable) CreateIndexes(ifNotExist bool) (err error)

CreateIndexes executes queries that create the indexes needed by the Compound table.

func (DbCompoundTable) CreateTable

func (tbl DbCompoundTable) CreateTable(ifNotExists bool) (int64, error)

CreateTable creates the table.

func (DbCompoundTable) CreateTableWithIndexes

func (tbl DbCompoundTable) CreateTableWithIndexes(ifNotExist bool) (err error)

CreateTableWithIndexes invokes CreateTable then CreateIndexes.

func (DbCompoundTable) Ctx

func (tbl DbCompoundTable) Ctx() context.Context

Ctx gets the current request context.

func (DbCompoundTable) DB

func (tbl DbCompoundTable) DB() sqlapi.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 (DbCompoundTable) Database added in v0.12.0

func (tbl DbCompoundTable) Database() sqlapi.Database

Database gets the shared database information.

func (DbCompoundTable) Delete

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 (DbCompoundTable) DeleteByAlpha added in v0.61.0

func (tbl DbCompoundTable) DeleteByAlpha(req require.Requirement, alpha ...string) (int64, error)

DeleteByAlpha deletes rows from the table, given some alpha values. The list of ids can be arbitrarily long.

func (DbCompoundTable) DeleteByBeta added in v0.61.0

func (tbl DbCompoundTable) DeleteByBeta(req require.Requirement, beta ...string) (int64, error)

DeleteByBeta deletes rows from the table, given some beta values. The list of ids can be arbitrarily long.

func (DbCompoundTable) DeleteByCategory added in v0.61.0

func (tbl DbCompoundTable) DeleteByCategory(req require.Requirement, category ...Category) (int64, error)

DeleteByCategory deletes rows from the table, given some category values. The list of ids can be arbitrarily long.

func (DbCompoundTable) Dialect

func (tbl DbCompoundTable) Dialect() dialect.Dialect

Dialect gets the database dialect.

func (DbCompoundTable) DropAlphaBetaIndex

func (tbl DbCompoundTable) DropAlphaBetaIndex(ifExists bool) error

DropAlphaBetaIndex drops the alpha_beta index.

func (DbCompoundTable) DropIndexes

func (tbl DbCompoundTable) DropIndexes(ifExist bool) (err error)

DropIndexes executes queries that drop the indexes on by the Compound table.

func (DbCompoundTable) DropTable

func (tbl DbCompoundTable) DropTable(ifExists bool) (int64, error)

DropTable drops the table, destroying all its data.

func (DbCompoundTable) Exec

func (tbl DbCompoundTable) 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 (DbCompoundTable) Execer added in v0.12.0

func (tbl DbCompoundTable) Execer() sqlapi.Execer

Execer gets the wrapped database or transaction handle.

func (DbCompoundTable) Fetch added in v0.17.0

func (tbl DbCompoundTable) Fetch(req require.Requirement, query string, args ...interface{}) ([]*Compound, error)

Fetch fetches a list of Compound based on a supplied query. This is mostly used for join queries that map its result columns to the fields of Compound. Other queries might be better handled by GetXxx or Select methods.

func (DbCompoundTable) GetCompoundByAlphaAndBeta added in v0.21.0

func (tbl DbCompoundTable) GetCompoundByAlphaAndBeta(req require.Requirement, alpha string, beta string) (*Compound, error)

GetCompoundByAlphaAndBeta gets the record with given alpha+beta values. If not found, *Compound will be nil.

func (DbCompoundTable) Insert

func (tbl DbCompoundTable) Insert(req require.Requirement, vv ...*Compound) error

Insert adds new records for the Compounds. The Compound.PreInsert() method will be called, if it exists.

func (DbCompoundTable) IsTx

func (tbl DbCompoundTable) IsTx() bool

IsTx tests whether this is within a transaction.

func (DbCompoundTable) Logger

func (tbl DbCompoundTable) Logger() sqlapi.Logger

Logger gets the trace logger.

func (DbCompoundTable) Name

func (tbl DbCompoundTable) Name() sqlapi.TableName

Name gets the table name.

func (DbCompoundTable) Query

func (tbl DbCompoundTable) Query(req require.Requirement, query string, args ...interface{}) ([]*Compound, error)

Query is the low-level request method for this table. The SQL query must return all the columns necessary for Compound 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 *sqlapi.Rows if you need to access its data as a map.

func (DbCompoundTable) QueryOneNullFloat64 added in v0.9.0

func (tbl DbCompoundTable) 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 (DbCompoundTable) QueryOneNullInt64 added in v0.9.0

func (tbl DbCompoundTable) 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 (DbCompoundTable) QueryOneNullString added in v0.9.0

func (tbl DbCompoundTable) 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 (DbCompoundTable) Select

Select allows Compounds 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 (DbCompoundTable) SelectOne

SelectOne allows a single Compound 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 (DbCompoundTable) SelectOneWhere added in v0.9.0

func (tbl DbCompoundTable) SelectOneWhere(req require.Requirement, where, orderBy string, args ...interface{}) (*Compound, error)

SelectOneWhere allows a single Compound 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 (DbCompoundTable) SelectWhere added in v0.9.0

func (tbl DbCompoundTable) SelectWhere(req require.Requirement, where, orderBy string, args ...interface{}) ([]*Compound, error)

SelectWhere allows Compounds 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 (DbCompoundTable) SliceAlpha

SliceAlpha gets the alpha 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 (DbCompoundTable) SliceBeta

SliceBeta gets the beta 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 (DbCompoundTable) SliceCategory

SliceCategory gets the category 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 (DbCompoundTable) Transact added in v0.51.0

func (tbl DbCompoundTable) Transact(txOptions *sql.TxOptions, fn func(DbCompoundQueryer) 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 (DbCompoundTable) Truncate

func (tbl DbCompoundTable) 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 (DbCompoundTable) Tx

func (tbl DbCompoundTable) Tx() sqlapi.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 (DbCompoundTable) UpdateByAlpha added in v0.61.0

func (tbl DbCompoundTable) UpdateByAlpha(req require.Requirement, alpha string, fields ...sql.NamedArg) (int64, error)

UpdateByAlpha updates one or more columns, given a alpha value.

func (DbCompoundTable) UpdateByBeta added in v0.61.0

func (tbl DbCompoundTable) UpdateByBeta(req require.Requirement, beta string, fields ...sql.NamedArg) (int64, error)

UpdateByBeta updates one or more columns, given a beta value.

func (DbCompoundTable) UpdateByCategory added in v0.61.0

func (tbl DbCompoundTable) UpdateByCategory(req require.Requirement, category Category, fields ...sql.NamedArg) (int64, error)

UpdateByCategory updates one or more columns, given a category value.

func (DbCompoundTable) UpdateFields

func (tbl DbCompoundTable) 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 (DbCompoundTable) Using added in v0.9.0

Using returns a modified DbCompoundTabler using the transaction supplied. 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 (DbCompoundTable) WithConstraint added in v0.12.0

func (tbl DbCompoundTable) WithConstraint(cc ...constraint.Constraint) DbCompoundTabler

WithConstraint returns a modified DbCompoundTabler with added data consistency constraints.

func (DbCompoundTable) WithContext

func (tbl DbCompoundTable) WithContext(ctx context.Context) DbCompoundTabler

WithContext sets the context for subsequent queries via this table. The result is a modified copy of the table; the original is unchanged.

The shared context in the *Database is not altered by this method. So it is possible to use different contexts for different (groups of) queries.

func (DbCompoundTable) WithPrefix

func (tbl DbCompoundTable) WithPrefix(pfx string) DbCompoundTabler

WithPrefix sets the table name prefix for subsequent queries. The result is a modified copy of the table; the original is unchanged.

type DbCompoundTabler added in v0.53.0

type DbCompoundTabler interface {
	sqlapi.Table

	// Constraints returns the table's constraints.
	Constraints() constraint.Constraints

	// WithConstraint returns a modified DbCompoundTabler with added data consistency constraints.
	WithConstraint(cc ...constraint.Constraint) DbCompoundTabler

	// WithPrefix returns a modified DbCompoundTabler with a given table name prefix.
	WithPrefix(pfx string) DbCompoundTabler

	// WithContext returns a modified DbCompoundTabler with a given context.
	WithContext(ctx context.Context) DbCompoundTabler

	// 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 Compound table.
	CreateIndexes(ifNotExist bool) (err error)

	// CreateAlphaBetaIndex creates the alpha_beta index.
	CreateAlphaBetaIndex(ifNotExist bool) error

	// DropAlphaBetaIndex drops the alpha_beta index.
	DropAlphaBetaIndex(ifExists bool) error

	// Truncate drops every record from the table, if possible.
	Truncate(force bool) (err error)
}

DbCompoundTabler lists table methods provided by DbCompoundTable.

type DbUserQueryer added in v0.60.0

type DbUserQueryer interface {
	// Using returns a modified DbUserTabler using the transaction supplied.
	Using(tx sqlapi.SqlTx) DbUserQueryer

	// Transact runs the function provided within a transaction.
	Transact(txOptions *sql.TxOptions, fn func(DbUserQueryer) error) error

	// Tx gets the wrapped transaction handle, provided this is within a transaction.
	// Panics if it is in the wrong state - use IsTx() if necessary.
	Tx() sqlapi.SqlTx

	// IsTx tests whether this is within a transaction.
	IsTx() bool

	// 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)

	// 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

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 added in v0.8.0

func CopyTableAsDbUserTable(origin sqlapi.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 sqlapi.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 added in v0.14.0

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 added in v0.9.0

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 added in v0.16.0

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) DB

func (tbl DbUserTable) DB() sqlapi.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 added in v0.12.0

func (tbl DbUserTable) Database() sqlapi.Database

Database gets the shared database information.

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) Dialect

func (tbl DbUserTable) Dialect() dialect.Dialect

Dialect gets the database dialect.

func (DbUserTable) DropEmailaddressIdxIndex added in v0.16.0

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) Execer added in v0.12.0

func (tbl DbUserTable) Execer() sqlapi.Execer

Execer gets the wrapped database or transaction handle.

func (DbUserTable) Fetch added in v0.17.0

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 added in v0.16.0

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 added in v0.16.0

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 added in v0.16.0

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 added in v0.16.0

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) IsTx

func (tbl DbUserTable) IsTx() bool

IsTx tests whether this is within a transaction.

func (DbUserTable) Logger

func (tbl DbUserTable) Logger() sqlapi.Logger

Logger gets the trace logger.

func (DbUserTable) Name

func (tbl DbUserTable) Name() sqlapi.TableName

Name gets the table name.

func (DbUserTable) PkColumn added in v0.25.0

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 *sqlapi.Rows if you need to access its data as a map.

func (DbUserTable) QueryOneNullFloat64 added in v0.9.0

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 added in v0.9.0

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 added in v0.9.0

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

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

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 added in v0.9.0

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 added in v0.9.0

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 added in v0.12.0

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 added in v0.8.0

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 added in v0.19.0

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 added in v0.19.0

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 added in v0.19.0

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 added in v0.19.0

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 added in v0.19.0

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 added in v0.19.0

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 added in v0.8.0

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 added in v0.16.0

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 added in v0.10.0

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 added in v0.19.0

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 added in v0.19.0

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 added in v0.19.0

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 added in v0.19.0

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

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 *sql.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) Tx

func (tbl DbUserTable) Tx() sqlapi.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(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 added in v0.49.0

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 added in v0.9.0

func (tbl DbUserTable) Using(tx sqlapi.SqlTx) DbUserQueryer

Using returns a modified DbUserTabler using the transaction supplied. 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 added in v0.12.0

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.

The shared context in the *Database is not altered by this method. So it is possible to use different contexts for different (groups of) queries.

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 {
	sqlapi.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 EUserQueryer added in v0.60.0

type EUserQueryer interface {
	// Using returns a modified EUserTabler using the transaction supplied.
	Using(tx sqlapi.SqlTx) EUserQueryer

	// Transact runs the function provided within a transaction.
	Transact(txOptions *sql.TxOptions, fn func(EUserQueryer) error) error

	// Tx gets the wrapped transaction handle, provided this is within a transaction.
	// Panics if it is in the wrong state - use IsTx() if necessary.
	Tx() sqlapi.SqlTx

	// IsTx tests whether this is within a transaction.
	IsTx() bool
}

EUserQueryer lists query methods provided by EUserTable.

type EUserTable added in v0.53.0

type EUserTable struct {
	// contains filtered or unexported fields
}

EUserTable 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 CopyTableAsEUserTable added in v0.53.0

func CopyTableAsEUserTable(origin sqlapi.Table) EUserTable

CopyTableAsEUserTable 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 NewEUserTable added in v0.53.0

func NewEUserTable(name string, d sqlapi.Database) EUserTable

NewEUserTable returns a new table instance. If a blank table name is supplied, the default name "users" will be used instead. The request context is initialised with the background.

func (EUserTable) Constraints added in v0.53.0

func (tbl EUserTable) Constraints() constraint.Constraints

Constraints returns the table's constraints.

func (EUserTable) Ctx added in v0.53.0

func (tbl EUserTable) Ctx() context.Context

Ctx gets the current request context.

func (EUserTable) DB added in v0.53.0

func (tbl EUserTable) DB() sqlapi.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 (EUserTable) Database added in v0.53.0

func (tbl EUserTable) Database() sqlapi.Database

Database gets the shared database information.

func (EUserTable) Dialect added in v0.53.0

func (tbl EUserTable) Dialect() dialect.Dialect

Dialect gets the database dialect.

func (EUserTable) Exec added in v0.53.0

func (tbl EUserTable) 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 (EUserTable) Execer added in v0.53.0

func (tbl EUserTable) Execer() sqlapi.Execer

Execer gets the wrapped database or transaction handle.

func (EUserTable) IsTx added in v0.53.0

func (tbl EUserTable) IsTx() bool

IsTx tests whether this is within a transaction.

func (EUserTable) Logger added in v0.53.0

func (tbl EUserTable) Logger() sqlapi.Logger

Logger gets the trace logger.

func (EUserTable) Name added in v0.53.0

func (tbl EUserTable) Name() sqlapi.TableName

Name gets the table name.

func (EUserTable) PkColumn added in v0.53.0

func (tbl EUserTable) PkColumn() string

PkColumn gets the column name used as a primary key.

func (EUserTable) Transact added in v0.53.0

func (tbl EUserTable) Transact(txOptions *sql.TxOptions, fn func(EUserQueryer) 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 (EUserTable) Tx added in v0.53.0

func (tbl EUserTable) Tx() sqlapi.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 (EUserTable) Using added in v0.53.0

func (tbl EUserTable) Using(tx sqlapi.SqlTx) EUserQueryer

Using returns a modified EUserTabler using the transaction supplied. 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 (EUserTable) WithConstraint added in v0.53.0

func (tbl EUserTable) WithConstraint(cc ...constraint.Constraint) EUserTabler

WithConstraint returns a modified EUserTabler with added data consistency constraints.

func (EUserTable) WithContext added in v0.53.0

func (tbl EUserTable) WithContext(ctx context.Context) EUserTabler

WithContext sets the context for subsequent queries via this table. The result is a modified copy of the table; the original is unchanged.

The shared context in the *Database is not altered by this method. So it is possible to use different contexts for different (groups of) queries.

func (EUserTable) WithPrefix added in v0.53.0

func (tbl EUserTable) WithPrefix(pfx string) EUserTabler

WithPrefix sets the table name prefix for subsequent queries. The result is a modified copy of the table; the original is unchanged.

type EUserTabler added in v0.53.0

type EUserTabler interface {
	sqlapi.Table

	// Constraints returns the table's constraints.
	Constraints() constraint.Constraints

	// WithConstraint returns a modified EUserTabler with added data consistency constraints.
	WithConstraint(cc ...constraint.Constraint) EUserTabler

	// WithPrefix returns a modified EUserTabler with a given table name prefix.
	WithPrefix(pfx string) EUserTabler

	// WithContext returns a modified EUserTabler with a given context.
	WithContext(ctx context.Context) EUserTabler
}

EUserTabler lists table methods provided by EUserTable.

type Email

type Email string

type Hook

type Hook struct {
	Id  uint64 `sql:"pk: true, auto: true"`
	Sha string
	Bounds
	Category   Category
	Created    bool
	Deleted    bool
	Forced     bool
	HeadCommit *Commit `sql:"name: head"`
}

type HookList

type HookList []*Hook

func ScanHooks added in v0.50.0

func ScanHooks(query string, rows sqlapi.SqlRows, firstOnly bool) (vv HookList, n int64, err error)

ScanHooks 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 HookQueryer added in v0.60.0

type HookQueryer interface {
	// Using returns a modified HookTabler using the transaction supplied.
	Using(tx sqlapi.SqlTx) HookQueryer

	// Transact runs the function provided within a transaction.
	Transact(txOptions *sql.TxOptions, fn func(HookQueryer) error) error

	// Tx gets the wrapped transaction handle, provided this is within a transaction.
	// Panics if it is in the wrong state - use IsTx() if necessary.
	Tx() sqlapi.SqlTx

	// IsTx tests whether this is within a transaction.
	IsTx() bool

	// Query is the low-level request method for this table using an SQL query that must return all the columns
	// necessary for Hook values.
	Query(req require.Requirement, query string, args ...interface{}) (HookList, 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)

	// GetHookById gets the record with a given primary key value.
	GetHookById(req require.Requirement, id uint64) (*Hook, error)

	// GetHooksById gets records from the table according to a list of primary keys.
	GetHooksById(req require.Requirement, qc where.QueryConstraint, id ...uint64) (list HookList, err error)

	// SelectOneWhere allows a single Hook to be obtained from the table that matches a 'where' clause.
	SelectOneWhere(req require.Requirement, where, orderBy string, args ...interface{}) (*Hook, error)

	// SelectOne allows a single Hook to be obtained from the table that matches a 'where' clause.
	SelectOne(req require.Requirement, wh where.Expression, qc where.QueryConstraint) (*Hook, error)

	// SelectWhere allows Hooks to be obtained from the table that match a 'where' clause.
	SelectWhere(req require.Requirement, where, orderBy string, args ...interface{}) (HookList, error)

	// Select allows Hooks to be obtained from the table that match a 'where' clause.
	Select(req require.Requirement, wh where.Expression, qc where.QueryConstraint) (HookList, error)

	// CountWhere counts Hooks in the table that match a 'where' clause.
	CountWhere(where string, args ...interface{}) (count int64, err error)

	// Count counts the Hooks 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) ([]uint64, error)

	// SliceSha gets the sha column for all rows that match the 'where' condition.
	SliceSha(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)

	// SliceAfter gets the after column for all rows that match the 'where' condition.
	SliceAfter(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)

	// SliceBefore gets the before column for all rows that match the 'where' condition.
	SliceBefore(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)

	// SliceCommitId gets the commit_id column for all rows that match the 'where' condition.
	SliceCommitId(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)

	// SliceMessage gets the message column for all rows that match the 'where' condition.
	SliceMessage(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)

	// SliceTimestamp gets the timestamp column for all rows that match the 'where' condition.
	SliceTimestamp(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)

	// SliceHeadCommitAuthorName gets the head_commit_author_name column for all rows that match the 'where' condition.
	SliceHeadCommitAuthorName(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)

	// SliceHeadCommitAuthorUsername gets the head_commit_author_username column for all rows that match the 'where' condition.
	SliceHeadCommitAuthorUsername(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)

	// SliceHeadCommitCommitterName gets the head_commit_committer_name column for all rows that match the 'where' condition.
	SliceHeadCommitCommitterName(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)

	// SliceHeadCommitCommitterUsername gets the head_commit_committer_username column for all rows that match the 'where' condition.
	SliceHeadCommitCommitterUsername(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)

	// SliceCategory gets the category column for all rows that match the 'where' condition.
	SliceCategory(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]Category, error)

	// SliceHeadCommitAuthorEmail gets the head_commit_author_email column for all rows that match the 'where' condition.
	SliceHeadCommitAuthorEmail(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]Email, error)

	// SliceHeadCommitCommitterEmail gets the head_commit_committer_email column for all rows that match the 'where' condition.
	SliceHeadCommitCommitterEmail(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]Email, error)

	// Insert adds new records for the Hooks, setting the primary key field for each one.
	Insert(req require.Requirement, vv ...*Hook) error

	// UpdateById updates one or more columns, given a id value.
	UpdateById(req require.Requirement, id uint64, fields ...sql.NamedArg) (int64, error)

	// UpdateBySha updates one or more columns, given a sha value.
	UpdateBySha(req require.Requirement, sha string, fields ...sql.NamedArg) (int64, error)

	// UpdateByAfter updates one or more columns, given a after value.
	UpdateByAfter(req require.Requirement, after string, fields ...sql.NamedArg) (int64, error)

	// UpdateByBefore updates one or more columns, given a before value.
	UpdateByBefore(req require.Requirement, before string, fields ...sql.NamedArg) (int64, error)

	// UpdateByCategory updates one or more columns, given a category value.
	UpdateByCategory(req require.Requirement, category Category, fields ...sql.NamedArg) (int64, error)

	// UpdateByCommitId updates one or more columns, given a commit_id value.
	UpdateByCommitId(req require.Requirement, commit_id string, fields ...sql.NamedArg) (int64, error)

	// UpdateByMessage updates one or more columns, given a message value.
	UpdateByMessage(req require.Requirement, message string, fields ...sql.NamedArg) (int64, error)

	// UpdateByTimestamp updates one or more columns, given a timestamp value.
	UpdateByTimestamp(req require.Requirement, timestamp string, fields ...sql.NamedArg) (int64, error)

	// UpdateByHeadCommitAuthorName updates one or more columns, given a head_commit_author_name value.
	UpdateByHeadCommitAuthorName(req require.Requirement, head_commit_author_name string, fields ...sql.NamedArg) (int64, error)

	// UpdateByHeadCommitAuthorEmail updates one or more columns, given a head_commit_author_email value.
	UpdateByHeadCommitAuthorEmail(req require.Requirement, head_commit_author_email Email, fields ...sql.NamedArg) (int64, error)

	// UpdateByHeadCommitAuthorUsername updates one or more columns, given a head_commit_author_username value.
	UpdateByHeadCommitAuthorUsername(req require.Requirement, head_commit_author_username string, fields ...sql.NamedArg) (int64, error)

	// UpdateByHeadCommitCommitterName updates one or more columns, given a head_commit_committer_name value.
	UpdateByHeadCommitCommitterName(req require.Requirement, head_commit_committer_name string, fields ...sql.NamedArg) (int64, error)

	// UpdateByHeadCommitCommitterEmail updates one or more columns, given a head_commit_committer_email value.
	UpdateByHeadCommitCommitterEmail(req require.Requirement, head_commit_committer_email Email, fields ...sql.NamedArg) (int64, error)

	// UpdateByHeadCommitCommitterUsername updates one or more columns, given a head_commit_committer_username value.
	UpdateByHeadCommitCommitterUsername(req require.Requirement, head_commit_committer_username 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 ...*Hook) (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 *Hook, 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 ...uint64) (int64, error)

	// DeleteBySha deletes rows from the table, given some sha values.
	// The list of ids can be arbitrarily long.
	DeleteBySha(req require.Requirement, sha ...string) (int64, error)

	// DeleteByAfter deletes rows from the table, given some after values.
	// The list of ids can be arbitrarily long.
	DeleteByAfter(req require.Requirement, after ...string) (int64, error)

	// DeleteByBefore deletes rows from the table, given some before values.
	// The list of ids can be arbitrarily long.
	DeleteByBefore(req require.Requirement, before ...string) (int64, error)

	// DeleteByCategory deletes rows from the table, given some category values.
	// The list of ids can be arbitrarily long.
	DeleteByCategory(req require.Requirement, category ...Category) (int64, error)

	// DeleteByCommitId deletes rows from the table, given some commit_id values.
	// The list of ids can be arbitrarily long.
	DeleteByCommitId(req require.Requirement, commit_id ...string) (int64, error)

	// DeleteByMessage deletes rows from the table, given some message values.
	// The list of ids can be arbitrarily long.
	DeleteByMessage(req require.Requirement, message ...string) (int64, error)

	// DeleteByTimestamp deletes rows from the table, given some timestamp values.
	// The list of ids can be arbitrarily long.
	DeleteByTimestamp(req require.Requirement, timestamp ...string) (int64, error)

	// DeleteByHeadCommitAuthorName deletes rows from the table, given some head_commit_author_name values.
	// The list of ids can be arbitrarily long.
	DeleteByHeadCommitAuthorName(req require.Requirement, head_commit_author_name ...string) (int64, error)

	// DeleteByHeadCommitAuthorEmail deletes rows from the table, given some head_commit_author_email values.
	// The list of ids can be arbitrarily long.
	DeleteByHeadCommitAuthorEmail(req require.Requirement, head_commit_author_email ...Email) (int64, error)

	// DeleteByHeadCommitAuthorUsername deletes rows from the table, given some head_commit_author_username values.
	// The list of ids can be arbitrarily long.
	DeleteByHeadCommitAuthorUsername(req require.Requirement, head_commit_author_username ...string) (int64, error)

	// DeleteByHeadCommitCommitterName deletes rows from the table, given some head_commit_committer_name values.
	// The list of ids can be arbitrarily long.
	DeleteByHeadCommitCommitterName(req require.Requirement, head_commit_committer_name ...string) (int64, error)

	// DeleteByHeadCommitCommitterEmail deletes rows from the table, given some head_commit_committer_email values.
	// The list of ids can be arbitrarily long.
	DeleteByHeadCommitCommitterEmail(req require.Requirement, head_commit_committer_email ...Email) (int64, error)

	// DeleteByHeadCommitCommitterUsername deletes rows from the table, given some head_commit_committer_username values.
	// The list of ids can be arbitrarily long.
	DeleteByHeadCommitCommitterUsername(req require.Requirement, head_commit_committer_username ...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)
}

HookQueryer lists query methods provided by HookTable.

type HookTable

type HookTable struct {
	// contains filtered or unexported fields
}

HookTable 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 CopyTableAsHookTable added in v0.8.0

func CopyTableAsHookTable(origin sqlapi.Table) HookTable

CopyTableAsHookTable copies a table instance, retaining the name etc but providing methods appropriate for 'Hook'. It doesn't copy the constraints of the original table.

It serves to provide methods appropriate for 'Hook'. 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 NewHookTable

func NewHookTable(name string, d sqlapi.Database) HookTable

NewHookTable returns a new table instance. If a blank table name is supplied, the default name "hooks" will be used instead. The request context is initialised with the background.

func (HookTable) Constraints added in v0.14.0

func (tbl HookTable) Constraints() constraint.Constraints

Constraints returns the table's constraints.

func (HookTable) Count

func (tbl HookTable) Count(wh where.Expression) (count int64, err error)

Count counts the Hooks in the table that match a 'where' clause. Use a nil value for the 'wh' argument if it is not needed.

func (HookTable) CountWhere added in v0.9.0

func (tbl HookTable) CountWhere(where string, args ...interface{}) (count int64, err error)

CountWhere counts Hooks 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 (HookTable) CreateTable

func (tbl HookTable) CreateTable(ifNotExists bool) (int64, error)

CreateTable creates the table.

func (HookTable) Ctx

func (tbl HookTable) Ctx() context.Context

Ctx gets the current request context.

func (HookTable) DB

func (tbl HookTable) DB() sqlapi.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 (HookTable) Database added in v0.12.0

func (tbl HookTable) Database() sqlapi.Database

Database gets the shared database information.

func (HookTable) Delete

func (tbl HookTable) 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 (HookTable) DeleteByAfter added in v0.61.0

func (tbl HookTable) DeleteByAfter(req require.Requirement, after ...string) (int64, error)

DeleteByAfter deletes rows from the table, given some after values. The list of ids can be arbitrarily long.

func (HookTable) DeleteByBefore added in v0.61.0

func (tbl HookTable) DeleteByBefore(req require.Requirement, before ...string) (int64, error)

DeleteByBefore deletes rows from the table, given some before values. The list of ids can be arbitrarily long.

func (HookTable) DeleteByCategory added in v0.61.0

func (tbl HookTable) DeleteByCategory(req require.Requirement, category ...Category) (int64, error)

DeleteByCategory deletes rows from the table, given some category values. The list of ids can be arbitrarily long.

func (HookTable) DeleteByCommitId added in v0.61.0

func (tbl HookTable) DeleteByCommitId(req require.Requirement, commit_id ...string) (int64, error)

DeleteByCommitId deletes rows from the table, given some commit_id values. The list of ids can be arbitrarily long.

func (HookTable) DeleteByHeadCommitAuthorEmail added in v0.61.0

func (tbl HookTable) DeleteByHeadCommitAuthorEmail(req require.Requirement, head_commit_author_email ...Email) (int64, error)

DeleteByHeadCommitAuthorEmail deletes rows from the table, given some head_commit_author_email values. The list of ids can be arbitrarily long.

func (HookTable) DeleteByHeadCommitAuthorName added in v0.61.0

func (tbl HookTable) DeleteByHeadCommitAuthorName(req require.Requirement, head_commit_author_name ...string) (int64, error)

DeleteByHeadCommitAuthorName deletes rows from the table, given some head_commit_author_name values. The list of ids can be arbitrarily long.

func (HookTable) DeleteByHeadCommitAuthorUsername added in v0.61.0

func (tbl HookTable) DeleteByHeadCommitAuthorUsername(req require.Requirement, head_commit_author_username ...string) (int64, error)

DeleteByHeadCommitAuthorUsername deletes rows from the table, given some head_commit_author_username values. The list of ids can be arbitrarily long.

func (HookTable) DeleteByHeadCommitCommitterEmail added in v0.61.0

func (tbl HookTable) DeleteByHeadCommitCommitterEmail(req require.Requirement, head_commit_committer_email ...Email) (int64, error)

DeleteByHeadCommitCommitterEmail deletes rows from the table, given some head_commit_committer_email values. The list of ids can be arbitrarily long.

func (HookTable) DeleteByHeadCommitCommitterName added in v0.61.0

func (tbl HookTable) DeleteByHeadCommitCommitterName(req require.Requirement, head_commit_committer_name ...string) (int64, error)

DeleteByHeadCommitCommitterName deletes rows from the table, given some head_commit_committer_name values. The list of ids can be arbitrarily long.

func (HookTable) DeleteByHeadCommitCommitterUsername added in v0.61.0

func (tbl HookTable) DeleteByHeadCommitCommitterUsername(req require.Requirement, head_commit_committer_username ...string) (int64, error)

DeleteByHeadCommitCommitterUsername deletes rows from the table, given some head_commit_committer_username values. The list of ids can be arbitrarily long.

func (HookTable) DeleteById added in v0.61.0

func (tbl HookTable) DeleteById(req require.Requirement, id ...uint64) (int64, error)

DeleteById deletes rows from the table, given some id values. The list of ids can be arbitrarily long.

func (HookTable) DeleteByMessage added in v0.61.0

func (tbl HookTable) DeleteByMessage(req require.Requirement, message ...string) (int64, error)

DeleteByMessage deletes rows from the table, given some message values. The list of ids can be arbitrarily long.

func (HookTable) DeleteBySha added in v0.61.0

func (tbl HookTable) DeleteBySha(req require.Requirement, sha ...string) (int64, error)

DeleteBySha deletes rows from the table, given some sha values. The list of ids can be arbitrarily long.

func (HookTable) DeleteByTimestamp added in v0.61.0

func (tbl HookTable) DeleteByTimestamp(req require.Requirement, timestamp ...string) (int64, error)

DeleteByTimestamp deletes rows from the table, given some timestamp values. The list of ids can be arbitrarily long.

func (HookTable) Dialect

func (tbl HookTable) Dialect() dialect.Dialect

Dialect gets the database dialect.

func (HookTable) DropTable

func (tbl HookTable) DropTable(ifExists bool) (int64, error)

DropTable drops the table, destroying all its data.

func (HookTable) Exec

func (tbl HookTable) 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 (HookTable) Execer added in v0.12.0

func (tbl HookTable) Execer() sqlapi.Execer

Execer gets the wrapped database or transaction handle.

func (HookTable) Fetch added in v0.17.0

func (tbl HookTable) Fetch(req require.Requirement, query string, args ...interface{}) (HookList, error)

Fetch fetches a list of Hook based on a supplied query. This is mostly used for join queries that map its result columns to the fields of Hook. Other queries might be better handled by GetXxx or Select methods.

func (HookTable) GetHookById added in v0.16.0

func (tbl HookTable) GetHookById(req require.Requirement, id uint64) (*Hook, error)

GetHookById gets the record with a given primary key value. If not found, *Hook will be nil.

func (HookTable) GetHooksById added in v0.16.0

func (tbl HookTable) GetHooksById(req require.Requirement, qc where.QueryConstraint, id ...uint64) (list HookList, err error)

GetHooksById 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 (HookTable) Insert

func (tbl HookTable) Insert(req require.Requirement, vv ...*Hook) error

Insert adds new records for the Hooks.// The Hooks have their primary key fields set to the new record identifiers. The Hook.PreInsert() method will be called, if it exists.

func (HookTable) IsTx

func (tbl HookTable) IsTx() bool

IsTx tests whether this is within a transaction.

func (HookTable) Logger

func (tbl HookTable) Logger() sqlapi.Logger

Logger gets the trace logger.

func (HookTable) Name

func (tbl HookTable) Name() sqlapi.TableName

Name gets the table name.

func (HookTable) PkColumn added in v0.25.0

func (tbl HookTable) PkColumn() string

PkColumn gets the column name used as a primary key.

func (HookTable) Query

func (tbl HookTable) Query(req require.Requirement, query string, args ...interface{}) (HookList, error)

Query is the low-level request method for this table. The SQL query must return all the columns necessary for Hook 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 *sqlapi.Rows if you need to access its data as a map.

func (HookTable) QueryOneNullFloat64 added in v0.9.0

func (tbl HookTable) 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 (HookTable) QueryOneNullInt64 added in v0.9.0

func (tbl HookTable) 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 (HookTable) QueryOneNullString added in v0.9.0

func (tbl HookTable) 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 (HookTable) Select

Select allows Hooks 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 (HookTable) SelectOne

func (tbl HookTable) SelectOne(req require.Requirement, wh where.Expression, qc where.QueryConstraint) (*Hook, error)

SelectOne allows a single Hook 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 (HookTable) SelectOneWhere added in v0.9.0

func (tbl HookTable) SelectOneWhere(req require.Requirement, where, orderBy string, args ...interface{}) (*Hook, error)

SelectOneWhere allows a single Hook 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 (HookTable) SelectWhere added in v0.9.0

func (tbl HookTable) SelectWhere(req require.Requirement, where, orderBy string, args ...interface{}) (HookList, error)

SelectWhere allows Hooks 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 (HookTable) SliceAfter added in v0.8.0

func (tbl HookTable) SliceAfter(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)

SliceAfter gets the after 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 (HookTable) SliceBefore added in v0.8.0

func (tbl HookTable) SliceBefore(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)

SliceBefore gets the before 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 (HookTable) SliceCategory

func (tbl HookTable) SliceCategory(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]Category, error)

SliceCategory gets the category 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 (HookTable) SliceCommitId added in v0.8.0

func (tbl HookTable) SliceCommitId(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)

SliceCommitId gets the commit_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 (HookTable) SliceHeadCommitAuthorEmail added in v0.8.0

func (tbl HookTable) SliceHeadCommitAuthorEmail(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]Email, error)

SliceHeadCommitAuthorEmail gets the head_commit_author_email 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 (HookTable) SliceHeadCommitAuthorName added in v0.8.0

func (tbl HookTable) SliceHeadCommitAuthorName(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)

SliceHeadCommitAuthorName gets the head_commit_author_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 (HookTable) SliceHeadCommitAuthorUsername added in v0.8.0

func (tbl HookTable) SliceHeadCommitAuthorUsername(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)

SliceHeadCommitAuthorUsername gets the head_commit_author_username 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 (HookTable) SliceHeadCommitCommitterEmail added in v0.8.0

func (tbl HookTable) SliceHeadCommitCommitterEmail(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]Email, error)

SliceHeadCommitCommitterEmail gets the head_commit_committer_email 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 (HookTable) SliceHeadCommitCommitterName added in v0.8.0

func (tbl HookTable) SliceHeadCommitCommitterName(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)

SliceHeadCommitCommitterName gets the head_commit_committer_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 (HookTable) SliceHeadCommitCommitterUsername added in v0.8.0

func (tbl HookTable) SliceHeadCommitCommitterUsername(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)

SliceHeadCommitCommitterUsername gets the head_commit_committer_username 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 (HookTable) SliceId

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 (HookTable) SliceMessage added in v0.8.0

func (tbl HookTable) SliceMessage(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)

SliceMessage gets the message 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 (HookTable) SliceSha

SliceSha gets the sha 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 (HookTable) SliceTimestamp added in v0.8.0

func (tbl HookTable) SliceTimestamp(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)

SliceTimestamp gets the timestamp 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 (HookTable) Transact added in v0.51.0

func (tbl HookTable) Transact(txOptions *sql.TxOptions, fn func(HookQueryer) 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 (HookTable) Truncate

func (tbl HookTable) 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 (HookTable) Tx

func (tbl HookTable) Tx() sqlapi.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 (HookTable) Update

func (tbl HookTable) Update(req require.Requirement, vv ...*Hook) (int64, error)

Update updates records, matching them by primary key. It returns the number of rows affected. The Hook.PreUpdate(Execer) method will be called, if it exists.

func (HookTable) UpdateByAfter added in v0.61.0

func (tbl HookTable) UpdateByAfter(req require.Requirement, after string, fields ...sql.NamedArg) (int64, error)

UpdateByAfter updates one or more columns, given a after value.

func (HookTable) UpdateByBefore added in v0.61.0

func (tbl HookTable) UpdateByBefore(req require.Requirement, before string, fields ...sql.NamedArg) (int64, error)

UpdateByBefore updates one or more columns, given a before value.

func (HookTable) UpdateByCategory added in v0.61.0

func (tbl HookTable) UpdateByCategory(req require.Requirement, category Category, fields ...sql.NamedArg) (int64, error)

UpdateByCategory updates one or more columns, given a category value.

func (HookTable) UpdateByCommitId added in v0.61.0

func (tbl HookTable) UpdateByCommitId(req require.Requirement, commit_id string, fields ...sql.NamedArg) (int64, error)

UpdateByCommitId updates one or more columns, given a commit_id value.

func (HookTable) UpdateByHeadCommitAuthorEmail added in v0.61.0

func (tbl HookTable) UpdateByHeadCommitAuthorEmail(req require.Requirement, head_commit_author_email Email, fields ...sql.NamedArg) (int64, error)

UpdateByHeadCommitAuthorEmail updates one or more columns, given a head_commit_author_email value.

func (HookTable) UpdateByHeadCommitAuthorName added in v0.61.0

func (tbl HookTable) UpdateByHeadCommitAuthorName(req require.Requirement, head_commit_author_name string, fields ...sql.NamedArg) (int64, error)

UpdateByHeadCommitAuthorName updates one or more columns, given a head_commit_author_name value.

func (HookTable) UpdateByHeadCommitAuthorUsername added in v0.61.0

func (tbl HookTable) UpdateByHeadCommitAuthorUsername(req require.Requirement, head_commit_author_username string, fields ...sql.NamedArg) (int64, error)

UpdateByHeadCommitAuthorUsername updates one or more columns, given a head_commit_author_username value.

func (HookTable) UpdateByHeadCommitCommitterEmail added in v0.61.0

func (tbl HookTable) UpdateByHeadCommitCommitterEmail(req require.Requirement, head_commit_committer_email Email, fields ...sql.NamedArg) (int64, error)

UpdateByHeadCommitCommitterEmail updates one or more columns, given a head_commit_committer_email value.

func (HookTable) UpdateByHeadCommitCommitterName added in v0.61.0

func (tbl HookTable) UpdateByHeadCommitCommitterName(req require.Requirement, head_commit_committer_name string, fields ...sql.NamedArg) (int64, error)

UpdateByHeadCommitCommitterName updates one or more columns, given a head_commit_committer_name value.

func (HookTable) UpdateByHeadCommitCommitterUsername added in v0.61.0

func (tbl HookTable) UpdateByHeadCommitCommitterUsername(req require.Requirement, head_commit_committer_username string, fields ...sql.NamedArg) (int64, error)

UpdateByHeadCommitCommitterUsername updates one or more columns, given a head_commit_committer_username value.

func (HookTable) UpdateById added in v0.61.0

func (tbl HookTable) UpdateById(req require.Requirement, id uint64, fields ...sql.NamedArg) (int64, error)

UpdateById updates one or more columns, given a id value.

func (HookTable) UpdateByMessage added in v0.61.0

func (tbl HookTable) UpdateByMessage(req require.Requirement, message string, fields ...sql.NamedArg) (int64, error)

UpdateByMessage updates one or more columns, given a message value.

func (HookTable) UpdateBySha added in v0.61.0

func (tbl HookTable) UpdateBySha(req require.Requirement, sha string, fields ...sql.NamedArg) (int64, error)

UpdateBySha updates one or more columns, given a sha value.

func (HookTable) UpdateByTimestamp added in v0.61.0

func (tbl HookTable) UpdateByTimestamp(req require.Requirement, timestamp string, fields ...sql.NamedArg) (int64, error)

UpdateByTimestamp updates one or more columns, given a timestamp value.

func (HookTable) UpdateFields

func (tbl HookTable) 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 (HookTable) Upsert added in v0.49.0

func (tbl HookTable) Upsert(v *Hook, 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 (HookTable) Using added in v0.9.0

func (tbl HookTable) Using(tx sqlapi.SqlTx) HookQueryer

Using returns a modified HookTabler using the transaction supplied. 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 (HookTable) WithConstraint added in v0.12.0

func (tbl HookTable) WithConstraint(cc ...constraint.Constraint) HookTabler

WithConstraint returns a modified HookTabler with added data consistency constraints.

func (HookTable) WithContext

func (tbl HookTable) WithContext(ctx context.Context) HookTabler

WithContext sets the context for subsequent queries via this table. The result is a modified copy of the table; the original is unchanged.

The shared context in the *Database is not altered by this method. So it is possible to use different contexts for different (groups of) queries.

func (HookTable) WithPrefix

func (tbl HookTable) WithPrefix(pfx string) HookTabler

WithPrefix sets the table name prefix for subsequent queries. The result is a modified copy of the table; the original is unchanged.

type HookTabler added in v0.53.0

type HookTabler interface {
	sqlapi.Table

	// Constraints returns the table's constraints.
	Constraints() constraint.Constraints

	// WithConstraint returns a modified HookTabler with added data consistency constraints.
	WithConstraint(cc ...constraint.Constraint) HookTabler

	// WithPrefix returns a modified HookTabler with a given table name prefix.
	WithPrefix(pfx string) HookTabler

	// WithContext returns a modified HookTabler with a given context.
	WithContext(ctx context.Context) HookTabler

	// CreateTable creates the table.
	CreateTable(ifNotExists bool) (int64, error)

	// DropTable drops the table, destroying all its data.
	DropTable(ifExists bool) (int64, error)

	// Truncate drops every record from the table, if possible.
	Truncate(force bool) (err error)
}

HookTabler lists table methods provided by HookTable.

type IUserQueryer added in v0.60.0

type IUserQueryer interface {
	// Using returns a modified IUserTabler using the transaction supplied.
	Using(tx sqlapi.SqlTx) IUserQueryer

	// Transact runs the function provided within a transaction.
	Transact(txOptions *sql.TxOptions, fn func(IUserQueryer) error) error

	// Tx gets the wrapped transaction handle, provided this is within a transaction.
	// Panics if it is in the wrong state - use IsTx() if necessary.
	Tx() sqlapi.SqlTx

	// IsTx tests whether this is within a transaction.
	IsTx() bool

	// Insert adds new records for the Users, setting the primary key field for each one.
	Insert(req require.Requirement, vv ...*User) error
}

IUserQueryer lists query methods provided by IUserTable.

type IUserTable added in v0.49.0

type IUserTable struct {
	// contains filtered or unexported fields
}

IUserTable 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 CopyTableAsIUserTable added in v0.49.0

func CopyTableAsIUserTable(origin sqlapi.Table) IUserTable

CopyTableAsIUserTable 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 NewIUserTable added in v0.49.0

func NewIUserTable(name string, d sqlapi.Database) IUserTable

NewIUserTable returns a new table instance. If a blank table name is supplied, the default name "users" will be used instead. The request context is initialised with the background.

func (IUserTable) Constraints added in v0.49.0

func (tbl IUserTable) Constraints() constraint.Constraints

Constraints returns the table's constraints.

func (IUserTable) Ctx added in v0.49.0

func (tbl IUserTable) Ctx() context.Context

Ctx gets the current request context.

func (IUserTable) DB added in v0.49.0

func (tbl IUserTable) DB() sqlapi.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 (IUserTable) Database added in v0.49.0

func (tbl IUserTable) Database() sqlapi.Database

Database gets the shared database information.

func (IUserTable) Dialect added in v0.49.0

func (tbl IUserTable) Dialect() dialect.Dialect

Dialect gets the database dialect.

func (IUserTable) Execer added in v0.49.0

func (tbl IUserTable) Execer() sqlapi.Execer

Execer gets the wrapped database or transaction handle.

func (IUserTable) Insert added in v0.49.0

func (tbl IUserTable) 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 (IUserTable) IsTx added in v0.49.0

func (tbl IUserTable) IsTx() bool

IsTx tests whether this is within a transaction.

func (IUserTable) Logger added in v0.49.0

func (tbl IUserTable) Logger() sqlapi.Logger

Logger gets the trace logger.

func (IUserTable) Name added in v0.49.0

func (tbl IUserTable) Name() sqlapi.TableName

Name gets the table name.

func (IUserTable) PkColumn added in v0.49.0

func (tbl IUserTable) PkColumn() string

PkColumn gets the column name used as a primary key.

func (IUserTable) Transact added in v0.51.0

func (tbl IUserTable) Transact(txOptions *sql.TxOptions, fn func(IUserQueryer) 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 (IUserTable) Tx added in v0.49.0

func (tbl IUserTable) Tx() sqlapi.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 (IUserTable) Using added in v0.49.0

func (tbl IUserTable) Using(tx sqlapi.SqlTx) IUserQueryer

Using returns a modified IUserTabler using the transaction supplied. 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 (IUserTable) WithConstraint added in v0.49.0

func (tbl IUserTable) WithConstraint(cc ...constraint.Constraint) IUserTabler

WithConstraint returns a modified IUserTabler with added data consistency constraints.

func (IUserTable) WithContext added in v0.49.0

func (tbl IUserTable) WithContext(ctx context.Context) IUserTabler

WithContext sets the context for subsequent queries via this table. The result is a modified copy of the table; the original is unchanged.

The shared context in the *Database is not altered by this method. So it is possible to use different contexts for different (groups of) queries.

func (IUserTable) WithPrefix added in v0.49.0

func (tbl IUserTable) WithPrefix(pfx string) IUserTabler

WithPrefix sets the table name prefix for subsequent queries. The result is a modified copy of the table; the original is unchanged.

type IUserTabler added in v0.53.0

type IUserTabler interface {
	sqlapi.Table

	// Constraints returns the table's constraints.
	Constraints() constraint.Constraints

	// WithConstraint returns a modified IUserTabler with added data consistency constraints.
	WithConstraint(cc ...constraint.Constraint) IUserTabler

	// WithPrefix returns a modified IUserTabler with a given table name prefix.
	WithPrefix(pfx string) IUserTabler

	// WithContext returns a modified IUserTabler with a given context.
	WithContext(ctx context.Context) IUserTabler
}

IUserTabler lists table methods provided by IUserTable.

type Issue

type Issue struct {
	Id       int64 `sql:"pk: true, auto: true"`
	Number   int
	Date     Date
	Title    string   `sql:"size: 512"`
	Body     string   `sql:"size: 2048, name: bigbody"`
	Assignee string   `sql:"index: issue_assignee"`
	State    string   `sql:"size: 50"`
	Labels   []string `sql:"encode: json"`
	// contains filtered or unexported fields
}

func ScanIssues added in v0.50.0

func ScanIssues(query string, rows sqlapi.SqlRows, firstOnly bool) (vv []*Issue, n int64, err error)

ScanIssues 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 (*Issue) SetAssignee added in v0.8.0

func (v *Issue) SetAssignee(x string) *Issue

SetAssignee sets the Assignee field and returns the modified Issue.

func (*Issue) SetBody added in v0.8.0

func (v *Issue) SetBody(x string) *Issue

SetBody sets the Body field and returns the modified Issue.

func (*Issue) SetDate added in v0.8.0

func (v *Issue) SetDate(x Date) *Issue

SetDate sets the Date field and returns the modified Issue.

func (*Issue) SetId added in v0.8.0

func (v *Issue) SetId(x int64) *Issue

SetId sets the Id field and returns the modified Issue.

func (*Issue) SetLabels added in v0.8.0

func (v *Issue) SetLabels(x []string) *Issue

SetLabels sets the Labels field and returns the modified Issue.

func (*Issue) SetNumber added in v0.8.0

func (v *Issue) SetNumber(x int) *Issue

SetNumber sets the Number field and returns the modified Issue.

func (*Issue) SetState added in v0.8.0

func (v *Issue) SetState(x string) *Issue

SetState sets the State field and returns the modified Issue.

func (*Issue) SetTitle added in v0.8.0

func (v *Issue) SetTitle(x string) *Issue

SetTitle sets the Title field and returns the modified Issue.

type IssueQueryer added in v0.60.0

type IssueQueryer interface {
	// Using returns a modified IssueTabler using the transaction supplied.
	Using(tx sqlapi.SqlTx) IssueQueryer

	// Transact runs the function provided within a transaction.
	Transact(txOptions *sql.TxOptions, fn func(IssueQueryer) error) error

	// Tx gets the wrapped transaction handle, provided this is within a transaction.
	// Panics if it is in the wrong state - use IsTx() if necessary.
	Tx() sqlapi.SqlTx

	// IsTx tests whether this is within a transaction.
	IsTx() bool

	// Query is the low-level request method for this table using an SQL query that must return all the columns
	// necessary for Issue values.
	Query(req require.Requirement, query string, args ...interface{}) ([]*Issue, 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)

	// GetIssueById gets the record with a given primary key value.
	GetIssueById(req require.Requirement, id int64) (*Issue, error)

	// GetIssuesById gets records from the table according to a list of primary keys.
	GetIssuesById(req require.Requirement, qc where.QueryConstraint, id ...int64) (list []*Issue, err error)

	// GetIssuesByAssignee gets the records with a given assignee value.
	GetIssuesByAssignee(req require.Requirement, qc where.QueryConstraint, assignee string) ([]*Issue, error)

	// SelectOneWhere allows a single Issue to be obtained from the table that matches a 'where' clause.
	SelectOneWhere(req require.Requirement, where, orderBy string, args ...interface{}) (*Issue, error)

	// SelectOne allows a single Issue to be obtained from the table that matches a 'where' clause.
	SelectOne(req require.Requirement, wh where.Expression, qc where.QueryConstraint) (*Issue, error)

	// SelectWhere allows Issues to be obtained from the table that match a 'where' clause.
	SelectWhere(req require.Requirement, where, orderBy string, args ...interface{}) ([]*Issue, error)

	// Select allows Issues to be obtained from the table that match a 'where' clause.
	Select(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]*Issue, error)

	// CountWhere counts Issues in the table that match a 'where' clause.
	CountWhere(where string, args ...interface{}) (count int64, err error)

	// Count counts the Issues 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)

	// SliceNumber gets the number column for all rows that match the 'where' condition.
	SliceNumber(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int, error)

	// SliceTitle gets the title column for all rows that match the 'where' condition.
	SliceTitle(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)

	// SliceBigbody gets the bigbody column for all rows that match the 'where' condition.
	SliceBigbody(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)

	// SliceAssignee gets the assignee column for all rows that match the 'where' condition.
	SliceAssignee(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)

	// SliceState gets the state column for all rows that match the 'where' condition.
	SliceState(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)

	// Insert adds new records for the Issues, setting the primary key field for each one.
	Insert(req require.Requirement, vv ...*Issue) error

	// UpdateById updates one or more columns, given a id value.
	UpdateById(req require.Requirement, id int64, fields ...sql.NamedArg) (int64, error)

	// UpdateByNumber updates one or more columns, given a number value.
	UpdateByNumber(req require.Requirement, number int, fields ...sql.NamedArg) (int64, error)

	// UpdateByTitle updates one or more columns, given a title value.
	UpdateByTitle(req require.Requirement, title string, fields ...sql.NamedArg) (int64, error)

	// UpdateByBigbody updates one or more columns, given a bigbody value.
	UpdateByBigbody(req require.Requirement, bigbody string, fields ...sql.NamedArg) (int64, error)

	// UpdateByAssignee updates one or more columns, given a assignee value.
	UpdateByAssignee(req require.Requirement, assignee string, fields ...sql.NamedArg) (int64, error)

	// UpdateByState updates one or more columns, given a state value.
	UpdateByState(req require.Requirement, state 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 ...*Issue) (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 *Issue, 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)

	// DeleteByNumber deletes rows from the table, given some number values.
	// The list of ids can be arbitrarily long.
	DeleteByNumber(req require.Requirement, number ...int) (int64, error)

	// DeleteByTitle deletes rows from the table, given some title values.
	// The list of ids can be arbitrarily long.
	DeleteByTitle(req require.Requirement, title ...string) (int64, error)

	// DeleteByBigbody deletes rows from the table, given some bigbody values.
	// The list of ids can be arbitrarily long.
	DeleteByBigbody(req require.Requirement, bigbody ...string) (int64, error)

	// DeleteByAssignee deletes rows from the table, given some assignee values.
	// The list of ids can be arbitrarily long.
	DeleteByAssignee(req require.Requirement, assignee ...string) (int64, error)

	// DeleteByState deletes rows from the table, given some state values.
	// The list of ids can be arbitrarily long.
	DeleteByState(req require.Requirement, state ...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)
}

IssueQueryer lists query methods provided by IssueTable.

type IssueTable

type IssueTable struct {
	// contains filtered or unexported fields
}

IssueTable 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 CopyTableAsIssueTable added in v0.8.0

func CopyTableAsIssueTable(origin sqlapi.Table) IssueTable

CopyTableAsIssueTable copies a table instance, retaining the name etc but providing methods appropriate for 'Issue'. It doesn't copy the constraints of the original table.

It serves to provide methods appropriate for 'Issue'. 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 NewIssueTable

func NewIssueTable(name string, d sqlapi.Database) IssueTable

NewIssueTable returns a new table instance. If a blank table name is supplied, the default name "issues" will be used instead. The request context is initialised with the background.

func (IssueTable) Constraints added in v0.14.0

func (tbl IssueTable) Constraints() constraint.Constraints

Constraints returns the table's constraints.

func (IssueTable) Count

func (tbl IssueTable) Count(wh where.Expression) (count int64, err error)

Count counts the Issues in the table that match a 'where' clause. Use a nil value for the 'wh' argument if it is not needed.

func (IssueTable) CountWhere added in v0.9.0

func (tbl IssueTable) CountWhere(where string, args ...interface{}) (count int64, err error)

CountWhere counts Issues 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 (IssueTable) CreateIndexes

func (tbl IssueTable) CreateIndexes(ifNotExist bool) (err error)

CreateIndexes executes queries that create the indexes needed by the Issue table.

func (IssueTable) CreateIssueAssigneeIndex

func (tbl IssueTable) CreateIssueAssigneeIndex(ifNotExist bool) error

CreateIssueAssigneeIndex creates the issue_assignee index.

func (IssueTable) CreateTable

func (tbl IssueTable) CreateTable(ifNotExists bool) (int64, error)

CreateTable creates the table.

func (IssueTable) CreateTableWithIndexes

func (tbl IssueTable) CreateTableWithIndexes(ifNotExist bool) (err error)

CreateTableWithIndexes invokes CreateTable then CreateIndexes.

func (IssueTable) Ctx

func (tbl IssueTable) Ctx() context.Context

Ctx gets the current request context.

func (IssueTable) DB

func (tbl IssueTable) DB() sqlapi.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 (IssueTable) Database added in v0.12.0

func (tbl IssueTable) Database() sqlapi.Database

Database gets the shared database information.

func (IssueTable) Delete

func (tbl IssueTable) 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 (IssueTable) DeleteByAssignee added in v0.61.0

func (tbl IssueTable) DeleteByAssignee(req require.Requirement, assignee ...string) (int64, error)

DeleteByAssignee deletes rows from the table, given some assignee values. The list of ids can be arbitrarily long.

func (IssueTable) DeleteByBigbody added in v0.61.0

func (tbl IssueTable) DeleteByBigbody(req require.Requirement, bigbody ...string) (int64, error)

DeleteByBigbody deletes rows from the table, given some bigbody values. The list of ids can be arbitrarily long.

func (IssueTable) DeleteById added in v0.61.0

func (tbl IssueTable) 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 (IssueTable) DeleteByNumber added in v0.61.0

func (tbl IssueTable) DeleteByNumber(req require.Requirement, number ...int) (int64, error)

DeleteByNumber deletes rows from the table, given some number values. The list of ids can be arbitrarily long.

func (IssueTable) DeleteByState added in v0.61.0

func (tbl IssueTable) DeleteByState(req require.Requirement, state ...string) (int64, error)

DeleteByState deletes rows from the table, given some state values. The list of ids can be arbitrarily long.

func (IssueTable) DeleteByTitle added in v0.61.0

func (tbl IssueTable) DeleteByTitle(req require.Requirement, title ...string) (int64, error)

DeleteByTitle deletes rows from the table, given some title values. The list of ids can be arbitrarily long.

func (IssueTable) Dialect

func (tbl IssueTable) Dialect() dialect.Dialect

Dialect gets the database dialect.

func (IssueTable) DropIndexes

func (tbl IssueTable) DropIndexes(ifExist bool) (err error)

DropIndexes executes queries that drop the indexes on by the Issue table.

func (IssueTable) DropIssueAssigneeIndex

func (tbl IssueTable) DropIssueAssigneeIndex(ifExists bool) error

DropIssueAssigneeIndex drops the issue_assignee index.

func (IssueTable) DropTable

func (tbl IssueTable) DropTable(ifExists bool) (int64, error)

DropTable drops the table, destroying all its data.

func (IssueTable) Exec

func (tbl IssueTable) 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 (IssueTable) Execer added in v0.12.0

func (tbl IssueTable) Execer() sqlapi.Execer

Execer gets the wrapped database or transaction handle.

func (IssueTable) Fetch added in v0.17.0

func (tbl IssueTable) Fetch(req require.Requirement, query string, args ...interface{}) ([]*Issue, error)

Fetch fetches a list of Issue based on a supplied query. This is mostly used for join queries that map its result columns to the fields of Issue. Other queries might be better handled by GetXxx or Select methods.

func (IssueTable) GetIssueById added in v0.16.0

func (tbl IssueTable) GetIssueById(req require.Requirement, id int64) (*Issue, error)

GetIssueById gets the record with a given primary key value. If not found, *Issue will be nil.

func (IssueTable) GetIssuesByAssignee added in v0.16.0

func (tbl IssueTable) GetIssuesByAssignee(req require.Requirement, qc where.QueryConstraint, assignee string) ([]*Issue, error)

GetIssuesByAssignee gets the records with a given assignee value. If not found, the resulting slice will be empty (nil).

func (IssueTable) GetIssuesById added in v0.16.0

func (tbl IssueTable) GetIssuesById(req require.Requirement, qc where.QueryConstraint, id ...int64) (list []*Issue, err error)

GetIssuesById 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 (IssueTable) Insert

func (tbl IssueTable) Insert(req require.Requirement, vv ...*Issue) error

Insert adds new records for the Issues.// The Issues have their primary key fields set to the new record identifiers. The Issue.PreInsert() method will be called, if it exists.

func (IssueTable) IsTx

func (tbl IssueTable) IsTx() bool

IsTx tests whether this is within a transaction.

func (IssueTable) Logger

func (tbl IssueTable) Logger() sqlapi.Logger

Logger gets the trace logger.

func (IssueTable) Name

func (tbl IssueTable) Name() sqlapi.TableName

Name gets the table name.

func (IssueTable) PkColumn added in v0.25.0

func (tbl IssueTable) PkColumn() string

PkColumn gets the column name used as a primary key.

func (IssueTable) Query

func (tbl IssueTable) Query(req require.Requirement, query string, args ...interface{}) ([]*Issue, error)

Query is the low-level request method for this table. The SQL query must return all the columns necessary for Issue 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 *sqlapi.Rows if you need to access its data as a map.

func (IssueTable) QueryOneNullFloat64 added in v0.9.0

func (tbl IssueTable) 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 (IssueTable) QueryOneNullInt64 added in v0.9.0

func (tbl IssueTable) 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 (IssueTable) QueryOneNullString added in v0.9.0

func (tbl IssueTable) 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 (IssueTable) Select

Select allows Issues 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 (IssueTable) SelectOne

SelectOne allows a single Issue 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 (IssueTable) SelectOneWhere added in v0.9.0

func (tbl IssueTable) SelectOneWhere(req require.Requirement, where, orderBy string, args ...interface{}) (*Issue, error)

SelectOneWhere allows a single Issue 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 (IssueTable) SelectWhere added in v0.9.0

func (tbl IssueTable) SelectWhere(req require.Requirement, where, orderBy string, args ...interface{}) ([]*Issue, error)

SelectWhere allows Issues 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 (IssueTable) SliceAssignee

func (tbl IssueTable) SliceAssignee(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)

SliceAssignee gets the assignee 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 (IssueTable) SliceBigbody added in v0.8.0

func (tbl IssueTable) SliceBigbody(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)

SliceBigbody gets the bigbody 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 (IssueTable) SliceId

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 (IssueTable) SliceNumber

func (tbl IssueTable) SliceNumber(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int, error)

SliceNumber gets the number 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 (IssueTable) SliceState

func (tbl IssueTable) SliceState(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)

SliceState gets the state 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 (IssueTable) SliceTitle

func (tbl IssueTable) SliceTitle(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)

SliceTitle gets the title 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 (IssueTable) Transact added in v0.51.0

func (tbl IssueTable) Transact(txOptions *sql.TxOptions, fn func(IssueQueryer) 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 (IssueTable) Truncate

func (tbl IssueTable) 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 (IssueTable) Tx

func (tbl IssueTable) Tx() sqlapi.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 (IssueTable) Update

func (tbl IssueTable) Update(req require.Requirement, vv ...*Issue) (int64, error)

Update updates records, matching them by primary key. It returns the number of rows affected. The Issue.PreUpdate(Execer) method will be called, if it exists.

func (IssueTable) UpdateByAssignee added in v0.61.0

func (tbl IssueTable) UpdateByAssignee(req require.Requirement, assignee string, fields ...sql.NamedArg) (int64, error)

UpdateByAssignee updates one or more columns, given a assignee value.

func (IssueTable) UpdateByBigbody added in v0.61.0

func (tbl IssueTable) UpdateByBigbody(req require.Requirement, bigbody string, fields ...sql.NamedArg) (int64, error)

UpdateByBigbody updates one or more columns, given a bigbody value.

func (IssueTable) UpdateById added in v0.61.0

func (tbl IssueTable) UpdateById(req require.Requirement, id int64, fields ...sql.NamedArg) (int64, error)

UpdateById updates one or more columns, given a id value.

func (IssueTable) UpdateByNumber added in v0.61.0

func (tbl IssueTable) UpdateByNumber(req require.Requirement, number int, fields ...sql.NamedArg) (int64, error)

UpdateByNumber updates one or more columns, given a number value.

func (IssueTable) UpdateByState added in v0.61.0

func (tbl IssueTable) UpdateByState(req require.Requirement, state string, fields ...sql.NamedArg) (int64, error)

UpdateByState updates one or more columns, given a state value.

func (IssueTable) UpdateByTitle added in v0.61.0

func (tbl IssueTable) UpdateByTitle(req require.Requirement, title string, fields ...sql.NamedArg) (int64, error)

UpdateByTitle updates one or more columns, given a title value.

func (IssueTable) UpdateFields

func (tbl IssueTable) 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 (IssueTable) Upsert added in v0.49.0

func (tbl IssueTable) Upsert(v *Issue, 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 (IssueTable) Using added in v0.9.0

func (tbl IssueTable) Using(tx sqlapi.SqlTx) IssueQueryer

Using returns a modified IssueTabler using the transaction supplied. 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 (IssueTable) WithConstraint added in v0.12.0

func (tbl IssueTable) WithConstraint(cc ...constraint.Constraint) IssueTabler

WithConstraint returns a modified IssueTabler with added data consistency constraints.

func (IssueTable) WithContext

func (tbl IssueTable) WithContext(ctx context.Context) IssueTabler

WithContext sets the context for subsequent queries via this table. The result is a modified copy of the table; the original is unchanged.

The shared context in the *Database is not altered by this method. So it is possible to use different contexts for different (groups of) queries.

func (IssueTable) WithPrefix

func (tbl IssueTable) WithPrefix(pfx string) IssueTabler

WithPrefix sets the table name prefix for subsequent queries. The result is a modified copy of the table; the original is unchanged.

type IssueTabler added in v0.53.0

type IssueTabler interface {
	sqlapi.Table

	// Constraints returns the table's constraints.
	Constraints() constraint.Constraints

	// WithConstraint returns a modified IssueTabler with added data consistency constraints.
	WithConstraint(cc ...constraint.Constraint) IssueTabler

	// WithPrefix returns a modified IssueTabler with a given table name prefix.
	WithPrefix(pfx string) IssueTabler

	// WithContext returns a modified IssueTabler with a given context.
	WithContext(ctx context.Context) IssueTabler

	// 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 Issue table.
	CreateIndexes(ifNotExist bool) (err error)

	// CreateIssueAssigneeIndex creates the issue_assignee index.
	CreateIssueAssigneeIndex(ifNotExist bool) error

	// DropIssueAssigneeIndex drops the issue_assignee index.
	DropIssueAssigneeIndex(ifExists bool) error

	// Truncate drops every record from the table, if possible.
	Truncate(force bool) (err error)
}

IssueTabler lists table methods provided by IssueTable.

type LUserQueryer added in v0.60.0

type LUserQueryer interface {
	// Using returns a modified LUserTabler using the transaction supplied.
	Using(tx sqlapi.SqlTx) LUserQueryer

	// Transact runs the function provided within a transaction.
	Transact(txOptions *sql.TxOptions, fn func(LUserQueryer) error) error

	// Tx gets the wrapped transaction handle, provided this is within a transaction.
	// Panics if it is in the wrong state - use IsTx() if necessary.
	Tx() sqlapi.SqlTx

	// IsTx tests whether this is within a transaction.
	IsTx() bool

	// 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)
}

LUserQueryer lists query methods provided by LUserTable.

type LUserTable added in v0.53.0

type LUserTable struct {
	// contains filtered or unexported fields
}

LUserTable 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 CopyTableAsLUserTable added in v0.53.0

func CopyTableAsLUserTable(origin sqlapi.Table) LUserTable

CopyTableAsLUserTable 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 NewLUserTable added in v0.53.0

func NewLUserTable(name string, d sqlapi.Database) LUserTable

NewLUserTable returns a new table instance. If a blank table name is supplied, the default name "users" will be used instead. The request context is initialised with the background.

func (LUserTable) Constraints added in v0.53.0

func (tbl LUserTable) Constraints() constraint.Constraints

Constraints returns the table's constraints.

func (LUserTable) Ctx added in v0.53.0

func (tbl LUserTable) Ctx() context.Context

Ctx gets the current request context.

func (LUserTable) DB added in v0.53.0

func (tbl LUserTable) DB() sqlapi.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 (LUserTable) Database added in v0.53.0

func (tbl LUserTable) Database() sqlapi.Database

Database gets the shared database information.

func (LUserTable) Dialect added in v0.53.0

func (tbl LUserTable) Dialect() dialect.Dialect

Dialect gets the database dialect.

func (LUserTable) Execer added in v0.53.0

func (tbl LUserTable) Execer() sqlapi.Execer

Execer gets the wrapped database or transaction handle.

func (LUserTable) IsTx added in v0.53.0

func (tbl LUserTable) IsTx() bool

IsTx tests whether this is within a transaction.

func (LUserTable) Logger added in v0.53.0

func (tbl LUserTable) Logger() sqlapi.Logger

Logger gets the trace logger.

func (LUserTable) Name added in v0.53.0

func (tbl LUserTable) Name() sqlapi.TableName

Name gets the table name.

func (LUserTable) PkColumn added in v0.53.0

func (tbl LUserTable) PkColumn() string

PkColumn gets the column name used as a primary key.

func (LUserTable) SliceAddressid added in v0.53.0

func (tbl LUserTable) 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 (LUserTable) SliceAvatar added in v0.53.0

func (tbl LUserTable) 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 (LUserTable) SliceEmailaddress added in v0.53.0

func (tbl LUserTable) 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 (LUserTable) SliceF32 added in v0.53.0

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 (LUserTable) SliceF64 added in v0.53.0

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 (LUserTable) SliceI16 added in v0.53.0

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 (LUserTable) SliceI32 added in v0.53.0

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 (LUserTable) SliceI64 added in v0.53.0

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 (LUserTable) SliceI8 added in v0.53.0

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 (LUserTable) SliceLastupdated added in v0.53.0

func (tbl LUserTable) 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 (LUserTable) SliceName added in v0.53.0

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 (LUserTable) SliceRole added in v0.53.0

func (tbl LUserTable) 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 (LUserTable) SliceU16 added in v0.53.0

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 (LUserTable) SliceU32 added in v0.53.0

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 (LUserTable) SliceU64 added in v0.53.0

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 (LUserTable) SliceU8 added in v0.53.0

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 (LUserTable) SliceUid added in v0.53.0

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 (LUserTable) Transact added in v0.53.0

func (tbl LUserTable) Transact(txOptions *sql.TxOptions, fn func(LUserQueryer) 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 (LUserTable) Tx added in v0.53.0

func (tbl LUserTable) Tx() sqlapi.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 (LUserTable) Using added in v0.53.0

func (tbl LUserTable) Using(tx sqlapi.SqlTx) LUserQueryer

Using returns a modified LUserTabler using the transaction supplied. 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 (LUserTable) WithConstraint added in v0.53.0

func (tbl LUserTable) WithConstraint(cc ...constraint.Constraint) LUserTabler

WithConstraint returns a modified LUserTabler with added data consistency constraints.

func (LUserTable) WithContext added in v0.53.0

func (tbl LUserTable) WithContext(ctx context.Context) LUserTabler

WithContext sets the context for subsequent queries via this table. The result is a modified copy of the table; the original is unchanged.

The shared context in the *Database is not altered by this method. So it is possible to use different contexts for different (groups of) queries.

func (LUserTable) WithPrefix added in v0.53.0

func (tbl LUserTable) WithPrefix(pfx string) LUserTabler

WithPrefix sets the table name prefix for subsequent queries. The result is a modified copy of the table; the original is unchanged.

type LUserTabler added in v0.53.0

type LUserTabler interface {
	sqlapi.Table

	// Constraints returns the table's constraints.
	Constraints() constraint.Constraints

	// WithConstraint returns a modified LUserTabler with added data consistency constraints.
	WithConstraint(cc ...constraint.Constraint) LUserTabler

	// WithPrefix returns a modified LUserTabler with a given table name prefix.
	WithPrefix(pfx string) LUserTabler

	// WithContext returns a modified LUserTabler with a given context.
	WithContext(ctx context.Context) LUserTabler
}

LUserTabler lists table methods provided by LUserTable.

type Numbers added in v0.19.0

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 PUserQueryer added in v0.60.0

type PUserQueryer interface {
	// Using returns a modified PUserTabler using the transaction supplied.
	Using(tx sqlapi.SqlTx) PUserQueryer

	// Transact runs the function provided within a transaction.
	Transact(txOptions *sql.TxOptions, fn func(PUserQueryer) error) error

	// Tx gets the wrapped transaction handle, provided this is within a transaction.
	// Panics if it is in the wrong state - use IsTx() if necessary.
	Tx() sqlapi.SqlTx

	// IsTx tests whether this is within a transaction.
	IsTx() bool

	// 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
}

PUserQueryer lists query methods provided by PUserTable.

type PUserTable added in v0.53.0

type PUserTable struct {
	// contains filtered or unexported fields
}

PUserTable 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 CopyTableAsPUserTable added in v0.53.0

func CopyTableAsPUserTable(origin sqlapi.Table) PUserTable

CopyTableAsPUserTable 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 NewPUserTable added in v0.53.0

func NewPUserTable(name string, d sqlapi.Database) PUserTable

NewPUserTable returns a new table instance. If a blank table name is supplied, the default name "users" will be used instead. The request context is initialised with the background.

func (PUserTable) Constraints added in v0.53.0

func (tbl PUserTable) Constraints() constraint.Constraints

Constraints returns the table's constraints.

func (PUserTable) Ctx added in v0.53.0

func (tbl PUserTable) Ctx() context.Context

Ctx gets the current request context.

func (PUserTable) DB added in v0.53.0

func (tbl PUserTable) DB() sqlapi.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 (PUserTable) Database added in v0.53.0

func (tbl PUserTable) Database() sqlapi.Database

Database gets the shared database information.

func (PUserTable) Dialect added in v0.53.0

func (tbl PUserTable) Dialect() dialect.Dialect

Dialect gets the database dialect.

func (PUserTable) Exec added in v0.53.0

func (tbl PUserTable) 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 (PUserTable) Execer added in v0.53.0

func (tbl PUserTable) Execer() sqlapi.Execer

Execer gets the wrapped database or transaction handle.

func (PUserTable) Insert added in v0.53.0

func (tbl PUserTable) 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 (PUserTable) IsTx added in v0.53.0

func (tbl PUserTable) IsTx() bool

IsTx tests whether this is within a transaction.

func (PUserTable) Logger added in v0.53.0

func (tbl PUserTable) Logger() sqlapi.Logger

Logger gets the trace logger.

func (PUserTable) Name added in v0.53.0

func (tbl PUserTable) Name() sqlapi.TableName

Name gets the table name.

func (PUserTable) PkColumn added in v0.53.0

func (tbl PUserTable) PkColumn() string

PkColumn gets the column name used as a primary key.

func (PUserTable) Transact added in v0.53.0

func (tbl PUserTable) Transact(txOptions *sql.TxOptions, fn func(PUserQueryer) 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 (PUserTable) Tx added in v0.53.0

func (tbl PUserTable) Tx() sqlapi.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 (PUserTable) Update added in v0.53.0

func (tbl PUserTable) 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 (PUserTable) UpdateByAddressid added in v0.61.0

func (tbl PUserTable) UpdateByAddressid(req require.Requirement, addressid int64, fields ...sql.NamedArg) (int64, error)

UpdateByAddressid updates one or more columns, given a addressid value.

func (PUserTable) UpdateByAvatar added in v0.61.0

func (tbl PUserTable) UpdateByAvatar(req require.Requirement, avatar string, fields ...sql.NamedArg) (int64, error)

UpdateByAvatar updates one or more columns, given a avatar value.

func (PUserTable) UpdateByEmailaddress added in v0.61.0

func (tbl PUserTable) UpdateByEmailaddress(req require.Requirement, emailaddress string, fields ...sql.NamedArg) (int64, error)

UpdateByEmailaddress updates one or more columns, given a emailaddress value.

func (PUserTable) UpdateByF32 added in v0.61.0

func (tbl PUserTable) UpdateByF32(req require.Requirement, f32 float32, fields ...sql.NamedArg) (int64, error)

UpdateByF32 updates one or more columns, given a f32 value.

func (PUserTable) UpdateByF64 added in v0.61.0

func (tbl PUserTable) UpdateByF64(req require.Requirement, f64 float64, fields ...sql.NamedArg) (int64, error)

UpdateByF64 updates one or more columns, given a f64 value.

func (PUserTable) UpdateByI16 added in v0.61.0

func (tbl PUserTable) UpdateByI16(req require.Requirement, i16 int16, fields ...sql.NamedArg) (int64, error)

UpdateByI16 updates one or more columns, given a i16 value.

func (PUserTable) UpdateByI32 added in v0.61.0

func (tbl PUserTable) UpdateByI32(req require.Requirement, i32 int32, fields ...sql.NamedArg) (int64, error)

UpdateByI32 updates one or more columns, given a i32 value.

func (PUserTable) UpdateByI64 added in v0.61.0

func (tbl PUserTable) UpdateByI64(req require.Requirement, i64 int64, fields ...sql.NamedArg) (int64, error)

UpdateByI64 updates one or more columns, given a i64 value.

func (PUserTable) UpdateByI8 added in v0.61.0

func (tbl PUserTable) UpdateByI8(req require.Requirement, i8 int8, fields ...sql.NamedArg) (int64, error)

UpdateByI8 updates one or more columns, given a i8 value.

func (PUserTable) UpdateByLastupdated added in v0.61.0

func (tbl PUserTable) UpdateByLastupdated(req require.Requirement, lastupdated int64, fields ...sql.NamedArg) (int64, error)

UpdateByLastupdated updates one or more columns, given a lastupdated value.

func (PUserTable) UpdateByName added in v0.61.0

func (tbl PUserTable) UpdateByName(req require.Requirement, name string, fields ...sql.NamedArg) (int64, error)

UpdateByName updates one or more columns, given a name value.

func (PUserTable) UpdateByRole added in v0.61.0

func (tbl PUserTable) UpdateByRole(req require.Requirement, role Role, fields ...sql.NamedArg) (int64, error)

UpdateByRole updates one or more columns, given a role value.

func (PUserTable) UpdateByU16 added in v0.61.0

func (tbl PUserTable) UpdateByU16(req require.Requirement, u16 uint16, fields ...sql.NamedArg) (int64, error)

UpdateByU16 updates one or more columns, given a u16 value.

func (PUserTable) UpdateByU32 added in v0.61.0

func (tbl PUserTable) UpdateByU32(req require.Requirement, u32 uint32, fields ...sql.NamedArg) (int64, error)

UpdateByU32 updates one or more columns, given a u32 value.

func (PUserTable) UpdateByU64 added in v0.61.0

func (tbl PUserTable) UpdateByU64(req require.Requirement, u64 uint64, fields ...sql.NamedArg) (int64, error)

UpdateByU64 updates one or more columns, given a u64 value.

func (PUserTable) UpdateByU8 added in v0.61.0

func (tbl PUserTable) UpdateByU8(req require.Requirement, u8 uint8, fields ...sql.NamedArg) (int64, error)

UpdateByU8 updates one or more columns, given a u8 value.

func (PUserTable) UpdateByUid added in v0.61.0

func (tbl PUserTable) UpdateByUid(req require.Requirement, uid int64, fields ...sql.NamedArg) (int64, error)

UpdateByUid updates one or more columns, given a uid value.

func (PUserTable) UpdateFields added in v0.53.0

func (tbl PUserTable) 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 (PUserTable) Upsert added in v0.53.0

func (tbl PUserTable) 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 (PUserTable) Using added in v0.53.0

func (tbl PUserTable) Using(tx sqlapi.SqlTx) PUserQueryer

Using returns a modified PUserTabler using the transaction supplied. 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 (PUserTable) WithConstraint added in v0.53.0

func (tbl PUserTable) WithConstraint(cc ...constraint.Constraint) PUserTabler

WithConstraint returns a modified PUserTabler with added data consistency constraints.

func (PUserTable) WithContext added in v0.53.0

func (tbl PUserTable) WithContext(ctx context.Context) PUserTabler

WithContext sets the context for subsequent queries via this table. The result is a modified copy of the table; the original is unchanged.

The shared context in the *Database is not altered by this method. So it is possible to use different contexts for different (groups of) queries.

func (PUserTable) WithPrefix added in v0.53.0

func (tbl PUserTable) WithPrefix(pfx string) PUserTabler

WithPrefix sets the table name prefix for subsequent queries. The result is a modified copy of the table; the original is unchanged.

type PUserTabler added in v0.53.0

type PUserTabler interface {
	sqlapi.Table

	// Constraints returns the table's constraints.
	Constraints() constraint.Constraints

	// WithConstraint returns a modified PUserTabler with added data consistency constraints.
	WithConstraint(cc ...constraint.Constraint) PUserTabler

	// WithPrefix returns a modified PUserTabler with a given table name prefix.
	WithPrefix(pfx string) PUserTabler

	// WithContext returns a modified PUserTabler with a given context.
	WithContext(ctx context.Context) PUserTabler
}

PUserTabler lists table methods provided by PUserTable.

type QUserQueryer added in v0.60.0

type QUserQueryer interface {
	// Using returns a modified QUserTabler using the transaction supplied.
	Using(tx sqlapi.SqlTx) QUserQueryer

	// Transact runs the function provided within a transaction.
	Transact(txOptions *sql.TxOptions, fn func(QUserQueryer) error) error

	// Tx gets the wrapped transaction handle, provided this is within a transaction.
	// Panics if it is in the wrong state - use IsTx() if necessary.
	Tx() sqlapi.SqlTx

	// IsTx tests whether this is within a transaction.
	IsTx() bool

	// 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)
}

QUserQueryer lists query methods provided by QUserTable.

type QUserTable added in v0.53.0

type QUserTable struct {
	// contains filtered or unexported fields
}

QUserTable 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 CopyTableAsQUserTable added in v0.53.0

func CopyTableAsQUserTable(origin sqlapi.Table) QUserTable

CopyTableAsQUserTable 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 NewQUserTable added in v0.53.0

func NewQUserTable(name string, d sqlapi.Database) QUserTable

NewQUserTable returns a new table instance. If a blank table name is supplied, the default name "users" will be used instead. The request context is initialised with the background.

func (QUserTable) Constraints added in v0.53.0

func (tbl QUserTable) Constraints() constraint.Constraints

Constraints returns the table's constraints.

func (QUserTable) Ctx added in v0.53.0

func (tbl QUserTable) Ctx() context.Context

Ctx gets the current request context.

func (QUserTable) DB added in v0.53.0

func (tbl QUserTable) DB() sqlapi.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 (QUserTable) Database added in v0.53.0

func (tbl QUserTable) Database() sqlapi.Database

Database gets the shared database information.

func (QUserTable) Dialect added in v0.53.0

func (tbl QUserTable) Dialect() dialect.Dialect

Dialect gets the database dialect.

func (QUserTable) Execer added in v0.53.0

func (tbl QUserTable) Execer() sqlapi.Execer

Execer gets the wrapped database or transaction handle.

func (QUserTable) IsTx added in v0.53.0

func (tbl QUserTable) IsTx() bool

IsTx tests whether this is within a transaction.

func (QUserTable) Logger added in v0.53.0

func (tbl QUserTable) Logger() sqlapi.Logger

Logger gets the trace logger.

func (QUserTable) Name added in v0.53.0

func (tbl QUserTable) Name() sqlapi.TableName

Name gets the table name.

func (QUserTable) PkColumn added in v0.53.0

func (tbl QUserTable) PkColumn() string

PkColumn gets the column name used as a primary key.

func (QUserTable) Query added in v0.53.0

func (tbl QUserTable) 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 *sqlapi.Rows if you need to access its data as a map.

func (QUserTable) QueryOneNullFloat64 added in v0.53.0

func (tbl QUserTable) 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 (QUserTable) QueryOneNullInt64 added in v0.53.0

func (tbl QUserTable) 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 (QUserTable) QueryOneNullString added in v0.53.0

func (tbl QUserTable) 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 (QUserTable) Transact added in v0.53.0

func (tbl QUserTable) Transact(txOptions *sql.TxOptions, fn func(QUserQueryer) 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 (QUserTable) Tx added in v0.53.0

func (tbl QUserTable) Tx() sqlapi.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 (QUserTable) Using added in v0.53.0

func (tbl QUserTable) Using(tx sqlapi.SqlTx) QUserQueryer

Using returns a modified QUserTabler using the transaction supplied. 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 (QUserTable) WithConstraint added in v0.53.0

func (tbl QUserTable) WithConstraint(cc ...constraint.Constraint) QUserTabler

WithConstraint returns a modified QUserTabler with added data consistency constraints.

func (QUserTable) WithContext added in v0.53.0

func (tbl QUserTable) WithContext(ctx context.Context) QUserTabler

WithContext sets the context for subsequent queries via this table. The result is a modified copy of the table; the original is unchanged.

The shared context in the *Database is not altered by this method. So it is possible to use different contexts for different (groups of) queries.

func (QUserTable) WithPrefix added in v0.53.0

func (tbl QUserTable) WithPrefix(pfx string) QUserTabler

WithPrefix sets the table name prefix for subsequent queries. The result is a modified copy of the table; the original is unchanged.

type QUserTabler added in v0.53.0

type QUserTabler interface {
	sqlapi.Table

	// Constraints returns the table's constraints.
	Constraints() constraint.Constraints

	// WithConstraint returns a modified QUserTabler with added data consistency constraints.
	WithConstraint(cc ...constraint.Constraint) QUserTabler

	// WithPrefix returns a modified QUserTabler with a given table name prefix.
	WithPrefix(pfx string) QUserTabler

	// WithContext returns a modified QUserTabler with a given context.
	WithContext(ctx context.Context) QUserTabler
}

QUserTabler lists table methods provided by QUserTable.

type QualName added in v0.33.0

type QualName string

type Role added in v0.10.0

type Role int8
const (
	Unknown Role = iota
	UserRole
	AdminRole
)

func (*Role) Parse added in v0.10.0

func (v *Role) Parse(s string) error

func (*Role) Scan added in v0.10.0

func (r *Role) Scan(value interface{}) error

func (Role) String added in v0.10.0

func (v Role) String() string

func (Role) Value added in v0.10.0

func (r Role) Value() (driver.Value, error)

type SUserQueryer added in v0.60.0

type SUserQueryer interface {
	// Using returns a modified SUserTabler using the transaction supplied.
	Using(tx sqlapi.SqlTx) SUserQueryer

	// Transact runs the function provided within a transaction.
	Transact(txOptions *sql.TxOptions, fn func(SUserQueryer) error) error

	// Tx gets the wrapped transaction handle, provided this is within a transaction.
	// Panics if it is in the wrong state - use IsTx() if necessary.
	Tx() sqlapi.SqlTx

	// IsTx tests whether this is within a transaction.
	IsTx() bool

	// 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)

	// 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)
}

SUserQueryer lists query methods provided by SUserTable.

type SUserTable added in v0.8.0

type SUserTable struct {
	// contains filtered or unexported fields
}

SUserTable 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 CopyTableAsSUserTable added in v0.8.0

func CopyTableAsSUserTable(origin sqlapi.Table) SUserTable

CopyTableAsSUserTable 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 NewSUserTable added in v0.8.0

func NewSUserTable(name string, d sqlapi.Database) SUserTable

NewSUserTable returns a new table instance. If a blank table name is supplied, the default name "users" will be used instead. The request context is initialised with the background.

func (SUserTable) Constraints added in v0.14.0

func (tbl SUserTable) Constraints() constraint.Constraints

Constraints returns the table's constraints.

func (SUserTable) Count added in v0.53.0

func (tbl SUserTable) 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 (SUserTable) CountWhere added in v0.53.0

func (tbl SUserTable) 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 (SUserTable) Ctx added in v0.8.0

func (tbl SUserTable) Ctx() context.Context

Ctx gets the current request context.

func (SUserTable) DB added in v0.8.0

func (tbl SUserTable) DB() sqlapi.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 (SUserTable) Database added in v0.12.0

func (tbl SUserTable) Database() sqlapi.Database

Database gets the shared database information.

func (SUserTable) Dialect added in v0.8.0

func (tbl SUserTable) Dialect() dialect.Dialect

Dialect gets the database dialect.

func (SUserTable) Execer added in v0.12.0

func (tbl SUserTable) Execer() sqlapi.Execer

Execer gets the wrapped database or transaction handle.

func (SUserTable) Fetch added in v0.53.0

func (tbl SUserTable) 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 (SUserTable) GetUserByEmailAddress added in v0.53.0

func (tbl SUserTable) 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 (SUserTable) GetUserByName added in v0.53.0

func (tbl SUserTable) 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 (SUserTable) GetUserByUid added in v0.53.0

func (tbl SUserTable) 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 (SUserTable) GetUsersByEmailAddress added in v0.61.0

func (tbl SUserTable) GetUsersByEmailAddress(req require.Requirement, qc where.QueryConstraint, emailaddress ...string) ([]*User, error)

GetUsersByEmailAddress gets the record with a given emailaddress value.

func (SUserTable) GetUsersByName added in v0.61.0

func (tbl SUserTable) GetUsersByName(req require.Requirement, qc where.QueryConstraint, name ...string) ([]*User, error)

GetUsersByName gets the record with a given name value.

func (SUserTable) GetUsersByUid added in v0.53.0

func (tbl SUserTable) 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 (SUserTable) IsTx added in v0.8.0

func (tbl SUserTable) IsTx() bool

IsTx tests whether this is within a transaction.

func (SUserTable) Logger added in v0.8.0

func (tbl SUserTable) Logger() sqlapi.Logger

Logger gets the trace logger.

func (SUserTable) Name added in v0.8.0

func (tbl SUserTable) Name() sqlapi.TableName

Name gets the table name.

func (SUserTable) PkColumn added in v0.25.0

func (tbl SUserTable) PkColumn() string

PkColumn gets the column name used as a primary key.

func (SUserTable) Query added in v0.8.0

func (tbl SUserTable) 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 *sqlapi.Rows if you need to access its data as a map.

func (SUserTable) QueryOneNullFloat64 added in v0.9.0

func (tbl SUserTable) 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 (SUserTable) QueryOneNullInt64 added in v0.9.0

func (tbl SUserTable) 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 (SUserTable) QueryOneNullString added in v0.9.0

func (tbl SUserTable) 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 (SUserTable) Select added in v0.53.0

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 (SUserTable) SelectOne added in v0.53.0

func (tbl SUserTable) 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 (SUserTable) SelectOneWhere added in v0.53.0

func (tbl SUserTable) 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 (SUserTable) SelectWhere added in v0.53.0

func (tbl SUserTable) 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 (SUserTable) Transact added in v0.51.0

func (tbl SUserTable) Transact(txOptions *sql.TxOptions, fn func(SUserQueryer) 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 (SUserTable) Tx added in v0.8.0

func (tbl SUserTable) Tx() sqlapi.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 (SUserTable) Using added in v0.9.0

func (tbl SUserTable) Using(tx sqlapi.SqlTx) SUserQueryer

Using returns a modified SUserTabler using the transaction supplied. 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 (SUserTable) WithConstraint added in v0.12.0

func (tbl SUserTable) WithConstraint(cc ...constraint.Constraint) SUserTabler

WithConstraint returns a modified SUserTabler with added data consistency constraints.

func (SUserTable) WithContext added in v0.8.0

func (tbl SUserTable) WithContext(ctx context.Context) SUserTabler

WithContext sets the context for subsequent queries via this table. The result is a modified copy of the table; the original is unchanged.

The shared context in the *Database is not altered by this method. So it is possible to use different contexts for different (groups of) queries.

func (SUserTable) WithPrefix added in v0.8.0

func (tbl SUserTable) WithPrefix(pfx string) SUserTabler

WithPrefix sets the table name prefix for subsequent queries. The result is a modified copy of the table; the original is unchanged.

type SUserTabler added in v0.53.0

type SUserTabler interface {
	sqlapi.Table

	// Constraints returns the table's constraints.
	Constraints() constraint.Constraints

	// WithConstraint returns a modified SUserTabler with added data consistency constraints.
	WithConstraint(cc ...constraint.Constraint) SUserTabler

	// WithPrefix returns a modified SUserTabler with a given table name prefix.
	WithPrefix(pfx string) SUserTabler

	// WithContext returns a modified SUserTabler with a given context.
	WithContext(ctx context.Context) SUserTabler
}

SUserTabler lists table methods provided by SUserTable.

type UUserQueryer added in v0.60.0

type UUserQueryer interface {
	// Using returns a modified UUserTabler using the transaction supplied.
	Using(tx sqlapi.SqlTx) UUserQueryer

	// Transact runs the function provided within a transaction.
	Transact(txOptions *sql.TxOptions, fn func(UUserQueryer) error) error

	// Tx gets the wrapped transaction handle, provided this is within a transaction.
	// Panics if it is in the wrong state - use IsTx() if necessary.
	Tx() sqlapi.SqlTx

	// IsTx tests whether this is within a transaction.
	IsTx() bool

	// 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)
}

UUserQueryer lists query methods provided by UUserTable.

type UUserTable added in v0.8.0

type UUserTable struct {
	// contains filtered or unexported fields
}

UUserTable 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 CopyTableAsUUserTable added in v0.8.0

func CopyTableAsUUserTable(origin sqlapi.Table) UUserTable

CopyTableAsUUserTable 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 NewUUserTable added in v0.8.0

func NewUUserTable(name string, d sqlapi.Database) UUserTable

NewUUserTable returns a new table instance. If a blank table name is supplied, the default name "users" will be used instead. The request context is initialised with the background.

func (UUserTable) Constraints added in v0.14.0

func (tbl UUserTable) Constraints() constraint.Constraints

Constraints returns the table's constraints.

func (UUserTable) Ctx added in v0.8.0

func (tbl UUserTable) Ctx() context.Context

Ctx gets the current request context.

func (UUserTable) DB added in v0.8.0

func (tbl UUserTable) DB() sqlapi.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 (UUserTable) Database added in v0.12.0

func (tbl UUserTable) Database() sqlapi.Database

Database gets the shared database information.

func (UUserTable) Dialect added in v0.8.0

func (tbl UUserTable) Dialect() dialect.Dialect

Dialect gets the database dialect.

func (UUserTable) Exec added in v0.8.0

func (tbl UUserTable) 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 (UUserTable) Execer added in v0.12.0

func (tbl UUserTable) Execer() sqlapi.Execer

Execer gets the wrapped database or transaction handle.

func (UUserTable) IsTx added in v0.8.0

func (tbl UUserTable) IsTx() bool

IsTx tests whether this is within a transaction.

func (UUserTable) Logger added in v0.8.0

func (tbl UUserTable) Logger() sqlapi.Logger

Logger gets the trace logger.

func (UUserTable) Name added in v0.8.0

func (tbl UUserTable) Name() sqlapi.TableName

Name gets the table name.

func (UUserTable) PkColumn added in v0.25.0

func (tbl UUserTable) PkColumn() string

PkColumn gets the column name used as a primary key.

func (UUserTable) Transact added in v0.51.0

func (tbl UUserTable) Transact(txOptions *sql.TxOptions, fn func(UUserQueryer) 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 (UUserTable) Tx added in v0.8.0

func (tbl UUserTable) Tx() sqlapi.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 (UUserTable) Update added in v0.8.0

func (tbl UUserTable) 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 (UUserTable) UpdateByAddressid added in v0.61.0

func (tbl UUserTable) UpdateByAddressid(req require.Requirement, addressid int64, fields ...sql.NamedArg) (int64, error)

UpdateByAddressid updates one or more columns, given a addressid value.

func (UUserTable) UpdateByAvatar added in v0.61.0

func (tbl UUserTable) UpdateByAvatar(req require.Requirement, avatar string, fields ...sql.NamedArg) (int64, error)

UpdateByAvatar updates one or more columns, given a avatar value.

func (UUserTable) UpdateByEmailaddress added in v0.61.0

func (tbl UUserTable) UpdateByEmailaddress(req require.Requirement, emailaddress string, fields ...sql.NamedArg) (int64, error)

UpdateByEmailaddress updates one or more columns, given a emailaddress value.

func (UUserTable) UpdateByF32 added in v0.61.0

func (tbl UUserTable) UpdateByF32(req require.Requirement, f32 float32, fields ...sql.NamedArg) (int64, error)

UpdateByF32 updates one or more columns, given a f32 value.

func (UUserTable) UpdateByF64 added in v0.61.0

func (tbl UUserTable) UpdateByF64(req require.Requirement, f64 float64, fields ...sql.NamedArg) (int64, error)

UpdateByF64 updates one or more columns, given a f64 value.

func (UUserTable) UpdateByI16 added in v0.61.0

func (tbl UUserTable) UpdateByI16(req require.Requirement, i16 int16, fields ...sql.NamedArg) (int64, error)

UpdateByI16 updates one or more columns, given a i16 value.

func (UUserTable) UpdateByI32 added in v0.61.0

func (tbl UUserTable) UpdateByI32(req require.Requirement, i32 int32, fields ...sql.NamedArg) (int64, error)

UpdateByI32 updates one or more columns, given a i32 value.

func (UUserTable) UpdateByI64 added in v0.61.0

func (tbl UUserTable) UpdateByI64(req require.Requirement, i64 int64, fields ...sql.NamedArg) (int64, error)

UpdateByI64 updates one or more columns, given a i64 value.

func (UUserTable) UpdateByI8 added in v0.61.0

func (tbl UUserTable) UpdateByI8(req require.Requirement, i8 int8, fields ...sql.NamedArg) (int64, error)

UpdateByI8 updates one or more columns, given a i8 value.

func (UUserTable) UpdateByLastupdated added in v0.61.0

func (tbl UUserTable) UpdateByLastupdated(req require.Requirement, lastupdated int64, fields ...sql.NamedArg) (int64, error)

UpdateByLastupdated updates one or more columns, given a lastupdated value.

func (UUserTable) UpdateByName added in v0.61.0

func (tbl UUserTable) UpdateByName(req require.Requirement, name string, fields ...sql.NamedArg) (int64, error)

UpdateByName updates one or more columns, given a name value.

func (UUserTable) UpdateByRole added in v0.61.0

func (tbl UUserTable) UpdateByRole(req require.Requirement, role Role, fields ...sql.NamedArg) (int64, error)

UpdateByRole updates one or more columns, given a role value.

func (UUserTable) UpdateByU16 added in v0.61.0

func (tbl UUserTable) UpdateByU16(req require.Requirement, u16 uint16, fields ...sql.NamedArg) (int64, error)

UpdateByU16 updates one or more columns, given a u16 value.

func (UUserTable) UpdateByU32 added in v0.61.0

func (tbl UUserTable) UpdateByU32(req require.Requirement, u32 uint32, fields ...sql.NamedArg) (int64, error)

UpdateByU32 updates one or more columns, given a u32 value.

func (UUserTable) UpdateByU64 added in v0.61.0

func (tbl UUserTable) UpdateByU64(req require.Requirement, u64 uint64, fields ...sql.NamedArg) (int64, error)

UpdateByU64 updates one or more columns, given a u64 value.

func (UUserTable) UpdateByU8 added in v0.61.0

func (tbl UUserTable) UpdateByU8(req require.Requirement, u8 uint8, fields ...sql.NamedArg) (int64, error)

UpdateByU8 updates one or more columns, given a u8 value.

func (UUserTable) UpdateByUid added in v0.61.0

func (tbl UUserTable) UpdateByUid(req require.Requirement, uid int64, fields ...sql.NamedArg) (int64, error)

UpdateByUid updates one or more columns, given a uid value.

func (UUserTable) UpdateFields added in v0.8.0

func (tbl UUserTable) 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 (UUserTable) Using added in v0.9.0

func (tbl UUserTable) Using(tx sqlapi.SqlTx) UUserQueryer

Using returns a modified UUserTabler using the transaction supplied. 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 (UUserTable) WithConstraint added in v0.12.0

func (tbl UUserTable) WithConstraint(cc ...constraint.Constraint) UUserTabler

WithConstraint returns a modified UUserTabler with added data consistency constraints.

func (UUserTable) WithContext added in v0.8.0

func (tbl UUserTable) WithContext(ctx context.Context) UUserTabler

WithContext sets the context for subsequent queries via this table. The result is a modified copy of the table; the original is unchanged.

The shared context in the *Database is not altered by this method. So it is possible to use different contexts for different (groups of) queries.

func (UUserTable) WithPrefix added in v0.8.0

func (tbl UUserTable) WithPrefix(pfx string) UUserTabler

WithPrefix sets the table name prefix for subsequent queries. The result is a modified copy of the table; the original is unchanged.

type UUserTabler added in v0.53.0

type UUserTabler interface {
	sqlapi.Table

	// Constraints returns the table's constraints.
	Constraints() constraint.Constraints

	// WithConstraint returns a modified UUserTabler with added data consistency constraints.
	WithConstraint(cc ...constraint.Constraint) UUserTabler

	// WithPrefix returns a modified UUserTabler with a given table name prefix.
	WithPrefix(pfx string) UUserTabler

	// WithContext returns a modified UUserTabler with a given context.
	WithContext(ctx context.Context) UUserTabler
}

UUserTabler lists table methods provided by UUserTable.

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 ScanAUsers added in v0.50.0

func ScanAUsers(query string, rows sqlapi.SqlRows, firstOnly bool) (vv []*User, n int64, err error)

ScanAUsers 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 ScanDbUsers added in v0.50.0

func ScanDbUsers(query string, rows sqlapi.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) PostGet added in v0.8.0

func (u *User) PostGet() error

func (*User) PreInsert

func (u *User) PreInsert() error

These hooks are just used here for testing, but you could put whatever you like in them.

func (*User) PreUpdate

func (u *User) PreUpdate() error

func (*User) SetActive added in v0.8.0

func (v *User) SetActive(x bool) *User

SetActive sets the Active field and returns the modified User.

func (*User) SetAddressId added in v0.12.0

func (v *User) SetAddressId(x int64) *User

SetAddressId sets the AddressId field and returns the modified User.

func (*User) SetAdmin added in v0.8.0

func (v *User) SetAdmin(x bool) *User

SetAdmin sets the Admin field and returns the modified User.

func (*User) SetAvatar added in v0.8.0

func (v *User) SetAvatar(x string) *User

SetAvatar sets the Avatar field and returns the modified User.

func (*User) SetEmailAddress added in v0.8.0

func (v *User) SetEmailAddress(x string) *User

SetEmailAddress sets the EmailAddress field and returns the modified User.

func (*User) SetF32 added in v0.19.0

func (v *User) SetF32(x float32) *User

SetF32 sets the F32 field and returns the modified User.

func (*User) SetF64 added in v0.19.0

func (v *User) SetF64(x float64) *User

SetF64 sets the F64 field and returns the modified User.

func (*User) SetFave added in v0.8.0

func (v *User) SetFave(x big.Int) *User

SetFave sets the Fave field and returns the modified User.

func (*User) SetI16 added in v0.19.0

func (v *User) SetI16(x int16) *User

SetI16 sets the I16 field and returns the modified User.

func (*User) SetI32 added in v0.19.0

func (v *User) SetI32(x int32) *User

SetI32 sets the I32 field and returns the modified User.

func (*User) SetI64 added in v0.19.0

func (v *User) SetI64(x int64) *User

SetI64 sets the I64 field and returns the modified User.

func (*User) SetI8 added in v0.19.0

func (v *User) SetI8(x int8) *User

SetI8 sets the I8 field and returns the modified User.

func (*User) SetLastUpdated added in v0.8.0

func (v *User) SetLastUpdated(x int64) *User

SetLastUpdated sets the LastUpdated field and returns the modified User.

func (*User) SetName added in v0.16.0

func (v *User) SetName(x string) *User

SetName sets the Name field and returns the modified User.

func (*User) SetRole added in v0.10.0

func (v *User) SetRole(x Role) *User

SetRole sets the Role field and returns the modified User.

func (*User) SetU16 added in v0.19.0

func (v *User) SetU16(x uint16) *User

SetU16 sets the U16 field and returns the modified User.

func (*User) SetU32 added in v0.19.0

func (v *User) SetU32(x uint32) *User

SetU32 sets the U32 field and returns the modified User.

func (*User) SetU64 added in v0.19.0

func (v *User) SetU64(x uint64) *User

SetU64 sets the U64 field and returns the modified User.

func (*User) SetU8 added in v0.19.0

func (v *User) SetU8(x uint8) *User

SetU8 sets the U8 field and returns the modified User.

func (*User) SetUid added in v0.8.0

func (v *User) SetUid(x int64) *User

SetUid sets the Uid field and returns the modified User.

func (*User) Setsecret added in v0.8.0

func (v *User) Setsecret(x string) *User

Setsecret sets the secret field and returns the modified User.

func (*User) Settoken added in v0.8.0

func (v *User) Settoken(x string) *User

Settoken sets the token field and returns the modified User.

type UserAddress added in v0.53.0

type UserAddress struct {
	Uid          int64  `sql:"pk: true, auto: true"`
	Name         string `sql:"unique: user_login"`
	EmailAddress string `sql:"nk: true"`
	Address      *AddressFields
	Avatar       *string
	Role         *Role `sql:"type: text, size: 20"`
	Active       bool
	Admin        bool
	Fave         *big.Int `sql:"encode: json"`
	LastUpdated  int64
}

type UserAddressJoin added in v0.53.0

type UserAddressJoin struct {
	// contains filtered or unexported fields
}

UserAddressJoin 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 CopyTableAsUserAddressJoin added in v0.53.0

func CopyTableAsUserAddressJoin(origin sqlapi.Table) UserAddressJoin

CopyTableAsUserAddressJoin copies a table instance, retaining the name etc but providing methods appropriate for 'UserAddress'. It doesn't copy the constraints of the original table.

It serves to provide methods appropriate for 'UserAddress'. 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 NewUserAddressJoin added in v0.53.0

func NewUserAddressJoin(name string, d sqlapi.Database) UserAddressJoin

NewUserAddressJoin returns a new table instance. If a blank table name is supplied, the default name "useraddresses" will be used instead. The request context is initialised with the background.

func (UserAddressJoin) Constraints added in v0.53.0

func (tbl UserAddressJoin) Constraints() constraint.Constraints

Constraints returns the table's constraints.

func (UserAddressJoin) Ctx added in v0.53.0

func (tbl UserAddressJoin) Ctx() context.Context

Ctx gets the current request context.

func (UserAddressJoin) DB added in v0.53.0

func (tbl UserAddressJoin) DB() sqlapi.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 (UserAddressJoin) Database added in v0.53.0

func (tbl UserAddressJoin) Database() sqlapi.Database

Database gets the shared database information.

func (UserAddressJoin) Dialect added in v0.53.0

func (tbl UserAddressJoin) Dialect() dialect.Dialect

Dialect gets the database dialect.

func (UserAddressJoin) Execer added in v0.53.0

func (tbl UserAddressJoin) Execer() sqlapi.Execer

Execer gets the wrapped database or transaction handle.

func (UserAddressJoin) IsTx added in v0.53.0

func (tbl UserAddressJoin) IsTx() bool

IsTx tests whether this is within a transaction.

func (UserAddressJoin) Logger added in v0.53.0

func (tbl UserAddressJoin) Logger() sqlapi.Logger

Logger gets the trace logger.

func (UserAddressJoin) Name added in v0.53.0

func (tbl UserAddressJoin) Name() sqlapi.TableName

Name gets the table name.

func (UserAddressJoin) PkColumn added in v0.53.0

func (tbl UserAddressJoin) PkColumn() string

PkColumn gets the column name used as a primary key.

func (UserAddressJoin) Query added in v0.53.0

func (tbl UserAddressJoin) Query(req require.Requirement, query string, args ...interface{}) ([]*UserAddress, error)

Query is the low-level request method for this table. The SQL query must return all the columns necessary for UserAddress 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 *sqlapi.Rows if you need to access its data as a map.

func (UserAddressJoin) QueryOneNullFloat64 added in v0.53.0

func (tbl UserAddressJoin) 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 (UserAddressJoin) QueryOneNullInt64 added in v0.53.0

func (tbl UserAddressJoin) 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 (UserAddressJoin) QueryOneNullString added in v0.53.0

func (tbl UserAddressJoin) 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 (UserAddressJoin) Transact added in v0.53.0

func (tbl UserAddressJoin) Transact(txOptions *sql.TxOptions, fn func(UserAddressQueryer) 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 (UserAddressJoin) Tx added in v0.53.0

func (tbl UserAddressJoin) Tx() sqlapi.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 (UserAddressJoin) Using added in v0.53.0

Using returns a modified UserAddressJoiner using the transaction supplied. 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 (UserAddressJoin) WithConstraint added in v0.53.0

func (tbl UserAddressJoin) WithConstraint(cc ...constraint.Constraint) UserAddressJoiner

WithConstraint returns a modified UserAddressJoiner with added data consistency constraints.

func (UserAddressJoin) WithContext added in v0.53.0

func (tbl UserAddressJoin) WithContext(ctx context.Context) UserAddressJoiner

WithContext sets the context for subsequent queries via this table. The result is a modified copy of the table; the original is unchanged.

The shared context in the *Database is not altered by this method. So it is possible to use different contexts for different (groups of) queries.

func (UserAddressJoin) WithPrefix added in v0.53.0

func (tbl UserAddressJoin) WithPrefix(pfx string) UserAddressJoiner

WithPrefix sets the table name prefix for subsequent queries. The result is a modified copy of the table; the original is unchanged.

type UserAddressJoiner added in v0.53.0

type UserAddressJoiner interface {
	sqlapi.Table

	// Constraints returns the table's constraints.
	Constraints() constraint.Constraints

	// WithConstraint returns a modified UserAddressJoiner with added data consistency constraints.
	WithConstraint(cc ...constraint.Constraint) UserAddressJoiner

	// WithPrefix returns a modified UserAddressJoiner with a given table name prefix.
	WithPrefix(pfx string) UserAddressJoiner

	// WithContext returns a modified UserAddressJoiner with a given context.
	WithContext(ctx context.Context) UserAddressJoiner
}

UserAddressJoiner lists table methods provided by UserAddressJoin.

type UserAddressQueryer added in v0.60.0

type UserAddressQueryer interface {
	// Using returns a modified UserAddressJoiner using the transaction supplied.
	Using(tx sqlapi.SqlTx) UserAddressQueryer

	// Transact runs the function provided within a transaction.
	Transact(txOptions *sql.TxOptions, fn func(UserAddressQueryer) error) error

	// Tx gets the wrapped transaction handle, provided this is within a transaction.
	// Panics if it is in the wrong state - use IsTx() if necessary.
	Tx() sqlapi.SqlTx

	// IsTx tests whether this is within a transaction.
	IsTx() bool

	// Query is the low-level request method for this table using an SQL query that must return all the columns
	// necessary for UserAddress values.
	Query(req require.Requirement, query string, args ...interface{}) ([]*UserAddress, 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)
}

UserAddressQueryer lists query methods provided by UserAddressJoin.

type XUserQueryer added in v0.60.0

type XUserQueryer interface {
	// Using returns a modified XUserTabler using the transaction supplied.
	Using(tx sqlapi.SqlTx) XUserQueryer

	// Transact runs the function provided within a transaction.
	Transact(txOptions *sql.TxOptions, fn func(XUserQueryer) error) error

	// Tx gets the wrapped transaction handle, provided this is within a transaction.
	// Panics if it is in the wrong state - use IsTx() if necessary.
	Tx() sqlapi.SqlTx

	// IsTx tests whether this is within a transaction.
	IsTx() bool
}

XUserQueryer lists query methods provided by XUserTable.

type XUserTable added in v0.8.0

type XUserTable struct {
	// contains filtered or unexported fields
}

XUserTable 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 CopyTableAsXUserTable added in v0.8.0

func CopyTableAsXUserTable(origin sqlapi.Table) XUserTable

CopyTableAsXUserTable 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 NewXUserTable added in v0.8.0

func NewXUserTable(name string, d sqlapi.Database) XUserTable

NewXUserTable returns a new table instance. If a blank table name is supplied, the default name "users" will be used instead. The request context is initialised with the background.

func (XUserTable) Constraints added in v0.14.0

func (tbl XUserTable) Constraints() constraint.Constraints

Constraints returns the table's constraints.

func (XUserTable) Ctx added in v0.8.0

func (tbl XUserTable) Ctx() context.Context

Ctx gets the current request context.

func (XUserTable) DB added in v0.8.0

func (tbl XUserTable) DB() sqlapi.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 (XUserTable) Database added in v0.12.0

func (tbl XUserTable) Database() sqlapi.Database

Database gets the shared database information.

func (XUserTable) Dialect added in v0.8.0

func (tbl XUserTable) Dialect() dialect.Dialect

Dialect gets the database dialect.

func (XUserTable) Execer added in v0.12.0

func (tbl XUserTable) Execer() sqlapi.Execer

Execer gets the wrapped database or transaction handle.

func (XUserTable) IsTx added in v0.8.0

func (tbl XUserTable) IsTx() bool

IsTx tests whether this is within a transaction.

func (XUserTable) Logger added in v0.8.0

func (tbl XUserTable) Logger() sqlapi.Logger

Logger gets the trace logger.

func (XUserTable) Name added in v0.8.0

func (tbl XUserTable) Name() sqlapi.TableName

Name gets the table name.

func (XUserTable) PkColumn added in v0.25.0

func (tbl XUserTable) PkColumn() string

PkColumn gets the column name used as a primary key.

func (XUserTable) Transact added in v0.51.0

func (tbl XUserTable) Transact(txOptions *sql.TxOptions, fn func(XUserQueryer) 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 (XUserTable) Tx added in v0.8.0

func (tbl XUserTable) Tx() sqlapi.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 (XUserTable) Using added in v0.9.0

func (tbl XUserTable) Using(tx sqlapi.SqlTx) XUserQueryer

Using returns a modified XUserTabler using the transaction supplied. 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 (XUserTable) WithConstraint added in v0.12.0

func (tbl XUserTable) WithConstraint(cc ...constraint.Constraint) XUserTabler

WithConstraint returns a modified XUserTabler with added data consistency constraints.

func (XUserTable) WithContext added in v0.8.0

func (tbl XUserTable) WithContext(ctx context.Context) XUserTabler

WithContext sets the context for subsequent queries via this table. The result is a modified copy of the table; the original is unchanged.

The shared context in the *Database is not altered by this method. So it is possible to use different contexts for different (groups of) queries.

func (XUserTable) WithPrefix added in v0.8.0

func (tbl XUserTable) WithPrefix(pfx string) XUserTabler

WithPrefix sets the table name prefix for subsequent queries. The result is a modified copy of the table; the original is unchanged.

type XUserTabler added in v0.53.0

type XUserTabler interface {
	sqlapi.Table

	// Constraints returns the table's constraints.
	Constraints() constraint.Constraints

	// WithConstraint returns a modified XUserTabler with added data consistency constraints.
	WithConstraint(cc ...constraint.Constraint) XUserTabler

	// WithPrefix returns a modified XUserTabler with a given table name prefix.
	WithPrefix(pfx string) XUserTabler

	// WithContext returns a modified XUserTabler with a given context.
	WithContext(ctx context.Context) XUserTabler
}

XUserTabler lists table methods provided by XUserTable.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL