Documentation
¶
Index ¶
- Constants
- type AUserTable
- func (tbl AUserTable) BeginTx(opts *sql.TxOptions) (AUserTable, error)
- func (tbl AUserTable) Constraints() constraint.Constraints
- func (tbl AUserTable) Count(wh where.Expression) (count int64, err error)
- func (tbl AUserTable) CountWhere(where string, args ...interface{}) (count int64, err error)
- func (tbl AUserTable) CreateEmailaddressIdxIndex(ifNotExist bool) error
- func (tbl AUserTable) CreateIndexes(ifNotExist bool) (err error)
- func (tbl AUserTable) CreateTable(ifNotExists bool) (int64, error)
- func (tbl AUserTable) CreateTableWithIndexes(ifNotExist bool) (err error)
- func (tbl AUserTable) CreateUserLoginIndex(ifNotExist bool) error
- func (tbl AUserTable) DB() *sql.DB
- func (tbl AUserTable) Database() *sqlgen2.Database
- func (tbl AUserTable) Delete(req require.Requirement, wh where.Expression) (int64, error)
- func (tbl AUserTable) DeleteUsers(req require.Requirement, id ...int64) (int64, error)
- func (tbl AUserTable) Dialect() schema.Dialect
- func (tbl AUserTable) DropEmailaddressIdxIndex(ifExists bool) error
- func (tbl AUserTable) DropIndexes(ifExist bool) (err error)
- func (tbl AUserTable) DropTable(ifExists bool) (int64, error)
- func (tbl AUserTable) DropUserLoginIndex(ifExists bool) error
- func (tbl AUserTable) Exec(req require.Requirement, query string, args ...interface{}) (int64, error)
- func (tbl AUserTable) Execer() sqlgen2.Execer
- func (tbl AUserTable) Fetch(req require.Requirement, query string, args ...interface{}) ([]*User, error)
- func (tbl AUserTable) GetUserByEmailAddress(req require.Requirement, value string) (*User, error)
- func (tbl AUserTable) GetUserByName(req require.Requirement, value string) (*User, error)
- func (tbl AUserTable) GetUserByUid(req require.Requirement, id int64) (*User, error)
- func (tbl AUserTable) GetUsersByUid(req require.Requirement, id ...int64) (list []*User, err error)
- func (tbl AUserTable) Insert(req require.Requirement, vv ...*User) error
- func (tbl AUserTable) IsTx() bool
- func (tbl AUserTable) Logger() *log.Logger
- func (tbl AUserTable) Name() sqlgen2.TableName
- func (tbl AUserTable) Query(query string, args ...interface{}) (*sql.Rows, error)
- func (tbl AUserTable) QueryOneNullFloat64(req require.Requirement, query string, args ...interface{}) (result sql.NullFloat64, err error)
- func (tbl AUserTable) QueryOneNullInt64(req require.Requirement, query string, args ...interface{}) (result sql.NullInt64, err error)
- func (tbl AUserTable) QueryOneNullString(req require.Requirement, query string, args ...interface{}) (result sql.NullString, err error)
- func (tbl AUserTable) ReplaceTableName(query string) string
- func (tbl AUserTable) Select(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]*User, error)
- func (tbl AUserTable) SelectOne(req require.Requirement, wh where.Expression, qc where.QueryConstraint) (*User, error)
- func (tbl AUserTable) SelectOneWhere(req require.Requirement, where, orderBy string, args ...interface{}) (*User, error)
- func (tbl AUserTable) SelectWhere(req require.Requirement, where, orderBy string, args ...interface{}) ([]*User, error)
- func (tbl AUserTable) SliceActive(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]bool, error)
- func (tbl AUserTable) SliceAddressid(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int64, error)
- func (tbl AUserTable) SliceAdmin(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]bool, error)
- func (tbl AUserTable) SliceAvatar(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
- func (tbl AUserTable) SliceEmailaddress(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
- func (tbl AUserTable) SliceF32(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]float32, error)
- func (tbl AUserTable) SliceF64(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]float64, error)
- func (tbl AUserTable) SliceI16(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int16, error)
- func (tbl AUserTable) SliceI32(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int32, error)
- func (tbl AUserTable) SliceI64(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int64, error)
- func (tbl AUserTable) SliceI8(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int8, error)
- func (tbl AUserTable) SliceLastupdated(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int64, error)
- func (tbl AUserTable) SliceName(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
- func (tbl AUserTable) SliceRole(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]Role, error)
- func (tbl AUserTable) SliceU16(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]uint16, error)
- func (tbl AUserTable) SliceU32(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]uint32, error)
- func (tbl AUserTable) SliceU64(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]uint64, error)
- func (tbl AUserTable) SliceU8(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]uint8, error)
- func (tbl AUserTable) SliceUid(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int64, error)
- func (tbl AUserTable) Truncate(force bool) (err error)
- func (tbl AUserTable) Tx() *sql.Tx
- func (tbl AUserTable) Update(req require.Requirement, vv ...*User) (int64, error)
- func (tbl AUserTable) UpdateFields(req require.Requirement, wh where.Expression, fields ...sql.NamedArg) (int64, error)
- func (tbl AUserTable) Using(tx *sql.Tx) AUserTable
- func (tbl AUserTable) WithConstraint(cc ...constraint.Constraint) AUserTable
- func (tbl AUserTable) WithContext(ctx context.Context) AUserTable
- func (tbl AUserTable) WithPrefix(pfx string) AUserTable
- type Address
- type AddressTable
- func (tbl AddressTable) BeginTx(opts *sql.TxOptions) (AddressTable, error)
- func (tbl AddressTable) Constraints() constraint.Constraints
- func (tbl AddressTable) Count(wh where.Expression) (count int64, err error)
- func (tbl AddressTable) CountWhere(where string, args ...interface{}) (count int64, err error)
- func (tbl AddressTable) CreateIndexes(ifNotExist bool) (err error)
- func (tbl AddressTable) CreatePostcodeIdxIndex(ifNotExist bool) error
- func (tbl AddressTable) CreateTable(ifNotExists bool) (int64, error)
- func (tbl AddressTable) CreateTableWithIndexes(ifNotExist bool) (err error)
- func (tbl AddressTable) CreateTownIdxIndex(ifNotExist bool) error
- func (tbl AddressTable) DB() *sql.DB
- func (tbl AddressTable) Database() *sqlgen2.Database
- func (tbl AddressTable) Delete(req require.Requirement, wh where.Expression) (int64, error)
- func (tbl AddressTable) DeleteAddresses(req require.Requirement, id ...int64) (int64, error)
- func (tbl AddressTable) Dialect() schema.Dialect
- func (tbl AddressTable) DropIndexes(ifExist bool) (err error)
- func (tbl AddressTable) DropPostcodeIdxIndex(ifExists bool) error
- func (tbl AddressTable) DropTable(ifExists bool) (int64, error)
- func (tbl AddressTable) DropTownIdxIndex(ifExists bool) error
- func (tbl AddressTable) Exec(req require.Requirement, query string, args ...interface{}) (int64, error)
- func (tbl AddressTable) Execer() sqlgen2.Execer
- func (tbl AddressTable) Fetch(req require.Requirement, query string, args ...interface{}) ([]*Address, error)
- func (tbl AddressTable) GetAddressById(req require.Requirement, id int64) (*Address, error)
- func (tbl AddressTable) GetAddressesById(req require.Requirement, id ...int64) (list []*Address, err error)
- func (tbl AddressTable) GetAddressesByPostcode(req require.Requirement, value string) ([]*Address, error)
- func (tbl AddressTable) GetAddressesByTown(req require.Requirement, value string) ([]*Address, error)
- func (tbl AddressTable) Insert(req require.Requirement, vv ...*Address) error
- func (tbl AddressTable) IsTx() bool
- func (tbl AddressTable) Logger() *log.Logger
- func (tbl AddressTable) Name() sqlgen2.TableName
- func (tbl AddressTable) Query(query string, args ...interface{}) (*sql.Rows, error)
- func (tbl AddressTable) QueryOneNullFloat64(req require.Requirement, query string, args ...interface{}) (result sql.NullFloat64, err error)
- func (tbl AddressTable) QueryOneNullInt64(req require.Requirement, query string, args ...interface{}) (result sql.NullInt64, err error)
- func (tbl AddressTable) QueryOneNullString(req require.Requirement, query string, args ...interface{}) (result sql.NullString, err error)
- func (tbl AddressTable) ReplaceTableName(query string) string
- func (tbl AddressTable) Select(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]*Address, error)
- func (tbl AddressTable) SelectOne(req require.Requirement, wh where.Expression, qc where.QueryConstraint) (*Address, error)
- func (tbl AddressTable) SelectOneWhere(req require.Requirement, where, orderBy string, args ...interface{}) (*Address, error)
- func (tbl AddressTable) SelectWhere(req require.Requirement, where, orderBy string, args ...interface{}) ([]*Address, error)
- func (tbl AddressTable) SliceId(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int64, error)
- func (tbl AddressTable) SlicePostcode(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
- func (tbl AddressTable) SliceTown(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
- func (tbl AddressTable) Truncate(force bool) (err error)
- func (tbl AddressTable) Tx() *sql.Tx
- func (tbl AddressTable) Update(req require.Requirement, vv ...*Address) (int64, error)
- func (tbl AddressTable) UpdateFields(req require.Requirement, wh where.Expression, fields ...sql.NamedArg) (int64, error)
- func (tbl AddressTable) Using(tx *sql.Tx) AddressTable
- func (tbl AddressTable) WithConstraint(cc ...constraint.Constraint) AddressTable
- func (tbl AddressTable) WithContext(ctx context.Context) AddressTable
- func (tbl AddressTable) WithPrefix(pfx string) AddressTable
- type Association
- type AssociationTable
- func (tbl AssociationTable) BeginTx(opts *sql.TxOptions) (AssociationTable, error)
- func (tbl AssociationTable) Constraints() constraint.Constraints
- func (tbl AssociationTable) Count(wh where.Expression) (count int64, err error)
- func (tbl AssociationTable) CountWhere(where string, args ...interface{}) (count int64, err error)
- func (tbl AssociationTable) CreateTable(ifNotExists bool) (int64, error)
- func (tbl AssociationTable) DB() *sql.DB
- func (tbl AssociationTable) Database() *sqlgen2.Database
- func (tbl AssociationTable) Delete(req require.Requirement, wh where.Expression) (int64, error)
- func (tbl AssociationTable) DeleteAssociations(req require.Requirement, id ...int64) (int64, error)
- func (tbl AssociationTable) Dialect() schema.Dialect
- func (tbl AssociationTable) DropTable(ifExists bool) (int64, error)
- func (tbl AssociationTable) Exec(req require.Requirement, query string, args ...interface{}) (int64, error)
- func (tbl AssociationTable) Execer() sqlgen2.Execer
- func (tbl AssociationTable) Fetch(req require.Requirement, query string, args ...interface{}) ([]*Association, error)
- func (tbl AssociationTable) GetAssociationById(req require.Requirement, id int64) (*Association, error)
- func (tbl AssociationTable) GetAssociationsById(req require.Requirement, id ...int64) (list []*Association, err error)
- func (tbl AssociationTable) Insert(req require.Requirement, vv ...*Association) error
- func (tbl AssociationTable) IsTx() bool
- func (tbl AssociationTable) Logger() *log.Logger
- func (tbl AssociationTable) Name() sqlgen2.TableName
- func (tbl AssociationTable) Query(query string, args ...interface{}) (*sql.Rows, error)
- func (tbl AssociationTable) QueryOneNullFloat64(req require.Requirement, query string, args ...interface{}) (result sql.NullFloat64, err error)
- func (tbl AssociationTable) QueryOneNullInt64(req require.Requirement, query string, args ...interface{}) (result sql.NullInt64, err error)
- func (tbl AssociationTable) QueryOneNullString(req require.Requirement, query string, args ...interface{}) (result sql.NullString, err error)
- func (tbl AssociationTable) ReplaceTableName(query string) string
- func (tbl AssociationTable) Select(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]*Association, error)
- func (tbl AssociationTable) SelectOne(req require.Requirement, wh where.Expression, qc where.QueryConstraint) (*Association, error)
- func (tbl AssociationTable) SelectOneWhere(req require.Requirement, where, orderBy string, args ...interface{}) (*Association, error)
- func (tbl AssociationTable) SelectWhere(req require.Requirement, where, orderBy string, args ...interface{}) ([]*Association, error)
- func (tbl AssociationTable) SliceCategory(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]Category, error)
- func (tbl AssociationTable) SliceId(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int64, error)
- func (tbl AssociationTable) SliceName(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
- func (tbl AssociationTable) SliceQuality(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
- func (tbl AssociationTable) SliceRef1(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int64, error)
- func (tbl AssociationTable) SliceRef2(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int64, error)
- func (tbl AssociationTable) Truncate(force bool) (err error)
- func (tbl AssociationTable) Tx() *sql.Tx
- func (tbl AssociationTable) Update(req require.Requirement, vv ...*Association) (int64, error)
- func (tbl AssociationTable) UpdateFields(req require.Requirement, wh where.Expression, fields ...sql.NamedArg) (int64, error)
- func (tbl AssociationTable) Using(tx *sql.Tx) AssociationTable
- func (tbl AssociationTable) WithConstraint(cc ...constraint.Constraint) AssociationTable
- func (tbl AssociationTable) WithContext(ctx context.Context) AssociationTable
- func (tbl AssociationTable) WithPrefix(pfx string) AssociationTable
- type Author
- type CUserTable
- func (tbl CUserTable) BeginTx(opts *sql.TxOptions) (CUserTable, error)
- func (tbl CUserTable) Constraints() constraint.Constraints
- func (tbl CUserTable) DB() *sql.DB
- func (tbl CUserTable) Database() *sqlgen2.Database
- func (tbl CUserTable) Dialect() schema.Dialect
- func (tbl CUserTable) Execer() sqlgen2.Execer
- func (tbl CUserTable) Insert(req require.Requirement, vv ...*User) error
- func (tbl CUserTable) IsTx() bool
- func (tbl CUserTable) Logger() *log.Logger
- func (tbl CUserTable) Name() sqlgen2.TableName
- func (tbl CUserTable) Query(query string, args ...interface{}) (*sql.Rows, error)
- func (tbl CUserTable) QueryOneNullFloat64(req require.Requirement, query string, args ...interface{}) (result sql.NullFloat64, err error)
- func (tbl CUserTable) QueryOneNullInt64(req require.Requirement, query string, args ...interface{}) (result sql.NullInt64, err error)
- func (tbl CUserTable) QueryOneNullString(req require.Requirement, query string, args ...interface{}) (result sql.NullString, err error)
- func (tbl CUserTable) ReplaceTableName(query string) string
- func (tbl CUserTable) Tx() *sql.Tx
- func (tbl CUserTable) Using(tx *sql.Tx) CUserTable
- func (tbl CUserTable) WithConstraint(cc ...constraint.Constraint) CUserTable
- func (tbl CUserTable) WithContext(ctx context.Context) CUserTable
- func (tbl CUserTable) WithPrefix(pfx string) CUserTable
- type Category
- type Commit
- type Compound
- type DUserTable
- func (tbl DUserTable) BeginTx(opts *sql.TxOptions) (DUserTable, error)
- func (tbl DUserTable) Constraints() constraint.Constraints
- func (tbl DUserTable) DB() *sql.DB
- func (tbl DUserTable) Database() *sqlgen2.Database
- func (tbl DUserTable) Delete(req require.Requirement, wh where.Expression) (int64, error)
- func (tbl DUserTable) DeleteUsers(req require.Requirement, id ...int64) (int64, error)
- func (tbl DUserTable) Dialect() schema.Dialect
- func (tbl DUserTable) Exec(req require.Requirement, query string, args ...interface{}) (int64, error)
- func (tbl DUserTable) Execer() sqlgen2.Execer
- func (tbl DUserTable) IsTx() bool
- func (tbl DUserTable) Logger() *log.Logger
- func (tbl DUserTable) Name() sqlgen2.TableName
- func (tbl DUserTable) Query(query string, args ...interface{}) (*sql.Rows, error)
- func (tbl DUserTable) QueryOneNullFloat64(req require.Requirement, query string, args ...interface{}) (result sql.NullFloat64, err error)
- func (tbl DUserTable) QueryOneNullInt64(req require.Requirement, query string, args ...interface{}) (result sql.NullInt64, err error)
- func (tbl DUserTable) QueryOneNullString(req require.Requirement, query string, args ...interface{}) (result sql.NullString, err error)
- func (tbl DUserTable) ReplaceTableName(query string) string
- func (tbl DUserTable) Tx() *sql.Tx
- func (tbl DUserTable) Using(tx *sql.Tx) DUserTable
- func (tbl DUserTable) WithConstraint(cc ...constraint.Constraint) DUserTable
- func (tbl DUserTable) WithContext(ctx context.Context) DUserTable
- func (tbl DUserTable) WithPrefix(pfx string) DUserTable
- type Date
- type Dates
- type DbCompoundTable
- func (tbl DbCompoundTable) BeginTx(opts *sql.TxOptions) (DbCompoundTable, error)
- func (tbl DbCompoundTable) Constraints() constraint.Constraints
- func (tbl DbCompoundTable) Count(wh where.Expression) (count int64, err error)
- func (tbl DbCompoundTable) CountWhere(where string, args ...interface{}) (count int64, err error)
- func (tbl DbCompoundTable) CreateAlphaBetaIndex(ifNotExist bool) error
- func (tbl DbCompoundTable) CreateIndexes(ifNotExist bool) (err error)
- func (tbl DbCompoundTable) CreateTable(ifNotExists bool) (int64, error)
- func (tbl DbCompoundTable) CreateTableWithIndexes(ifNotExist bool) (err error)
- func (tbl DbCompoundTable) DB() *sql.DB
- func (tbl DbCompoundTable) Database() *sqlgen2.Database
- func (tbl DbCompoundTable) Delete(req require.Requirement, wh where.Expression) (int64, error)
- func (tbl DbCompoundTable) Dialect() schema.Dialect
- func (tbl DbCompoundTable) DropAlphaBetaIndex(ifExists bool) error
- func (tbl DbCompoundTable) DropIndexes(ifExist bool) (err error)
- func (tbl DbCompoundTable) DropTable(ifExists bool) (int64, error)
- func (tbl DbCompoundTable) Exec(req require.Requirement, query string, args ...interface{}) (int64, error)
- func (tbl DbCompoundTable) Execer() sqlgen2.Execer
- func (tbl DbCompoundTable) Fetch(req require.Requirement, query string, args ...interface{}) ([]*Compound, error)
- func (tbl DbCompoundTable) Insert(req require.Requirement, vv ...*Compound) error
- func (tbl DbCompoundTable) IsTx() bool
- func (tbl DbCompoundTable) Logger() *log.Logger
- func (tbl DbCompoundTable) Name() sqlgen2.TableName
- func (tbl DbCompoundTable) Query(query string, args ...interface{}) (*sql.Rows, error)
- func (tbl DbCompoundTable) QueryOneNullFloat64(req require.Requirement, query string, args ...interface{}) (result sql.NullFloat64, err error)
- func (tbl DbCompoundTable) QueryOneNullInt64(req require.Requirement, query string, args ...interface{}) (result sql.NullInt64, err error)
- func (tbl DbCompoundTable) QueryOneNullString(req require.Requirement, query string, args ...interface{}) (result sql.NullString, err error)
- func (tbl DbCompoundTable) ReplaceTableName(query string) string
- func (tbl DbCompoundTable) Select(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]*Compound, error)
- func (tbl DbCompoundTable) SelectOne(req require.Requirement, wh where.Expression, qc where.QueryConstraint) (*Compound, error)
- func (tbl DbCompoundTable) SelectOneWhere(req require.Requirement, where, orderBy string, args ...interface{}) (*Compound, error)
- func (tbl DbCompoundTable) SelectWhere(req require.Requirement, where, orderBy string, args ...interface{}) ([]*Compound, error)
- func (tbl DbCompoundTable) SliceAlpha(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
- func (tbl DbCompoundTable) SliceBeta(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
- func (tbl DbCompoundTable) SliceCategory(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]Category, error)
- func (tbl DbCompoundTable) Truncate(force bool) (err error)
- func (tbl DbCompoundTable) Tx() *sql.Tx
- func (tbl DbCompoundTable) UpdateFields(req require.Requirement, wh where.Expression, fields ...sql.NamedArg) (int64, error)
- func (tbl DbCompoundTable) Using(tx *sql.Tx) DbCompoundTable
- func (tbl DbCompoundTable) WithConstraint(cc ...constraint.Constraint) DbCompoundTable
- func (tbl DbCompoundTable) WithContext(ctx context.Context) DbCompoundTable
- func (tbl DbCompoundTable) WithPrefix(pfx string) DbCompoundTable
- type DbUserTable
- func (tbl DbUserTable) BeginTx(opts *sql.TxOptions) (DbUserTable, error)
- func (tbl DbUserTable) Constraints() constraint.Constraints
- func (tbl DbUserTable) Count(wh where.Expression) (count int64, err error)
- func (tbl DbUserTable) CountWhere(where string, args ...interface{}) (count int64, err error)
- func (tbl DbUserTable) CreateEmailaddressIdxIndex(ifNotExist bool) error
- func (tbl DbUserTable) CreateIndexes(ifNotExist bool) (err error)
- func (tbl DbUserTable) CreateTable(ifNotExists bool) (int64, error)
- func (tbl DbUserTable) CreateTableWithIndexes(ifNotExist bool) (err error)
- func (tbl DbUserTable) CreateUserLoginIndex(ifNotExist bool) error
- func (tbl DbUserTable) DB() *sql.DB
- func (tbl DbUserTable) Database() *sqlgen2.Database
- func (tbl DbUserTable) Delete(req require.Requirement, wh where.Expression) (int64, error)
- func (tbl DbUserTable) DeleteUsers(req require.Requirement, id ...int64) (int64, error)
- func (tbl DbUserTable) Dialect() schema.Dialect
- func (tbl DbUserTable) DropEmailaddressIdxIndex(ifExists bool) error
- func (tbl DbUserTable) DropIndexes(ifExist bool) (err error)
- func (tbl DbUserTable) DropTable(ifExists bool) (int64, error)
- func (tbl DbUserTable) DropUserLoginIndex(ifExists bool) error
- func (tbl DbUserTable) Exec(req require.Requirement, query string, args ...interface{}) (int64, error)
- func (tbl DbUserTable) Execer() sqlgen2.Execer
- func (tbl DbUserTable) Fetch(req require.Requirement, query string, args ...interface{}) ([]*User, error)
- func (tbl DbUserTable) GetUserByEmailAddress(req require.Requirement, value string) (*User, error)
- func (tbl DbUserTable) GetUserByName(req require.Requirement, value string) (*User, error)
- func (tbl DbUserTable) GetUserByUid(req require.Requirement, id int64) (*User, error)
- func (tbl DbUserTable) GetUsersByUid(req require.Requirement, id ...int64) (list []*User, err error)
- func (tbl DbUserTable) Insert(req require.Requirement, vv ...*User) error
- func (tbl DbUserTable) IsTx() bool
- func (tbl DbUserTable) Logger() *log.Logger
- func (tbl DbUserTable) Name() sqlgen2.TableName
- func (tbl DbUserTable) Query(query string, args ...interface{}) (*sql.Rows, error)
- func (tbl DbUserTable) QueryOneNullFloat64(req require.Requirement, query string, args ...interface{}) (result sql.NullFloat64, err error)
- func (tbl DbUserTable) QueryOneNullInt64(req require.Requirement, query string, args ...interface{}) (result sql.NullInt64, err error)
- func (tbl DbUserTable) QueryOneNullString(req require.Requirement, query string, args ...interface{}) (result sql.NullString, err error)
- func (tbl DbUserTable) ReplaceTableName(query string) string
- func (tbl DbUserTable) Select(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]*User, error)
- func (tbl DbUserTable) SelectOne(req require.Requirement, wh where.Expression, qc where.QueryConstraint) (*User, error)
- func (tbl DbUserTable) SelectOneWhere(req require.Requirement, where, orderBy string, args ...interface{}) (*User, error)
- func (tbl DbUserTable) SelectWhere(req require.Requirement, where, orderBy string, args ...interface{}) ([]*User, error)
- func (tbl DbUserTable) SliceActive(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]bool, error)
- func (tbl DbUserTable) SliceAddressid(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int64, error)
- func (tbl DbUserTable) SliceAdmin(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]bool, error)
- func (tbl DbUserTable) SliceAvatar(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
- func (tbl DbUserTable) SliceEmailaddress(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
- func (tbl DbUserTable) SliceF32(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]float32, error)
- func (tbl DbUserTable) SliceF64(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]float64, error)
- func (tbl DbUserTable) SliceI16(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int16, error)
- func (tbl DbUserTable) SliceI32(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int32, error)
- func (tbl DbUserTable) SliceI64(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int64, error)
- func (tbl DbUserTable) SliceI8(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int8, error)
- func (tbl DbUserTable) SliceLastupdated(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int64, error)
- func (tbl DbUserTable) SliceName(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
- func (tbl DbUserTable) SliceRole(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]Role, error)
- func (tbl DbUserTable) SliceU16(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]uint16, error)
- func (tbl DbUserTable) SliceU32(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]uint32, error)
- func (tbl DbUserTable) SliceU64(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]uint64, error)
- func (tbl DbUserTable) SliceU8(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]uint8, error)
- func (tbl DbUserTable) SliceUid(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int64, error)
- func (tbl DbUserTable) Truncate(force bool) (err error)
- func (tbl DbUserTable) Tx() *sql.Tx
- func (tbl DbUserTable) Update(req require.Requirement, vv ...*User) (int64, error)
- func (tbl DbUserTable) UpdateFields(req require.Requirement, wh where.Expression, fields ...sql.NamedArg) (int64, error)
- func (tbl DbUserTable) Using(tx *sql.Tx) DbUserTable
- func (tbl DbUserTable) WithConstraint(cc ...constraint.Constraint) DbUserTable
- func (tbl DbUserTable) WithContext(ctx context.Context) DbUserTable
- func (tbl DbUserTable) WithPrefix(pfx string) DbUserTable
- type Email
- type Hook
- type HookList
- type HookTable
- func (tbl HookTable) BeginTx(opts *sql.TxOptions) (HookTable, error)
- func (tbl HookTable) Constraints() constraint.Constraints
- func (tbl HookTable) Count(wh where.Expression) (count int64, err error)
- func (tbl HookTable) CountWhere(where string, args ...interface{}) (count int64, err error)
- func (tbl HookTable) CreateTable(ifNotExists bool) (int64, error)
- func (tbl HookTable) DB() *sql.DB
- func (tbl HookTable) Database() *sqlgen2.Database
- func (tbl HookTable) Delete(req require.Requirement, wh where.Expression) (int64, error)
- func (tbl HookTable) DeleteHooks(req require.Requirement, id ...uint64) (int64, error)
- func (tbl HookTable) Dialect() schema.Dialect
- func (tbl HookTable) DropTable(ifExists bool) (int64, error)
- func (tbl HookTable) Exec(req require.Requirement, query string, args ...interface{}) (int64, error)
- func (tbl HookTable) Execer() sqlgen2.Execer
- func (tbl HookTable) Fetch(req require.Requirement, query string, args ...interface{}) (HookList, error)
- func (tbl HookTable) GetHookById(req require.Requirement, id uint64) (*Hook, error)
- func (tbl HookTable) GetHooksById(req require.Requirement, id ...uint64) (list HookList, err error)
- func (tbl HookTable) Insert(req require.Requirement, vv ...*Hook) error
- func (tbl HookTable) IsTx() bool
- func (tbl HookTable) Logger() *log.Logger
- func (tbl HookTable) Name() sqlgen2.TableName
- func (tbl HookTable) Query(query string, args ...interface{}) (*sql.Rows, error)
- func (tbl HookTable) QueryOneNullFloat64(req require.Requirement, query string, args ...interface{}) (result sql.NullFloat64, err error)
- func (tbl HookTable) QueryOneNullInt64(req require.Requirement, query string, args ...interface{}) (result sql.NullInt64, err error)
- func (tbl HookTable) QueryOneNullString(req require.Requirement, query string, args ...interface{}) (result sql.NullString, err error)
- func (tbl HookTable) ReplaceTableName(query string) string
- func (tbl HookTable) Select(req require.Requirement, wh where.Expression, qc where.QueryConstraint) (HookList, error)
- func (tbl HookTable) SelectOne(req require.Requirement, wh where.Expression, qc where.QueryConstraint) (*Hook, error)
- func (tbl HookTable) SelectOneWhere(req require.Requirement, where, orderBy string, args ...interface{}) (*Hook, error)
- func (tbl HookTable) SelectWhere(req require.Requirement, where, orderBy string, args ...interface{}) (HookList, error)
- func (tbl HookTable) SliceAfter(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
- func (tbl HookTable) SliceBefore(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
- func (tbl HookTable) SliceCategory(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]Category, error)
- func (tbl HookTable) SliceCommitId(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
- func (tbl HookTable) SliceCreated(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]bool, error)
- func (tbl HookTable) SliceDeleted(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]bool, error)
- func (tbl HookTable) SliceForced(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]bool, error)
- func (tbl HookTable) SliceHeadCommitAuthorEmail(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]Email, error)
- func (tbl HookTable) SliceHeadCommitAuthorName(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
- func (tbl HookTable) SliceHeadCommitAuthorUsername(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
- func (tbl HookTable) SliceHeadCommitCommitterEmail(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]Email, error)
- func (tbl HookTable) SliceHeadCommitCommitterName(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
- func (tbl HookTable) SliceHeadCommitCommitterUsername(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
- func (tbl HookTable) SliceId(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]uint64, error)
- func (tbl HookTable) SliceMessage(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
- func (tbl HookTable) SliceSha(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
- func (tbl HookTable) SliceTimestamp(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
- func (tbl HookTable) Truncate(force bool) (err error)
- func (tbl HookTable) Tx() *sql.Tx
- func (tbl HookTable) Update(req require.Requirement, vv ...*Hook) (int64, error)
- func (tbl HookTable) UpdateFields(req require.Requirement, wh where.Expression, fields ...sql.NamedArg) (int64, error)
- func (tbl HookTable) Using(tx *sql.Tx) HookTable
- func (tbl HookTable) WithConstraint(cc ...constraint.Constraint) HookTable
- func (tbl HookTable) WithContext(ctx context.Context) HookTable
- func (tbl HookTable) WithPrefix(pfx string) HookTable
- type Issue
- func (v *Issue) SetAssignee(x string) *Issue
- func (v *Issue) SetBody(x string) *Issue
- func (v *Issue) SetDate(x Date) *Issue
- func (v *Issue) SetId(x int64) *Issue
- func (v *Issue) SetLabels(x []string) *Issue
- func (v *Issue) SetNumber(x int) *Issue
- func (v *Issue) SetState(x string) *Issue
- func (v *Issue) SetTitle(x string) *Issue
- type IssueTable
- func (tbl IssueTable) BeginTx(opts *sql.TxOptions) (IssueTable, error)
- func (tbl IssueTable) Constraints() constraint.Constraints
- func (tbl IssueTable) Count(wh where.Expression) (count int64, err error)
- func (tbl IssueTable) CountWhere(where string, args ...interface{}) (count int64, err error)
- func (tbl IssueTable) CreateIndexes(ifNotExist bool) (err error)
- func (tbl IssueTable) CreateIssueAssigneeIndex(ifNotExist bool) error
- func (tbl IssueTable) CreateTable(ifNotExists bool) (int64, error)
- func (tbl IssueTable) CreateTableWithIndexes(ifNotExist bool) (err error)
- func (tbl IssueTable) DB() *sql.DB
- func (tbl IssueTable) Database() *sqlgen2.Database
- func (tbl IssueTable) Delete(req require.Requirement, wh where.Expression) (int64, error)
- func (tbl IssueTable) DeleteIssues(req require.Requirement, id ...int64) (int64, error)
- func (tbl IssueTable) Dialect() schema.Dialect
- func (tbl IssueTable) DropIndexes(ifExist bool) (err error)
- func (tbl IssueTable) DropIssueAssigneeIndex(ifExists bool) error
- func (tbl IssueTable) DropTable(ifExists bool) (int64, error)
- func (tbl IssueTable) Exec(req require.Requirement, query string, args ...interface{}) (int64, error)
- func (tbl IssueTable) Execer() sqlgen2.Execer
- func (tbl IssueTable) Fetch(req require.Requirement, query string, args ...interface{}) ([]*Issue, error)
- func (tbl IssueTable) GetIssueById(req require.Requirement, id int64) (*Issue, error)
- func (tbl IssueTable) GetIssuesByAssignee(req require.Requirement, value string) ([]*Issue, error)
- func (tbl IssueTable) GetIssuesById(req require.Requirement, id ...int64) (list []*Issue, err error)
- func (tbl IssueTable) Insert(req require.Requirement, vv ...*Issue) error
- func (tbl IssueTable) IsTx() bool
- func (tbl IssueTable) Logger() *log.Logger
- func (tbl IssueTable) Name() sqlgen2.TableName
- func (tbl IssueTable) Query(query string, args ...interface{}) (*sql.Rows, error)
- func (tbl IssueTable) QueryOneNullFloat64(req require.Requirement, query string, args ...interface{}) (result sql.NullFloat64, err error)
- func (tbl IssueTable) QueryOneNullInt64(req require.Requirement, query string, args ...interface{}) (result sql.NullInt64, err error)
- func (tbl IssueTable) QueryOneNullString(req require.Requirement, query string, args ...interface{}) (result sql.NullString, err error)
- func (tbl IssueTable) ReplaceTableName(query string) string
- func (tbl IssueTable) Select(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]*Issue, error)
- func (tbl IssueTable) SelectOne(req require.Requirement, wh where.Expression, qc where.QueryConstraint) (*Issue, error)
- func (tbl IssueTable) SelectOneWhere(req require.Requirement, where, orderBy string, args ...interface{}) (*Issue, error)
- func (tbl IssueTable) SelectWhere(req require.Requirement, where, orderBy string, args ...interface{}) ([]*Issue, error)
- func (tbl IssueTable) SliceAssignee(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
- func (tbl IssueTable) SliceBigbody(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
- func (tbl IssueTable) SliceDate(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]Date, error)
- func (tbl IssueTable) SliceId(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int64, error)
- func (tbl IssueTable) SliceNumber(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int, error)
- func (tbl IssueTable) SliceState(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
- func (tbl IssueTable) SliceTitle(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
- func (tbl IssueTable) Truncate(force bool) (err error)
- func (tbl IssueTable) Tx() *sql.Tx
- func (tbl IssueTable) Update(req require.Requirement, vv ...*Issue) (int64, error)
- func (tbl IssueTable) UpdateFields(req require.Requirement, wh where.Expression, fields ...sql.NamedArg) (int64, error)
- func (tbl IssueTable) Using(tx *sql.Tx) IssueTable
- func (tbl IssueTable) WithConstraint(cc ...constraint.Constraint) IssueTable
- func (tbl IssueTable) WithContext(ctx context.Context) IssueTable
- func (tbl IssueTable) WithPrefix(pfx string) IssueTable
- type Numbers
- type RUserTable
- func (tbl RUserTable) BeginTx(opts *sql.TxOptions) (RUserTable, error)
- func (tbl RUserTable) Constraints() constraint.Constraints
- func (tbl RUserTable) Count(wh where.Expression) (count int64, err error)
- func (tbl RUserTable) CountWhere(where string, args ...interface{}) (count int64, err error)
- func (tbl RUserTable) DB() *sql.DB
- func (tbl RUserTable) Database() *sqlgen2.Database
- func (tbl RUserTable) Dialect() schema.Dialect
- func (tbl RUserTable) Execer() sqlgen2.Execer
- func (tbl RUserTable) Fetch(req require.Requirement, query string, args ...interface{}) ([]*User, error)
- func (tbl RUserTable) GetUserByEmailAddress(req require.Requirement, value string) (*User, error)
- func (tbl RUserTable) GetUserByName(req require.Requirement, value string) (*User, error)
- func (tbl RUserTable) GetUserByUid(req require.Requirement, id int64) (*User, error)
- func (tbl RUserTable) GetUsersByUid(req require.Requirement, id ...int64) (list []*User, err error)
- func (tbl RUserTable) IsTx() bool
- func (tbl RUserTable) Logger() *log.Logger
- func (tbl RUserTable) Name() sqlgen2.TableName
- func (tbl RUserTable) Query(query string, args ...interface{}) (*sql.Rows, error)
- func (tbl RUserTable) QueryOneNullFloat64(req require.Requirement, query string, args ...interface{}) (result sql.NullFloat64, err error)
- func (tbl RUserTable) QueryOneNullInt64(req require.Requirement, query string, args ...interface{}) (result sql.NullInt64, err error)
- func (tbl RUserTable) QueryOneNullString(req require.Requirement, query string, args ...interface{}) (result sql.NullString, err error)
- func (tbl RUserTable) ReplaceTableName(query string) string
- func (tbl RUserTable) Select(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]*User, error)
- func (tbl RUserTable) SelectOne(req require.Requirement, wh where.Expression, qc where.QueryConstraint) (*User, error)
- func (tbl RUserTable) SelectOneWhere(req require.Requirement, where, orderBy string, args ...interface{}) (*User, error)
- func (tbl RUserTable) SelectWhere(req require.Requirement, where, orderBy string, args ...interface{}) ([]*User, error)
- func (tbl RUserTable) Tx() *sql.Tx
- func (tbl RUserTable) Using(tx *sql.Tx) RUserTable
- func (tbl RUserTable) WithConstraint(cc ...constraint.Constraint) RUserTable
- func (tbl RUserTable) WithContext(ctx context.Context) RUserTable
- func (tbl RUserTable) WithPrefix(pfx string) RUserTable
- type Role
- type SUserTable
- func (tbl SUserTable) BeginTx(opts *sql.TxOptions) (SUserTable, error)
- func (tbl SUserTable) Constraints() constraint.Constraints
- func (tbl SUserTable) DB() *sql.DB
- func (tbl SUserTable) Database() *sqlgen2.Database
- func (tbl SUserTable) Dialect() schema.Dialect
- func (tbl SUserTable) Execer() sqlgen2.Execer
- func (tbl SUserTable) IsTx() bool
- func (tbl SUserTable) Logger() *log.Logger
- func (tbl SUserTable) Name() sqlgen2.TableName
- func (tbl SUserTable) Query(query string, args ...interface{}) (*sql.Rows, error)
- func (tbl SUserTable) QueryOneNullFloat64(req require.Requirement, query string, args ...interface{}) (result sql.NullFloat64, err error)
- func (tbl SUserTable) QueryOneNullInt64(req require.Requirement, query string, args ...interface{}) (result sql.NullInt64, err error)
- func (tbl SUserTable) QueryOneNullString(req require.Requirement, query string, args ...interface{}) (result sql.NullString, err error)
- func (tbl SUserTable) ReplaceTableName(query string) string
- func (tbl SUserTable) SliceActive(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]bool, error)
- func (tbl SUserTable) SliceAddressid(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int64, error)
- func (tbl SUserTable) SliceAdmin(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]bool, error)
- func (tbl SUserTable) SliceAvatar(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
- func (tbl SUserTable) SliceEmailaddress(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
- func (tbl SUserTable) SliceF32(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]float32, error)
- func (tbl SUserTable) SliceF64(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]float64, error)
- func (tbl SUserTable) SliceI16(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int16, error)
- func (tbl SUserTable) SliceI32(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int32, error)
- func (tbl SUserTable) SliceI64(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int64, error)
- func (tbl SUserTable) SliceI8(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int8, error)
- func (tbl SUserTable) SliceLastupdated(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int64, error)
- func (tbl SUserTable) SliceName(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
- func (tbl SUserTable) SliceRole(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]Role, error)
- func (tbl SUserTable) SliceU16(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]uint16, error)
- func (tbl SUserTable) SliceU32(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]uint32, error)
- func (tbl SUserTable) SliceU64(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]uint64, error)
- func (tbl SUserTable) SliceU8(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]uint8, error)
- func (tbl SUserTable) SliceUid(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int64, error)
- func (tbl SUserTable) Tx() *sql.Tx
- func (tbl SUserTable) Using(tx *sql.Tx) SUserTable
- func (tbl SUserTable) WithConstraint(cc ...constraint.Constraint) SUserTable
- func (tbl SUserTable) WithContext(ctx context.Context) SUserTable
- func (tbl SUserTable) WithPrefix(pfx string) SUserTable
- type UUserTable
- func (tbl UUserTable) BeginTx(opts *sql.TxOptions) (UUserTable, error)
- func (tbl UUserTable) Constraints() constraint.Constraints
- func (tbl UUserTable) DB() *sql.DB
- func (tbl UUserTable) Database() *sqlgen2.Database
- func (tbl UUserTable) Dialect() schema.Dialect
- func (tbl UUserTable) Exec(req require.Requirement, query string, args ...interface{}) (int64, error)
- func (tbl UUserTable) Execer() sqlgen2.Execer
- func (tbl UUserTable) IsTx() bool
- func (tbl UUserTable) Logger() *log.Logger
- func (tbl UUserTable) Name() sqlgen2.TableName
- func (tbl UUserTable) Query(query string, args ...interface{}) (*sql.Rows, error)
- func (tbl UUserTable) QueryOneNullFloat64(req require.Requirement, query string, args ...interface{}) (result sql.NullFloat64, err error)
- func (tbl UUserTable) QueryOneNullInt64(req require.Requirement, query string, args ...interface{}) (result sql.NullInt64, err error)
- func (tbl UUserTable) QueryOneNullString(req require.Requirement, query string, args ...interface{}) (result sql.NullString, err error)
- func (tbl UUserTable) ReplaceTableName(query string) string
- func (tbl UUserTable) Tx() *sql.Tx
- func (tbl UUserTable) Update(req require.Requirement, vv ...*User) (int64, error)
- func (tbl UUserTable) UpdateFields(req require.Requirement, wh where.Expression, fields ...sql.NamedArg) (int64, error)
- func (tbl UUserTable) Using(tx *sql.Tx) UUserTable
- func (tbl UUserTable) WithConstraint(cc ...constraint.Constraint) UUserTable
- func (tbl UUserTable) WithContext(ctx context.Context) UUserTable
- func (tbl UUserTable) WithPrefix(pfx string) UUserTable
- type User
- func (u *User) PostGet() error
- func (u *User) PreInsert() error
- func (u *User) PreUpdate() error
- func (v *User) SetActive(x bool) *User
- func (v *User) SetAddressId(x int64) *User
- func (v *User) SetAdmin(x bool) *User
- func (v *User) SetAvatar(x string) *User
- func (v *User) SetEmailAddress(x string) *User
- func (v *User) SetF32(x float32) *User
- func (v *User) SetF64(x float64) *User
- func (v *User) SetFave(x big.Int) *User
- func (v *User) SetI16(x int16) *User
- func (v *User) SetI32(x int32) *User
- func (v *User) SetI64(x int64) *User
- func (v *User) SetI8(x int8) *User
- func (v *User) SetLastUpdated(x int64) *User
- func (v *User) SetName(x string) *User
- func (v *User) SetRole(x Role) *User
- func (v *User) SetU16(x uint16) *User
- func (v *User) SetU32(x uint32) *User
- func (v *User) SetU64(x uint64) *User
- func (v *User) SetU8(x uint8) *User
- func (v *User) SetUid(x int64) *User
- func (v *User) Setsecret(x string) *User
- func (v *User) Settoken(x string) *User
- type XUserTable
- func (tbl XUserTable) BeginTx(opts *sql.TxOptions) (XUserTable, error)
- func (tbl XUserTable) Constraints() constraint.Constraints
- func (tbl XUserTable) DB() *sql.DB
- func (tbl XUserTable) Database() *sqlgen2.Database
- func (tbl XUserTable) Dialect() schema.Dialect
- func (tbl XUserTable) Execer() sqlgen2.Execer
- func (tbl XUserTable) IsTx() bool
- func (tbl XUserTable) Logger() *log.Logger
- func (tbl XUserTable) Name() sqlgen2.TableName
- func (tbl XUserTable) Query(query string, args ...interface{}) (*sql.Rows, error)
- func (tbl XUserTable) QueryOneNullFloat64(req require.Requirement, query string, args ...interface{}) (result sql.NullFloat64, err error)
- func (tbl XUserTable) QueryOneNullInt64(req require.Requirement, query string, args ...interface{}) (result sql.NullInt64, err error)
- func (tbl XUserTable) QueryOneNullString(req require.Requirement, query string, args ...interface{}) (result sql.NullString, err error)
- func (tbl XUserTable) ReplaceTableName(query string) string
- func (tbl XUserTable) Tx() *sql.Tx
- func (tbl XUserTable) Using(tx *sql.Tx) XUserTable
- func (tbl XUserTable) WithConstraint(cc ...constraint.Constraint) XUserTable
- func (tbl XUserTable) WithContext(ctx context.Context) XUserTable
- func (tbl XUserTable) WithPrefix(pfx string) XUserTable
Constants ¶
const AUserColumnNames = "uid,name,emailaddress,addressid,avatar,role,active,admin,fave,lastupdated,i8,u8,i16,u16,i32,u32,i64,u64,f32,f64,token,secret"
const AUserDataColumnNames = "name,emailaddress,addressid,avatar,role,active,admin,fave,lastupdated,i8,u8,i16,u16,i32,u32,i64,u64,f32,f64,token,secret"
const AUserPk = "uid"
const AddressColumnNames = "id,lines,town,postcode"
const AddressDataColumnNames = "lines,town,postcode"
const AddressPk = "id"
const AssociationColumnNames = "id,name,quality,ref1,ref2,category"
const AssociationDataColumnNames = "name,quality,ref1,ref2,category"
const AssociationPk = "id"
const CUserColumnNames = "uid,name,emailaddress,addressid,avatar,role,active,admin,fave,lastupdated,i8,u8,i16,u16,i32,u32,i64,u64,f32,f64,token,secret"
const CUserDataColumnNames = "name,emailaddress,addressid,avatar,role,active,admin,fave,lastupdated,i8,u8,i16,u16,i32,u32,i64,u64,f32,f64,token,secret"
const CUserPk = "uid"
const DUserColumnNames = "uid,name,emailaddress,addressid,avatar,role,active,admin,fave,lastupdated,i8,u8,i16,u16,i32,u32,i64,u64,f32,f64,token,secret"
const DUserDataColumnNames = "name,emailaddress,addressid,avatar,role,active,admin,fave,lastupdated,i8,u8,i16,u16,i32,u32,i64,u64,f32,f64,token,secret"
const DUserPk = "uid"
const DbCompoundColumnNames = "alpha,beta,category"
const DbUserColumnNames = "uid,name,emailaddress,addressid,avatar,role,active,admin,fave,lastupdated,i8,u8,i16,u16,i32,u32,i64,u64,f32,f64,token,secret"
const DbUserDataColumnNames = "name,emailaddress,addressid,avatar,role,active,admin,fave,lastupdated,i8,u8,i16,u16,i32,u32,i64,u64,f32,f64,token,secret"
const DbUserPk = "uid"
const HookColumnNames = "" /* 242-byte string literal not displayed */
const HookDataColumnNames = "" /* 239-byte string literal not displayed */
const HookPk = "id"
const IssueColumnNames = "id,number,date,title,bigbody,assignee,state,labels"
const IssueDataColumnNames = "number,date,title,bigbody,assignee,state,labels"
const IssuePk = "id"
const NumAUserColumns = 22
const NumAUserDataColumns = 21
const NumAddressColumns = 4
const NumAddressDataColumns = 3
const NumAssociationColumns = 6
const NumAssociationDataColumns = 5
const NumCUserColumns = 22
const NumCUserDataColumns = 21
const NumDUserColumns = 22
const NumDUserDataColumns = 21
const NumDbCompoundColumns = 3
const NumDbCompoundDataColumns = 3
const NumDbUserColumns = 22
const NumDbUserDataColumns = 21
const NumHookColumns = 17
const NumHookDataColumns = 16
const NumIssueColumns = 8
const NumIssueDataColumns = 7
const NumRUserColumns = 22
const NumRUserDataColumns = 21
const NumSUserColumns = 22
const NumSUserDataColumns = 21
const NumUUserColumns = 22
const NumUUserDataColumns = 21
const NumXUserColumns = 22
const NumXUserDataColumns = 21
const RUserColumnNames = "uid,name,emailaddress,addressid,avatar,role,active,admin,fave,lastupdated,i8,u8,i16,u16,i32,u32,i64,u64,f32,f64,token,secret"
const RUserDataColumnNames = "name,emailaddress,addressid,avatar,role,active,admin,fave,lastupdated,i8,u8,i16,u16,i32,u32,i64,u64,f32,f64,token,secret"
const RUserPk = "uid"
const SUserColumnNames = "uid,name,emailaddress,addressid,avatar,role,active,admin,fave,lastupdated,i8,u8,i16,u16,i32,u32,i64,u64,f32,f64,token,secret"
const SUserDataColumnNames = "name,emailaddress,addressid,avatar,role,active,admin,fave,lastupdated,i8,u8,i16,u16,i32,u32,i64,u64,f32,f64,token,secret"
const SUserPk = "uid"
const UUserColumnNames = "uid,name,emailaddress,addressid,avatar,role,active,admin,fave,lastupdated,i8,u8,i16,u16,i32,u32,i64,u64,f32,f64,token,secret"
const UUserDataColumnNames = "name,emailaddress,addressid,avatar,role,active,admin,fave,lastupdated,i8,u8,i16,u16,i32,u32,i64,u64,f32,f64,token,secret"
const UUserPk = "uid"
const XUserColumnNames = "uid,name,emailaddress,addressid,avatar,role,active,admin,fave,lastupdated,i8,u8,i16,u16,i32,u32,i64,u64,f32,f64,token,secret"
const XUserDataColumnNames = "name,emailaddress,addressid,avatar,role,active,admin,fave,lastupdated,i8,u8,i16,u16,i32,u32,i64,u64,f32,f64,token,secret"
const XUserPk = "uid"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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 sqlgen2.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 sqlgen2.TableName, d *sqlgen2.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) BeginTx ¶ added in v0.8.0
func (tbl AUserTable) BeginTx(opts *sql.TxOptions) (AUserTable, error)
BeginTx starts a transaction using the table's context. This context is used until the transaction is committed or rolled back.
If this context is cancelled, the sql package will roll back the transaction. In this case, Tx.Commit will then return an error.
The provided TxOptions is optional and may be nil if defaults should be used. If a non-default isolation level is used that the driver doesn't support, an error will be returned.
Panics if the Execer is not TxStarter.
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) DB ¶ added in v0.8.0
func (tbl AUserTable) DB() *sql.DB
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() *sqlgen2.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) DeleteUsers ¶ added in v0.8.0
func (tbl AUserTable) DeleteUsers(req require.Requirement, id ...int64) (int64, error)
DeleteUsers deletes rows from the table, given some primary keys. The list of ids can be arbitrarily long.
func (AUserTable) Dialect ¶ added in v0.8.0
func (tbl AUserTable) Dialect() schema.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() sqlgen2.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, value 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, value 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) GetUsersByUid ¶ added in v0.16.0
func (tbl AUserTable) GetUsersByUid(req require.Requirement, id ...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() *log.Logger
Logger gets the trace logger.
func (AUserTable) Name ¶ added in v0.8.0
func (tbl AUserTable) Name() sqlgen2.TableName
Name gets the table name.
func (AUserTable) Query ¶ added in v0.8.0
func (tbl AUserTable) Query(query string, args ...interface{}) (*sql.Rows, error)
Query is the low-level request method for this table. 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 caller must call rows.Close() on the result.
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) ReplaceTableName ¶ added in v0.9.0
func (tbl AUserTable) ReplaceTableName(query string) string
ReplaceTableName replaces all occurrences of "{TABLE}" with the table's name.
func (AUserTable) Select ¶ added in v0.8.0
func (tbl AUserTable) Select(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]*User, error)
Select allows Users to be obtained from the table that match a 'where' clause. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
It places a requirement, which may be nil, on the size of the expected results: for example require.AtLeastOne controls whether an error is generated when no result is found.
func (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 sqlgen2. 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 Example to be obtained from the table that match 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) SliceActive ¶ added in v0.8.0
func (tbl AUserTable) SliceActive(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]bool, error)
SliceActive gets the Active 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) 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) SliceAdmin ¶ added in v0.8.0
func (tbl AUserTable) SliceAdmin(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]bool, error)
SliceAdmin gets the Admin 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
func (tbl AUserTable) SliceF32(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]float32, error)
SliceF32 gets the F32 column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (AUserTable) SliceF64 ¶ added in v0.19.0
func (tbl AUserTable) SliceF64(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]float64, error)
SliceF64 gets the F64 column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (AUserTable) SliceI16 ¶ added in v0.19.0
func (tbl AUserTable) SliceI16(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int16, error)
SliceI16 gets the I16 column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (AUserTable) SliceI32 ¶ added in v0.19.0
func (tbl AUserTable) SliceI32(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int32, error)
SliceI32 gets the I32 column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (AUserTable) SliceI64 ¶ added in v0.19.0
func (tbl AUserTable) SliceI64(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int64, error)
SliceI64 gets the I64 column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (AUserTable) SliceI8 ¶ added in v0.19.0
func (tbl AUserTable) SliceI8(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int8, error)
SliceI8 gets the I8 column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (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
func (tbl AUserTable) SliceName(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
SliceName gets the Name column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (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
func (tbl AUserTable) SliceU16(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]uint16, error)
SliceU16 gets the U16 column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (AUserTable) SliceU32 ¶ added in v0.19.0
func (tbl AUserTable) SliceU32(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]uint32, error)
SliceU32 gets the U32 column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (AUserTable) SliceU64 ¶ added in v0.19.0
func (tbl AUserTable) SliceU64(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]uint64, error)
SliceU64 gets the U64 column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (AUserTable) SliceU8 ¶ added in v0.19.0
func (tbl AUserTable) SliceU8(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]uint8, error)
SliceU8 gets the U8 column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (AUserTable) SliceUid ¶ added in v0.8.0
func (tbl AUserTable) SliceUid(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int64, error)
SliceUid gets the Uid column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (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() *sql.Tx
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) 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 (very risky!).
func (AUserTable) Using ¶ added in v0.9.0
func (tbl AUserTable) Using(tx *sql.Tx) AUserTable
Using returns a modified Table 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) AUserTable
WithConstraint returns a modified Table with added data consistency constraints.
func (AUserTable) WithContext ¶ added in v0.8.0
func (tbl AUserTable) WithContext(ctx context.Context) AUserTable
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) AUserTable
WithPrefix sets the table name prefix for subsequent queries. The result is a modified copy of the table; the original is unchanged.
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 sqlgen2.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 sqlgen2.TableName, d *sqlgen2.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) BeginTx ¶ added in v0.12.0
func (tbl AddressTable) BeginTx(opts *sql.TxOptions) (AddressTable, error)
BeginTx starts a transaction using the table's context. This context is used until the transaction is committed or rolled back.
If this context is cancelled, the sql package will roll back the transaction. In this case, Tx.Commit will then return an error.
The provided TxOptions is optional and may be nil if defaults should be used. If a non-default isolation level is used that the driver doesn't support, an error will be returned.
Panics if the Execer is not TxStarter.
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) DB ¶ added in v0.12.0
func (tbl AddressTable) DB() *sql.DB
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() *sqlgen2.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) DeleteAddresses ¶ added in v0.12.0
func (tbl AddressTable) DeleteAddresses(req require.Requirement, id ...int64) (int64, error)
DeleteAddresses deletes rows from the table, given some primary keys. The list of ids can be arbitrarily long.
func (AddressTable) Dialect ¶ added in v0.12.0
func (tbl AddressTable) Dialect() schema.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) 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() sqlgen2.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) GetAddressesById ¶ added in v0.16.0
func (tbl AddressTable) GetAddressesById(req require.Requirement, 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, value string) ([]*Address, error)
GetAddressesByPostcode gets the records with a given postcode value. If not found, *Address will be nil.
func (AddressTable) GetAddressesByTown ¶ added in v0.16.0
func (tbl AddressTable) GetAddressesByTown(req require.Requirement, value string) ([]*Address, error)
GetAddressesByTown gets the records with a given town value. If not found, *Address will be nil.
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() *log.Logger
Logger gets the trace logger.
func (AddressTable) Name ¶ added in v0.12.0
func (tbl AddressTable) Name() sqlgen2.TableName
Name gets the table name.
func (AddressTable) Query ¶ added in v0.12.0
func (tbl AddressTable) Query(query string, args ...interface{}) (*sql.Rows, error)
Query is the low-level request method for this table. 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 caller must call rows.Close() on the result.
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) ReplaceTableName ¶ added in v0.12.0
func (tbl AddressTable) ReplaceTableName(query string) string
ReplaceTableName replaces all occurrences of "{TABLE}" with the table's name.
func (AddressTable) Select ¶ added in v0.12.0
func (tbl AddressTable) Select(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]*Address, error)
Select allows Addresses to be obtained from the table that match a 'where' clause. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
It places a requirement, which may be nil, on the size of the expected results: for example require.AtLeastOne controls whether an error is generated when no result is found.
func (AddressTable) SelectOne ¶ added in v0.12.0
func (tbl AddressTable) SelectOne(req require.Requirement, wh where.Expression, qc where.QueryConstraint) (*Address, error)
SelectOne allows a single Address to be obtained from the sqlgen2. 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 Example to be obtained from the table that match 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
func (tbl AddressTable) SliceId(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int64, error)
SliceId gets the Id column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (AddressTable) SlicePostcode ¶ 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
func (tbl AddressTable) SliceTown(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
SliceTown gets the Town column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (AddressTable) 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() *sql.Tx
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) 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 (very risky!).
func (AddressTable) Using ¶ added in v0.12.0
func (tbl AddressTable) Using(tx *sql.Tx) AddressTable
Using returns a modified Table 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) AddressTable
WithConstraint returns a modified Table with added data consistency constraints.
func (AddressTable) WithContext ¶ added in v0.12.0
func (tbl AddressTable) WithContext(ctx context.Context) AddressTable
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) AddressTable
WithPrefix sets the table name prefix for subsequent queries. The result is a modified copy of the table; the original is unchanged.
type Association ¶
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 sqlgen2.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 sqlgen2.TableName, d *sqlgen2.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) BeginTx ¶
func (tbl AssociationTable) BeginTx(opts *sql.TxOptions) (AssociationTable, error)
BeginTx starts a transaction using the table's context. This context is used until the transaction is committed or rolled back.
If this context is cancelled, the sql package will roll back the transaction. In this case, Tx.Commit will then return an error.
The provided TxOptions is optional and may be nil if defaults should be used. If a non-default isolation level is used that the driver doesn't support, an error will be returned.
Panics if the Execer is not TxStarter.
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) DB ¶
func (tbl AssociationTable) DB() *sql.DB
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() *sqlgen2.Database
Database gets the shared database information.
func (AssociationTable) Delete ¶
func (tbl AssociationTable) 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 (AssociationTable) DeleteAssociations ¶ added in v0.8.0
func (tbl AssociationTable) DeleteAssociations(req require.Requirement, id ...int64) (int64, error)
DeleteAssociations deletes rows from the table, given some primary keys. The list of ids can be arbitrarily long.
func (AssociationTable) Dialect ¶
func (tbl AssociationTable) Dialect() schema.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() sqlgen2.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, 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() *log.Logger
Logger gets the trace logger.
func (AssociationTable) Name ¶
func (tbl AssociationTable) Name() sqlgen2.TableName
Name gets the table name.
func (AssociationTable) Query ¶
func (tbl AssociationTable) Query(query string, args ...interface{}) (*sql.Rows, error)
Query is the low-level request method for this table. 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 caller must call rows.Close() on the result.
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) ReplaceTableName ¶ added in v0.9.0
func (tbl AssociationTable) ReplaceTableName(query string) string
ReplaceTableName replaces all occurrences of "{TABLE}" with the table's name.
func (AssociationTable) Select ¶
func (tbl AssociationTable) Select(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]*Association, error)
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 ¶
func (tbl AssociationTable) SelectOne(req require.Requirement, wh where.Expression, qc where.QueryConstraint) (*Association, error)
SelectOne allows a single Association to be obtained from the sqlgen2. 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 Example to be obtained from the table that match 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 ¶
func (tbl AssociationTable) 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 (AssociationTable) SliceId ¶
func (tbl AssociationTable) SliceId(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int64, error)
SliceId gets the Id column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (AssociationTable) SliceName ¶
func (tbl AssociationTable) SliceName(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
SliceName gets the Name column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (AssociationTable) SliceQuality ¶
func (tbl AssociationTable) SliceQuality(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
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 ¶
func (tbl AssociationTable) SliceRef1(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int64, error)
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 ¶
func (tbl AssociationTable) SliceRef2(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int64, error)
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) 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() *sql.Tx
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) 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 (very risky!).
func (AssociationTable) Using ¶ added in v0.9.0
func (tbl AssociationTable) Using(tx *sql.Tx) AssociationTable
Using returns a modified Table 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) AssociationTable
WithConstraint returns a modified Table with added data consistency constraints.
func (AssociationTable) WithContext ¶
func (tbl AssociationTable) WithContext(ctx context.Context) AssociationTable
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) AssociationTable
WithPrefix sets the table name prefix for subsequent queries. The result is a modified copy of the table; the original is unchanged.
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 sqlgen2.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 sqlgen2.TableName, d *sqlgen2.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) BeginTx ¶ added in v0.8.0
func (tbl CUserTable) BeginTx(opts *sql.TxOptions) (CUserTable, error)
BeginTx starts a transaction using the table's context. This context is used until the transaction is committed or rolled back.
If this context is cancelled, the sql package will roll back the transaction. In this case, Tx.Commit will then return an error.
The provided TxOptions is optional and may be nil if defaults should be used. If a non-default isolation level is used that the driver doesn't support, an error will be returned.
Panics if the Execer is not TxStarter.
func (CUserTable) Constraints ¶ added in v0.14.0
func (tbl CUserTable) Constraints() constraint.Constraints
Constraints returns the table's constraints.
func (CUserTable) DB ¶ added in v0.8.0
func (tbl CUserTable) DB() *sql.DB
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() *sqlgen2.Database
Database gets the shared database information.
func (CUserTable) Dialect ¶ added in v0.8.0
func (tbl CUserTable) Dialect() schema.Dialect
Dialect gets the database dialect.
func (CUserTable) Execer ¶ added in v0.12.0
func (tbl CUserTable) Execer() sqlgen2.Execer
Execer gets the wrapped database or transaction handle.
func (CUserTable) Insert ¶ added in v0.8.0
func (tbl CUserTable) 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 (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() *log.Logger
Logger gets the trace logger.
func (CUserTable) Name ¶ added in v0.8.0
func (tbl CUserTable) Name() sqlgen2.TableName
Name gets the table name.
func (CUserTable) Query ¶ added in v0.8.0
func (tbl CUserTable) Query(query string, args ...interface{}) (*sql.Rows, error)
Query is the low-level request method for this table. 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 caller must call rows.Close() on the result.
func (CUserTable) QueryOneNullFloat64 ¶ added in v0.9.0
func (tbl CUserTable) 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 (CUserTable) QueryOneNullInt64 ¶ added in v0.9.0
func (tbl CUserTable) 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 (CUserTable) QueryOneNullString ¶ added in v0.9.0
func (tbl CUserTable) 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 (CUserTable) ReplaceTableName ¶ added in v0.9.0
func (tbl CUserTable) ReplaceTableName(query string) string
ReplaceTableName replaces all occurrences of "{TABLE}" with the table's name.
func (CUserTable) Tx ¶ added in v0.8.0
func (tbl CUserTable) Tx() *sql.Tx
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 *sql.Tx) CUserTable
Using returns a modified Table 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) CUserTable
WithConstraint returns a modified Table with added data consistency constraints.
func (CUserTable) WithContext ¶ added in v0.8.0
func (tbl CUserTable) WithContext(ctx context.Context) CUserTable
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) CUserTable
WithPrefix sets the table name prefix for subsequent queries. The result is a modified copy of the table; the original is unchanged.
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 sqlgen2.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 sqlgen2.TableName, d *sqlgen2.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) BeginTx ¶ added in v0.8.0
func (tbl DUserTable) BeginTx(opts *sql.TxOptions) (DUserTable, error)
BeginTx starts a transaction using the table's context. This context is used until the transaction is committed or rolled back.
If this context is cancelled, the sql package will roll back the transaction. In this case, Tx.Commit will then return an error.
The provided TxOptions is optional and may be nil if defaults should be used. If a non-default isolation level is used that the driver doesn't support, an error will be returned.
Panics if the Execer is not TxStarter.
func (DUserTable) Constraints ¶ added in v0.14.0
func (tbl DUserTable) Constraints() constraint.Constraints
Constraints returns the table's constraints.
func (DUserTable) DB ¶ added in v0.8.0
func (tbl DUserTable) DB() *sql.DB
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() *sqlgen2.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) DeleteUsers ¶ added in v0.8.0
func (tbl DUserTable) DeleteUsers(req require.Requirement, id ...int64) (int64, error)
DeleteUsers deletes rows from the table, given some primary keys. The list of ids can be arbitrarily long.
func (DUserTable) Dialect ¶ added in v0.8.0
func (tbl DUserTable) Dialect() schema.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() sqlgen2.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() *log.Logger
Logger gets the trace logger.
func (DUserTable) Name ¶ added in v0.8.0
func (tbl DUserTable) Name() sqlgen2.TableName
Name gets the table name.
func (DUserTable) Query ¶ added in v0.8.0
func (tbl DUserTable) Query(query string, args ...interface{}) (*sql.Rows, error)
Query is the low-level request method for this table. 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 caller must call rows.Close() on the result.
func (DUserTable) QueryOneNullFloat64 ¶ added in v0.9.0
func (tbl DUserTable) 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 (DUserTable) QueryOneNullInt64 ¶ added in v0.9.0
func (tbl DUserTable) 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 (DUserTable) QueryOneNullString ¶ added in v0.9.0
func (tbl DUserTable) 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 (DUserTable) ReplaceTableName ¶ added in v0.9.0
func (tbl DUserTable) ReplaceTableName(query string) string
ReplaceTableName replaces all occurrences of "{TABLE}" with the table's name.
func (DUserTable) Tx ¶ added in v0.8.0
func (tbl DUserTable) Tx() *sql.Tx
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 *sql.Tx) DUserTable
Using returns a modified Table 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) DUserTable
WithConstraint returns a modified Table with added data consistency constraints.
func (DUserTable) WithContext ¶ added in v0.8.0
func (tbl DUserTable) WithContext(ctx context.Context) DUserTable
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) DUserTable
WithPrefix sets the table name prefix for subsequent queries. The result is a modified copy of the table; the original is unchanged.
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 sqlgen2.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 sqlgen2.TableName, d *sqlgen2.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) BeginTx ¶
func (tbl DbCompoundTable) BeginTx(opts *sql.TxOptions) (DbCompoundTable, error)
BeginTx starts a transaction using the table's context. This context is used until the transaction is committed or rolled back.
If this context is cancelled, the sql package will roll back the transaction. In this case, Tx.Commit will then return an error.
The provided TxOptions is optional and may be nil if defaults should be used. If a non-default isolation level is used that the driver doesn't support, an error will be returned.
Panics if the Execer is not TxStarter.
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) DB ¶
func (tbl DbCompoundTable) DB() *sql.DB
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() *sqlgen2.Database
Database gets the shared database information.
func (DbCompoundTable) Delete ¶
func (tbl DbCompoundTable) 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 (DbCompoundTable) Dialect ¶
func (tbl DbCompoundTable) Dialect() schema.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() sqlgen2.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) Insert ¶
func (tbl DbCompoundTable) Insert(req require.Requirement, vv ...*Compound) error
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() *log.Logger
Logger gets the trace logger.
func (DbCompoundTable) Name ¶
func (tbl DbCompoundTable) Name() sqlgen2.TableName
Name gets the table name.
func (DbCompoundTable) Query ¶
func (tbl DbCompoundTable) Query(query string, args ...interface{}) (*sql.Rows, error)
Query is the low-level request method for this table. 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 caller must call rows.Close() on the result.
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) ReplaceTableName ¶ added in v0.9.0
func (tbl DbCompoundTable) ReplaceTableName(query string) string
ReplaceTableName replaces all occurrences of "{TABLE}" with the table's name.
func (DbCompoundTable) Select ¶
func (tbl DbCompoundTable) Select(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]*Compound, error)
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 ¶
func (tbl DbCompoundTable) SelectOne(req require.Requirement, wh where.Expression, qc where.QueryConstraint) (*Compound, error)
SelectOne allows a single Compound to be obtained from the sqlgen2. 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 Example to be obtained from the table that match 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 ¶
func (tbl DbCompoundTable) SliceAlpha(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
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 ¶
func (tbl DbCompoundTable) SliceBeta(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
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 ¶
func (tbl DbCompoundTable) 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 (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() *sql.Tx
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) 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 (very risky!).
func (DbCompoundTable) Using ¶ added in v0.9.0
func (tbl DbCompoundTable) Using(tx *sql.Tx) DbCompoundTable
Using returns a modified Table 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) DbCompoundTable
WithConstraint returns a modified Table with added data consistency constraints.
func (DbCompoundTable) WithContext ¶
func (tbl DbCompoundTable) WithContext(ctx context.Context) DbCompoundTable
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) DbCompoundTable
WithPrefix sets the table name prefix for subsequent queries. The result is a modified copy of the table; the original is unchanged.
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 sqlgen2.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 sqlgen2.TableName, d *sqlgen2.Database) DbUserTable
NewDbUserTable 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 (DbUserTable) BeginTx ¶
func (tbl DbUserTable) BeginTx(opts *sql.TxOptions) (DbUserTable, error)
BeginTx starts a transaction using the table's context. This context is used until the transaction is committed or rolled back.
If this context is cancelled, the sql package will roll back the transaction. In this case, Tx.Commit will then return an error.
The provided TxOptions is optional and may be nil if defaults should be used. If a non-default isolation level is used that the driver doesn't support, an error will be returned.
Panics if the Execer is not TxStarter.
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) DB ¶
func (tbl DbUserTable) DB() *sql.DB
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() *sqlgen2.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) DeleteUsers ¶ added in v0.8.0
func (tbl DbUserTable) DeleteUsers(req require.Requirement, id ...int64) (int64, error)
DeleteUsers deletes rows from the table, given some primary keys. The list of ids can be arbitrarily long.
func (DbUserTable) Dialect ¶
func (tbl DbUserTable) Dialect() schema.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() sqlgen2.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, value 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, value 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) GetUsersByUid ¶ added in v0.16.0
func (tbl DbUserTable) GetUsersByUid(req require.Requirement, id ...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() *log.Logger
Logger gets the trace logger.
func (DbUserTable) Query ¶
func (tbl DbUserTable) Query(query string, args ...interface{}) (*sql.Rows, error)
Query is the low-level request method for this table. 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 caller must call rows.Close() on the result.
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) ReplaceTableName ¶ added in v0.9.0
func (tbl DbUserTable) ReplaceTableName(query string) string
ReplaceTableName replaces all occurrences of "{TABLE}" with the table's name.
func (DbUserTable) Select ¶
func (tbl DbUserTable) Select(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]*User, error)
Select allows Users to be obtained from the table that match a 'where' clause. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
It places a requirement, which may be nil, on the size of the expected results: for example require.AtLeastOne controls whether an error is generated when no result is found.
func (DbUserTable) SelectOne ¶
func (tbl DbUserTable) SelectOne(req require.Requirement, wh where.Expression, qc where.QueryConstraint) (*User, error)
SelectOne allows a single User to be obtained from the sqlgen2. 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 Example to be obtained from the table that match 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) SliceActive ¶
func (tbl DbUserTable) SliceActive(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]bool, error)
SliceActive gets the Active 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) 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) SliceAdmin ¶
func (tbl DbUserTable) SliceAdmin(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]bool, error)
SliceAdmin gets the Admin 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
func (tbl DbUserTable) SliceF32(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]float32, error)
SliceF32 gets the F32 column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (DbUserTable) SliceF64 ¶ added in v0.19.0
func (tbl DbUserTable) SliceF64(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]float64, error)
SliceF64 gets the F64 column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (DbUserTable) SliceI16 ¶ added in v0.19.0
func (tbl DbUserTable) SliceI16(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int16, error)
SliceI16 gets the I16 column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (DbUserTable) SliceI32 ¶ added in v0.19.0
func (tbl DbUserTable) SliceI32(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int32, error)
SliceI32 gets the I32 column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (DbUserTable) SliceI64 ¶ added in v0.19.0
func (tbl DbUserTable) SliceI64(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int64, error)
SliceI64 gets the I64 column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (DbUserTable) SliceI8 ¶ added in v0.19.0
func (tbl DbUserTable) SliceI8(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int8, error)
SliceI8 gets the I8 column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (DbUserTable) SliceLastupdated ¶ 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
func (tbl DbUserTable) SliceName(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
SliceName gets the Name column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (DbUserTable) SliceRole ¶ 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
func (tbl DbUserTable) SliceU16(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]uint16, error)
SliceU16 gets the U16 column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (DbUserTable) SliceU32 ¶ added in v0.19.0
func (tbl DbUserTable) SliceU32(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]uint32, error)
SliceU32 gets the U32 column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (DbUserTable) SliceU64 ¶ added in v0.19.0
func (tbl DbUserTable) SliceU64(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]uint64, error)
SliceU64 gets the U64 column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (DbUserTable) SliceU8 ¶ added in v0.19.0
func (tbl DbUserTable) SliceU8(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]uint8, error)
SliceU8 gets the U8 column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (DbUserTable) SliceUid ¶
func (tbl DbUserTable) SliceUid(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int64, error)
SliceUid gets the Uid column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (DbUserTable) 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() *sql.Tx
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) 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 (very risky!).
func (DbUserTable) Using ¶ added in v0.9.0
func (tbl DbUserTable) Using(tx *sql.Tx) DbUserTable
Using returns a modified Table 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) DbUserTable
WithConstraint returns a modified Table with added data consistency constraints.
func (DbUserTable) WithContext ¶
func (tbl DbUserTable) WithContext(ctx context.Context) DbUserTable
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) DbUserTable
WithPrefix sets the table name prefix for subsequent queries. The result is a modified copy of the table; the original is unchanged.
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
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 ¶
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) BeginTx ¶
BeginTx starts a transaction using the table's context. This context is used until the transaction is committed or rolled back.
If this context is cancelled, the sql package will roll back the transaction. In this case, Tx.Commit will then return an error.
The provided TxOptions is optional and may be nil if defaults should be used. If a non-default isolation level is used that the driver doesn't support, an error will be returned.
Panics if the Execer is not TxStarter.
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
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 ¶
CreateTable creates the table.
func (HookTable) DB ¶
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) 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) DeleteHooks ¶ added in v0.8.0
DeleteHooks deletes rows from the table, given some primary keys. The list of ids can be arbitrarily long.
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) 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
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
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) Query ¶
Query is the low-level request method for this table. 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 caller must call rows.Close() on the result.
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) ReplaceTableName ¶ added in v0.9.0
ReplaceTableName replaces all occurrences of "{TABLE}" with the table's name.
func (HookTable) Select ¶
func (tbl HookTable) Select(req require.Requirement, wh where.Expression, qc where.QueryConstraint) (HookList, error)
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 sqlgen2. 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 Example to be obtained from the table that match 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)
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) SliceCreated ¶
func (tbl HookTable) SliceCreated(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]bool, error)
SliceCreated gets the Created 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) SliceDeleted ¶
func (tbl HookTable) SliceDeleted(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]bool, error)
SliceDeleted gets the Deleted 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) SliceForced ¶
func (tbl HookTable) SliceForced(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]bool, error)
SliceForced gets the Forced 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)
SliceEmail gets the 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)
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 (HookTable) SliceHeadCommitAuthorUsername ¶ added in v0.8.0
func (tbl HookTable) SliceHeadCommitAuthorUsername(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
SliceUsername gets the 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)
SliceEmail gets the 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)
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 (HookTable) SliceHeadCommitCommitterUsername ¶ added in v0.8.0
func (tbl HookTable) SliceHeadCommitCommitterUsername(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
SliceUsername gets the 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 ¶
func (tbl HookTable) SliceId(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]uint64, error)
SliceId gets the Id column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (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 ¶
func (tbl HookTable) SliceSha(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
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) Truncate ¶
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 ¶
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 ¶
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) 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 (very risky!).
func (HookTable) Using ¶ added in v0.9.0
Using returns a modified Table 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) HookTable
WithConstraint returns a modified Table with added data consistency constraints.
func (HookTable) WithContext ¶
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 ¶
WithPrefix sets the table name prefix for subsequent queries. The result is a modified copy of the table; the original is unchanged.
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 (*Issue) SetAssignee ¶ added in v0.8.0
SetAssignee sets the Assignee field and returns the modified Issue.
func (*Issue) SetLabels ¶ added in v0.8.0
SetLabels sets the Labels field and returns the modified Issue.
func (*Issue) SetNumber ¶ added in v0.8.0
SetNumber sets the Number field and returns the modified Issue.
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 sqlgen2.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 sqlgen2.TableName, d *sqlgen2.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) BeginTx ¶
func (tbl IssueTable) BeginTx(opts *sql.TxOptions) (IssueTable, error)
BeginTx starts a transaction using the table's context. This context is used until the transaction is committed or rolled back.
If this context is cancelled, the sql package will roll back the transaction. In this case, Tx.Commit will then return an error.
The provided TxOptions is optional and may be nil if defaults should be used. If a non-default isolation level is used that the driver doesn't support, an error will be returned.
Panics if the Execer is not TxStarter.
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) DB ¶
func (tbl IssueTable) DB() *sql.DB
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() *sqlgen2.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) DeleteIssues ¶ added in v0.8.0
func (tbl IssueTable) DeleteIssues(req require.Requirement, id ...int64) (int64, error)
DeleteIssues deletes rows from the table, given some primary keys. The list of ids can be arbitrarily long.
func (IssueTable) Dialect ¶
func (tbl IssueTable) Dialect() schema.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() sqlgen2.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, value string) ([]*Issue, error)
GetIssuesByAssignee gets the records with a given assignee value. If not found, *Issue will be nil.
func (IssueTable) GetIssuesById ¶ added in v0.16.0
func (tbl IssueTable) GetIssuesById(req require.Requirement, 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) Query ¶
func (tbl IssueTable) Query(query string, args ...interface{}) (*sql.Rows, error)
Query is the low-level request method for this table. 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 caller must call rows.Close() on the result.
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) ReplaceTableName ¶ added in v0.9.0
func (tbl IssueTable) ReplaceTableName(query string) string
ReplaceTableName replaces all occurrences of "{TABLE}" with the table's name.
func (IssueTable) Select ¶
func (tbl IssueTable) Select(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]*Issue, error)
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 ¶
func (tbl IssueTable) SelectOne(req require.Requirement, wh where.Expression, qc where.QueryConstraint) (*Issue, error)
SelectOne allows a single Issue to be obtained from the sqlgen2. 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 Example to be obtained from the table that match 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)
SliceBody gets the Body 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) SliceDate ¶
func (tbl IssueTable) SliceDate(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]Date, error)
SliceDate gets the Date 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 ¶
func (tbl IssueTable) SliceId(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int64, error)
SliceId gets the Id column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (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) 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() *sql.Tx
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) 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 (very risky!).
func (IssueTable) Using ¶ added in v0.9.0
func (tbl IssueTable) Using(tx *sql.Tx) IssueTable
Using returns a modified Table 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) IssueTable
WithConstraint returns a modified Table with added data consistency constraints.
func (IssueTable) WithContext ¶
func (tbl IssueTable) WithContext(ctx context.Context) IssueTable
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) IssueTable
WithPrefix sets the table name prefix for subsequent queries. The result is a modified copy of the table; the original is unchanged.
type RUserTable ¶ added in v0.8.0
type RUserTable struct {
// contains filtered or unexported fields
}
RUserTable 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 CopyTableAsRUserTable ¶ added in v0.8.0
func CopyTableAsRUserTable(origin sqlgen2.Table) RUserTable
CopyTableAsRUserTable 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 NewRUserTable ¶ added in v0.8.0
func NewRUserTable(name sqlgen2.TableName, d *sqlgen2.Database) RUserTable
NewRUserTable 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 (RUserTable) BeginTx ¶ added in v0.8.0
func (tbl RUserTable) BeginTx(opts *sql.TxOptions) (RUserTable, error)
BeginTx starts a transaction using the table's context. This context is used until the transaction is committed or rolled back.
If this context is cancelled, the sql package will roll back the transaction. In this case, Tx.Commit will then return an error.
The provided TxOptions is optional and may be nil if defaults should be used. If a non-default isolation level is used that the driver doesn't support, an error will be returned.
Panics if the Execer is not TxStarter.
func (RUserTable) Constraints ¶ added in v0.14.0
func (tbl RUserTable) Constraints() constraint.Constraints
Constraints returns the table's constraints.
func (RUserTable) Count ¶ added in v0.8.0
func (tbl RUserTable) 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 (RUserTable) CountWhere ¶ added in v0.9.0
func (tbl RUserTable) 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 (RUserTable) DB ¶ added in v0.8.0
func (tbl RUserTable) DB() *sql.DB
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 (RUserTable) Database ¶ added in v0.12.0
func (tbl RUserTable) Database() *sqlgen2.Database
Database gets the shared database information.
func (RUserTable) Dialect ¶ added in v0.8.0
func (tbl RUserTable) Dialect() schema.Dialect
Dialect gets the database dialect.
func (RUserTable) Execer ¶ added in v0.12.0
func (tbl RUserTable) Execer() sqlgen2.Execer
Execer gets the wrapped database or transaction handle.
func (RUserTable) Fetch ¶ added in v0.17.0
func (tbl RUserTable) 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 (RUserTable) GetUserByEmailAddress ¶ added in v0.16.0
func (tbl RUserTable) GetUserByEmailAddress(req require.Requirement, value string) (*User, error)
GetUserByEmailAddress gets the record with a given emailaddress value. If not found, *User will be nil.
func (RUserTable) GetUserByName ¶ added in v0.16.0
func (tbl RUserTable) GetUserByName(req require.Requirement, value string) (*User, error)
GetUserByName gets the record with a given name value. If not found, *User will be nil.
func (RUserTable) GetUserByUid ¶ added in v0.16.0
func (tbl RUserTable) 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 (RUserTable) GetUsersByUid ¶ added in v0.16.0
func (tbl RUserTable) GetUsersByUid(req require.Requirement, id ...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 (RUserTable) IsTx ¶ added in v0.8.0
func (tbl RUserTable) IsTx() bool
IsTx tests whether this is within a transaction.
func (RUserTable) Logger ¶ added in v0.8.0
func (tbl RUserTable) Logger() *log.Logger
Logger gets the trace logger.
func (RUserTable) Name ¶ added in v0.8.0
func (tbl RUserTable) Name() sqlgen2.TableName
Name gets the table name.
func (RUserTable) Query ¶ added in v0.8.0
func (tbl RUserTable) Query(query string, args ...interface{}) (*sql.Rows, error)
Query is the low-level request method for this table. 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 caller must call rows.Close() on the result.
func (RUserTable) QueryOneNullFloat64 ¶ added in v0.9.0
func (tbl RUserTable) 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 (RUserTable) QueryOneNullInt64 ¶ added in v0.9.0
func (tbl RUserTable) 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 (RUserTable) QueryOneNullString ¶ added in v0.9.0
func (tbl RUserTable) 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 (RUserTable) ReplaceTableName ¶ added in v0.9.0
func (tbl RUserTable) ReplaceTableName(query string) string
ReplaceTableName replaces all occurrences of "{TABLE}" with the table's name.
func (RUserTable) Select ¶ added in v0.8.0
func (tbl RUserTable) Select(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]*User, error)
Select allows Users to be obtained from the table that match a 'where' clause. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
It places a requirement, which may be nil, on the size of the expected results: for example require.AtLeastOne controls whether an error is generated when no result is found.
func (RUserTable) SelectOne ¶ added in v0.8.0
func (tbl RUserTable) SelectOne(req require.Requirement, wh where.Expression, qc where.QueryConstraint) (*User, error)
SelectOne allows a single User to be obtained from the sqlgen2. 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 (RUserTable) SelectOneWhere ¶ added in v0.9.0
func (tbl RUserTable) SelectOneWhere(req require.Requirement, where, orderBy string, args ...interface{}) (*User, error)
SelectOneWhere allows a single Example to be obtained from the table that match 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 (RUserTable) SelectWhere ¶ added in v0.9.0
func (tbl RUserTable) 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 (RUserTable) Tx ¶ added in v0.8.0
func (tbl RUserTable) Tx() *sql.Tx
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 (RUserTable) Using ¶ added in v0.9.0
func (tbl RUserTable) Using(tx *sql.Tx) RUserTable
Using returns a modified Table 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 (RUserTable) WithConstraint ¶ added in v0.12.0
func (tbl RUserTable) WithConstraint(cc ...constraint.Constraint) RUserTable
WithConstraint returns a modified Table with added data consistency constraints.
func (RUserTable) WithContext ¶ added in v0.8.0
func (tbl RUserTable) WithContext(ctx context.Context) RUserTable
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 (RUserTable) WithPrefix ¶ added in v0.8.0
func (tbl RUserTable) WithPrefix(pfx string) RUserTable
WithPrefix sets the table name prefix for subsequent queries. The result is a modified copy of the table; the original is unchanged.
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 sqlgen2.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 sqlgen2.TableName, d *sqlgen2.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) BeginTx ¶ added in v0.8.0
func (tbl SUserTable) BeginTx(opts *sql.TxOptions) (SUserTable, error)
BeginTx starts a transaction using the table's context. This context is used until the transaction is committed or rolled back.
If this context is cancelled, the sql package will roll back the transaction. In this case, Tx.Commit will then return an error.
The provided TxOptions is optional and may be nil if defaults should be used. If a non-default isolation level is used that the driver doesn't support, an error will be returned.
Panics if the Execer is not TxStarter.
func (SUserTable) Constraints ¶ added in v0.14.0
func (tbl SUserTable) Constraints() constraint.Constraints
Constraints returns the table's constraints.
func (SUserTable) DB ¶ added in v0.8.0
func (tbl SUserTable) DB() *sql.DB
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() *sqlgen2.Database
Database gets the shared database information.
func (SUserTable) Dialect ¶ added in v0.8.0
func (tbl SUserTable) Dialect() schema.Dialect
Dialect gets the database dialect.
func (SUserTable) Execer ¶ added in v0.12.0
func (tbl SUserTable) Execer() sqlgen2.Execer
Execer gets the wrapped database or transaction handle.
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() *log.Logger
Logger gets the trace logger.
func (SUserTable) Name ¶ added in v0.8.0
func (tbl SUserTable) Name() sqlgen2.TableName
Name gets the table name.
func (SUserTable) Query ¶ added in v0.8.0
func (tbl SUserTable) Query(query string, args ...interface{}) (*sql.Rows, error)
Query is the low-level request method for this table. 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 caller must call rows.Close() on the result.
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) ReplaceTableName ¶ added in v0.9.0
func (tbl SUserTable) ReplaceTableName(query string) string
ReplaceTableName replaces all occurrences of "{TABLE}" with the table's name.
func (SUserTable) SliceActive ¶ added in v0.8.0
func (tbl SUserTable) SliceActive(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]bool, error)
SliceActive gets the Active 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 (SUserTable) SliceAddressid ¶ added in v0.12.0
func (tbl SUserTable) 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 (SUserTable) SliceAdmin ¶ added in v0.8.0
func (tbl SUserTable) SliceAdmin(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]bool, error)
SliceAdmin gets the Admin 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 (SUserTable) SliceAvatar ¶ added in v0.8.0
func (tbl SUserTable) 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 (SUserTable) SliceEmailaddress ¶ added in v0.8.0
func (tbl SUserTable) 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 (SUserTable) SliceF32 ¶ added in v0.19.0
func (tbl SUserTable) SliceF32(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]float32, error)
SliceF32 gets the F32 column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (SUserTable) SliceF64 ¶ added in v0.19.0
func (tbl SUserTable) SliceF64(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]float64, error)
SliceF64 gets the F64 column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (SUserTable) SliceI16 ¶ added in v0.19.0
func (tbl SUserTable) SliceI16(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int16, error)
SliceI16 gets the I16 column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (SUserTable) SliceI32 ¶ added in v0.19.0
func (tbl SUserTable) SliceI32(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int32, error)
SliceI32 gets the I32 column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (SUserTable) SliceI64 ¶ added in v0.19.0
func (tbl SUserTable) SliceI64(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int64, error)
SliceI64 gets the I64 column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (SUserTable) SliceI8 ¶ added in v0.19.0
func (tbl SUserTable) SliceI8(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int8, error)
SliceI8 gets the I8 column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (SUserTable) SliceLastupdated ¶ added in v0.8.0
func (tbl SUserTable) 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 (SUserTable) SliceName ¶ added in v0.16.0
func (tbl SUserTable) SliceName(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]string, error)
SliceName gets the Name column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (SUserTable) SliceRole ¶ added in v0.10.0
func (tbl SUserTable) 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 (SUserTable) SliceU16 ¶ added in v0.19.0
func (tbl SUserTable) SliceU16(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]uint16, error)
SliceU16 gets the U16 column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (SUserTable) SliceU32 ¶ added in v0.19.0
func (tbl SUserTable) SliceU32(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]uint32, error)
SliceU32 gets the U32 column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (SUserTable) SliceU64 ¶ added in v0.19.0
func (tbl SUserTable) SliceU64(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]uint64, error)
SliceU64 gets the U64 column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (SUserTable) SliceU8 ¶ added in v0.19.0
func (tbl SUserTable) SliceU8(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]uint8, error)
SliceU8 gets the U8 column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (SUserTable) SliceUid ¶ added in v0.8.0
func (tbl SUserTable) SliceUid(req require.Requirement, wh where.Expression, qc where.QueryConstraint) ([]int64, error)
SliceUid gets the Uid column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in query constraint 'qc'. Use nil values for the 'wh' and/or 'qc' arguments if they are not needed.
func (SUserTable) Tx ¶ added in v0.8.0
func (tbl SUserTable) Tx() *sql.Tx
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 *sql.Tx) SUserTable
Using returns a modified Table 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) SUserTable
WithConstraint returns a modified Table with added data consistency constraints.
func (SUserTable) WithContext ¶ added in v0.8.0
func (tbl SUserTable) WithContext(ctx context.Context) SUserTable
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) SUserTable
WithPrefix sets the table name prefix for subsequent queries. The result is a modified copy of the table; the original is unchanged.
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 sqlgen2.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 sqlgen2.TableName, d *sqlgen2.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) BeginTx ¶ added in v0.8.0
func (tbl UUserTable) BeginTx(opts *sql.TxOptions) (UUserTable, error)
BeginTx starts a transaction using the table's context. This context is used until the transaction is committed or rolled back.
If this context is cancelled, the sql package will roll back the transaction. In this case, Tx.Commit will then return an error.
The provided TxOptions is optional and may be nil if defaults should be used. If a non-default isolation level is used that the driver doesn't support, an error will be returned.
Panics if the Execer is not TxStarter.
func (UUserTable) Constraints ¶ added in v0.14.0
func (tbl UUserTable) Constraints() constraint.Constraints
Constraints returns the table's constraints.
func (UUserTable) DB ¶ added in v0.8.0
func (tbl UUserTable) DB() *sql.DB
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() *sqlgen2.Database
Database gets the shared database information.
func (UUserTable) Dialect ¶ added in v0.8.0
func (tbl UUserTable) Dialect() schema.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() sqlgen2.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() *log.Logger
Logger gets the trace logger.
func (UUserTable) Name ¶ added in v0.8.0
func (tbl UUserTable) Name() sqlgen2.TableName
Name gets the table name.
func (UUserTable) Query ¶ added in v0.8.0
func (tbl UUserTable) Query(query string, args ...interface{}) (*sql.Rows, error)
Query is the low-level request method for this table. 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 caller must call rows.Close() on the result.
func (UUserTable) QueryOneNullFloat64 ¶ added in v0.9.0
func (tbl UUserTable) 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 (UUserTable) QueryOneNullInt64 ¶ added in v0.9.0
func (tbl UUserTable) 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 (UUserTable) QueryOneNullString ¶ added in v0.9.0
func (tbl UUserTable) 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 (UUserTable) ReplaceTableName ¶ added in v0.9.0
func (tbl UUserTable) ReplaceTableName(query string) string
ReplaceTableName replaces all occurrences of "{TABLE}" with the table's name.
func (UUserTable) Tx ¶ added in v0.8.0
func (tbl UUserTable) Tx() *sql.Tx
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) 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 (very risky!).
func (UUserTable) Using ¶ added in v0.9.0
func (tbl UUserTable) Using(tx *sql.Tx) UUserTable
Using returns a modified Table 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) UUserTable
WithConstraint returns a modified Table with added data consistency constraints.
func (UUserTable) WithContext ¶ added in v0.8.0
func (tbl UUserTable) WithContext(ctx context.Context) UUserTable
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) UUserTable
WithPrefix sets the table name prefix for subsequent queries. The result is a modified copy of the table; the original is unchanged.
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 (*User) PreInsert ¶
These hooks are just used here for testing, but you could put whatever you like in them.
func (*User) SetActive ¶ added in v0.8.0
SetActive sets the Active field and returns the modified User.
func (*User) SetAddressId ¶ added in v0.12.0
SetAddressId sets the AddressId field and returns the modified User.
func (*User) SetAdmin ¶ added in v0.8.0
SetAdmin sets the Admin field and returns the modified User.
func (*User) SetAvatar ¶ added in v0.8.0
SetAvatar sets the Avatar field and returns the modified User.
func (*User) SetEmailAddress ¶ added in v0.8.0
SetEmailAddress sets the EmailAddress field and returns the modified User.
func (*User) SetLastUpdated ¶ added in v0.8.0
SetLastUpdated sets the LastUpdated field and returns the modified User.
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 sqlgen2.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 sqlgen2.TableName, d *sqlgen2.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) BeginTx ¶ added in v0.8.0
func (tbl XUserTable) BeginTx(opts *sql.TxOptions) (XUserTable, error)
BeginTx starts a transaction using the table's context. This context is used until the transaction is committed or rolled back.
If this context is cancelled, the sql package will roll back the transaction. In this case, Tx.Commit will then return an error.
The provided TxOptions is optional and may be nil if defaults should be used. If a non-default isolation level is used that the driver doesn't support, an error will be returned.
Panics if the Execer is not TxStarter.
func (XUserTable) Constraints ¶ added in v0.14.0
func (tbl XUserTable) Constraints() constraint.Constraints
Constraints returns the table's constraints.
func (XUserTable) DB ¶ added in v0.8.0
func (tbl XUserTable) DB() *sql.DB
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() *sqlgen2.Database
Database gets the shared database information.
func (XUserTable) Dialect ¶ added in v0.8.0
func (tbl XUserTable) Dialect() schema.Dialect
Dialect gets the database dialect.
func (XUserTable) Execer ¶ added in v0.12.0
func (tbl XUserTable) Execer() sqlgen2.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() *log.Logger
Logger gets the trace logger.
func (XUserTable) Name ¶ added in v0.8.0
func (tbl XUserTable) Name() sqlgen2.TableName
Name gets the table name.
func (XUserTable) Query ¶ added in v0.8.0
func (tbl XUserTable) Query(query string, args ...interface{}) (*sql.Rows, error)
Query is the low-level request method for this table. 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 caller must call rows.Close() on the result.
func (XUserTable) QueryOneNullFloat64 ¶ added in v0.9.0
func (tbl XUserTable) 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 (XUserTable) QueryOneNullInt64 ¶ added in v0.9.0
func (tbl XUserTable) 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 (XUserTable) QueryOneNullString ¶ added in v0.9.0
func (tbl XUserTable) 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 (XUserTable) ReplaceTableName ¶ added in v0.9.0
func (tbl XUserTable) ReplaceTableName(query string) string
ReplaceTableName replaces all occurrences of "{TABLE}" with the table's name.
func (XUserTable) Tx ¶ added in v0.8.0
func (tbl XUserTable) Tx() *sql.Tx
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 *sql.Tx) XUserTable
Using returns a modified Table 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) XUserTable
WithConstraint returns a modified Table with added data consistency constraints.
func (XUserTable) WithContext ¶ added in v0.8.0
func (tbl XUserTable) WithContext(ctx context.Context) XUserTable
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) XUserTable
WithPrefix sets the table name prefix for subsequent queries. The result is a modified copy of the table; the original is unchanged.
Source Files
¶
- address.go
- address_sql.go
- association.go
- association_sql.go
- category.go
- compound.go
- compound_sql.go
- hook.go
- hook_sql.go
- issue.go
- issue_sql.go
- role.go
- user.go
- user_ex_CRUDS_sql.go
- user_ex_Cxxxx_sql.go
- user_ex_xRxxx_sql.go
- user_ex_xxUxx_sql.go
- user_ex_xxxDx_sql.go
- user_ex_xxxxS_sql.go
- user_ex_xxxxx_sql.go
- user_sql.go