demo

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2018 License: BSD-2-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const AssociationColumnNames = "id, name, quality, ref1, ref2, category"
View Source
const AssociationDataColumnNames = "name, quality, ref1, ref2, category"
View Source
const AssociationPk = "Id"
View Source
const AssociationTableName = "associations"

AssociationTableName is the default name for this table.

View Source
const DbCompoundColumnNames = "alpha, beta, category"
View Source
const DbCompoundDataColumnNames = "alpha, beta, category"
View Source
const DbCompoundTableName = "compounds"

DbCompoundTableName is the default name for this table.

View Source
const DbUserColumnNames = "uid, login, emailaddress, avatar, active, admin, fave, lastupdated, token, secret, hash"
View Source
const DbUserDataColumnNames = "login, emailaddress, avatar, active, admin, fave, lastupdated, token, secret, hash"
View Source
const DbUserPk = "Uid"
View Source
const DbUserTableName = "users"

DbUserTableName is the default name for this table.

View Source
const HookColumnNames = "" /* 258-byte string literal not displayed */
View Source
const HookDataColumnNames = "" /* 254-byte string literal not displayed */
View Source
const HookPk = "Id"
View Source
const HookTableName = "hooks"

HookTableName is the default name for this table.

View Source
const IssueColumnNames = "id, number, date, title, bigbody, assignee, state, labels"
View Source
const IssueDataColumnNames = "number, date, title, bigbody, assignee, state, labels"
View Source
const IssuePk = "Id"
View Source
const IssueTableName = "issues"

IssueTableName is the default name for this table.

View Source
const NumAssociationColumns = 6
View Source
const NumAssociationDataColumns = 5
View Source
const NumDbCompoundColumns = 3
View Source
const NumDbCompoundDataColumns = 3
View Source
const NumDbUserColumns = 11
View Source
const NumDbUserDataColumns = 10
View Source
const NumHookColumns = 17
View Source
const NumHookDataColumns = 16
View Source
const NumIssueColumns = 8
View Source
const NumIssueDataColumns = 7
View Source
const NumV3UserColumns = 11
View Source
const NumV3UserDataColumns = 10
View Source
const V2UserColumnNames = "uid, login, emailaddress, avatar, active, admin, fave, lastupdated, token, secret, hash"
View Source
const V2UserTableName = "users"

V2UserTableName is the default name for this table.

View Source
const V3UserDataColumnNames = "login, emailaddress, avatar, active, admin, fave, lastupdated, token, secret, hash"
View Source
const V3UserPk = "Uid"
View Source
const V3UserTableName = "users"

V3UserTableName is the default name for this table.

View Source
const V4UserTableName = "users"

V4UserTableName is the default name for this table.

Variables

This section is empty.

Functions

This section is empty.

Types

type Association

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

type AssociationTable

type AssociationTable struct {
	Prefix, Name string
	Db           sqlgen2.Execer
	Ctx          context.Context
	Dialect      schema.Dialect
	Logger       *log.Logger
}

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 NewAssociationTable

func NewAssociationTable(name string, d sqlgen2.Execer, dialect schema.Dialect) AssociationTable

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

func (AssociationTable) BeginTx

func (tbl AssociationTable) BeginTx(opts *sql.TxOptions) (AssociationTable, error)

Begin starts a transaction. The default isolation level is dependent on the driver.

func (AssociationTable) Count

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

Count counts the Associations in the table that match a 'where' clause.

func (AssociationTable) CountSA

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

CountSA counts Associations in the table that match a 'where' clause.

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

func (tbl AssociationTable) Delete(where where.Expression) (int64, error)

Delete deletes one or more rows from the table, given a 'where' clause.

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(query string, args ...interface{}) (int64, error)

Exec executes a query without returning any rows. The args are for any placeholder parameters in the query. It returns the number of rows affected (of the database drive supports this).

func (AssociationTable) FullName

func (tbl AssociationTable) FullName() string

FullName gets the concatenated prefix and table name.

func (AssociationTable) GetAssociation

func (tbl AssociationTable) GetAssociation(id int64) (*Association, error)

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

func (AssociationTable) Insert

func (tbl AssociationTable) Insert(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(Execer) 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) Query

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

Query is the low-level access function for Associations.

func (AssociationTable) QueryOne

func (tbl AssociationTable) QueryOne(query string, args ...interface{}) (*Association, error)

QueryOne is the low-level access function for one Association. If the query selected many rows, only the first is returned; the rest are discarded. If not found, *Association will be nil.

func (AssociationTable) Select

func (tbl AssociationTable) Select(where where.Expression, orderBy string) ([]*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 'orderBy'; otherwise use a blank string.

func (AssociationTable) SelectOne

func (tbl AssociationTable) SelectOne(where where.Expression, orderBy string) (*Association, error)

SelectOne allows a single Association to be obtained from the sqlgen2. Any order, limit or offset clauses can be supplied in 'orderBy'; otherwise use a blank string. If not found, *Example will be nil.

func (AssociationTable) SelectOneSA

func (tbl AssociationTable) SelectOneSA(where, orderBy string, args ...interface{}) (*Association, error)

SelectOneSA allows a single Association 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'; otherwise use a blank string. If not found, *Association will be nil.

func (AssociationTable) SelectSA

func (tbl AssociationTable) SelectSA(where, orderBy string, args ...interface{}) ([]*Association, error)

SelectSA allows Associations to be obtained from the table that match a 'where' clause. Any order, limit or offset clauses can be supplied in 'orderBy'; otherwise use a blank string.

func (AssociationTable) SetLogger

func (tbl AssociationTable) SetLogger(logger *log.Logger) sqlgen2.Table

SetLogger sets the logger for subsequent queries, returning the interface.

func (AssociationTable) SliceCategory

func (tbl AssociationTable) SliceCategory(where where.Expression, orderBy string) ([]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 'orderBy'; otherwise use a blank string.

func (AssociationTable) SliceId

func (tbl AssociationTable) SliceId(where where.Expression, orderBy string) ([]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 'orderBy'; otherwise use a blank string.

func (AssociationTable) SliceName

func (tbl AssociationTable) SliceName(where where.Expression, orderBy string) ([]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 'orderBy'; otherwise use a blank string.

func (AssociationTable) SliceQuality

func (tbl AssociationTable) SliceQuality(where where.Expression, orderBy string) ([]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 'orderBy'; otherwise use a blank string.

func (AssociationTable) SliceRef1

func (tbl AssociationTable) SliceRef1(where where.Expression, orderBy string) ([]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 'orderBy'; otherwise use a blank string.

func (AssociationTable) SliceRef2

func (tbl AssociationTable) SliceRef2(where where.Expression, orderBy string) ([]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 'orderBy'; otherwise use a blank string.

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(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(where where.Expression, fields ...sql.NamedArg) (int64, error)

UpdateFields updates one or more columns, given a 'where' clause.

func (AssociationTable) WithContext

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

WithContext sets the context for subsequent queries.

func (AssociationTable) WithLogger

func (tbl AssociationTable) WithLogger(logger *log.Logger) AssociationTable

WithLogger sets the logger for subsequent queries.

func (AssociationTable) WithPrefix

func (tbl AssociationTable) WithPrefix(pfx string) AssociationTable

WithPrefix sets the prefix for subsequent queries.

type Author

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

type Category

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

type Commit

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

type Compound

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

type Date

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

type Dates

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

type DbCompoundTable

type DbCompoundTable struct {
	Prefix, Name string
	Db           sqlgen2.Execer
	Ctx          context.Context
	Dialect      schema.Dialect
	Logger       *log.Logger
}

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 NewDbCompoundTable

func NewDbCompoundTable(name string, d sqlgen2.Execer, dialect schema.Dialect) DbCompoundTable

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

func (DbCompoundTable) BeginTx

func (tbl DbCompoundTable) BeginTx(opts *sql.TxOptions) (DbCompoundTable, error)

Begin starts a transaction. The default isolation level is dependent on the driver.

func (DbCompoundTable) Count

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

Count counts the Compounds in the table that match a 'where' clause.

func (DbCompoundTable) CountSA

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

CountSA counts Compounds in the table that match a 'where' clause.

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

func (tbl DbCompoundTable) Delete(where where.Expression) (int64, error)

Delete deletes one or more rows from the table, given a 'where' clause.

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(query string, args ...interface{}) (int64, error)

Exec executes a query without returning any rows. The args are for any placeholder parameters in the query. It returns the number of rows affected (of the database drive supports this).

func (DbCompoundTable) FullName

func (tbl DbCompoundTable) FullName() string

FullName gets the concatenated prefix and table name.

func (DbCompoundTable) Insert

func (tbl DbCompoundTable) Insert(vv ...*Compound) error

Insert adds new records for the Compounds. The Compound.PreInsert(Execer) 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) Query

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

Query is the low-level access function for Compounds.

func (DbCompoundTable) QueryOne

func (tbl DbCompoundTable) QueryOne(query string, args ...interface{}) (*Compound, error)

QueryOne is the low-level access function for one Compound. If the query selected many rows, only the first is returned; the rest are discarded. If not found, *Compound will be nil.

func (DbCompoundTable) Select

func (tbl DbCompoundTable) Select(where where.Expression, orderBy string) ([]*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 'orderBy'; otherwise use a blank string.

func (DbCompoundTable) SelectOne

func (tbl DbCompoundTable) SelectOne(where where.Expression, orderBy string) (*Compound, error)

SelectOne allows a single Compound to be obtained from the sqlgen2. Any order, limit or offset clauses can be supplied in 'orderBy'; otherwise use a blank string. If not found, *Example will be nil.

func (DbCompoundTable) SelectOneSA

func (tbl DbCompoundTable) SelectOneSA(where, orderBy string, args ...interface{}) (*Compound, error)

SelectOneSA allows a single Compound 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'; otherwise use a blank string. If not found, *Compound will be nil.

func (DbCompoundTable) SelectSA

func (tbl DbCompoundTable) SelectSA(where, orderBy string, args ...interface{}) ([]*Compound, error)

SelectSA allows Compounds to be obtained from the table that match a 'where' clause. Any order, limit or offset clauses can be supplied in 'orderBy'; otherwise use a blank string.

func (DbCompoundTable) SetLogger

func (tbl DbCompoundTable) SetLogger(logger *log.Logger) sqlgen2.Table

SetLogger sets the logger for subsequent queries, returning the interface.

func (DbCompoundTable) SliceAlpha

func (tbl DbCompoundTable) SliceAlpha(where where.Expression, orderBy string) ([]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 'orderBy'; otherwise use a blank string.

func (DbCompoundTable) SliceBeta

func (tbl DbCompoundTable) SliceBeta(where where.Expression, orderBy string) ([]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 'orderBy'; otherwise use a blank string.

func (DbCompoundTable) SliceCategory

func (tbl DbCompoundTable) SliceCategory(where where.Expression, orderBy string) ([]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 'orderBy'; otherwise use a blank string.

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(where where.Expression, fields ...sql.NamedArg) (int64, error)

UpdateFields updates one or more columns, given a 'where' clause.

func (DbCompoundTable) WithContext

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

WithContext sets the context for subsequent queries.

func (DbCompoundTable) WithLogger

func (tbl DbCompoundTable) WithLogger(logger *log.Logger) DbCompoundTable

WithLogger sets the logger for subsequent queries.

func (DbCompoundTable) WithPrefix

func (tbl DbCompoundTable) WithPrefix(pfx string) DbCompoundTable

WithPrefix sets the prefix for subsequent queries.

type DbUserTable

type DbUserTable struct {
	Prefix, Name string
	Db           sqlgen2.Execer
	Ctx          context.Context
	Dialect      schema.Dialect
	Logger       *log.Logger
}

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 NewDbUserTable

func NewDbUserTable(name string, d sqlgen2.Execer, dialect schema.Dialect) DbUserTable

NewDbUserTable returns a new table instance. If a blank table name is supplied, the default name "users" will be used instead. The table name prefix is initially blank and the request context is the background.

func (DbUserTable) BeginTx

func (tbl DbUserTable) BeginTx(opts *sql.TxOptions) (DbUserTable, error)

Begin starts a transaction. The default isolation level is dependent on the driver.

func (DbUserTable) Count

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

Count counts the Users in the table that match a 'where' clause.

func (DbUserTable) CountSA

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

CountSA counts Users in the table that match a 'where' clause.

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

func (tbl DbUserTable) CreateUserEmailIndex(ifNotExist bool) error

CreateUserEmailIndex creates the user_email index.

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

func (tbl DbUserTable) Delete(where where.Expression) (int64, error)

Delete deletes one or more rows from the table, given a 'where' clause.

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

func (tbl DbUserTable) DropUserEmailIndex(ifExists bool) error

DropUserEmailIndex drops the user_email index.

func (DbUserTable) DropUserLoginIndex

func (tbl DbUserTable) DropUserLoginIndex(ifExists bool) error

DropUserLoginIndex drops the user_login index.

func (DbUserTable) Exec

func (tbl DbUserTable) Exec(query string, args ...interface{}) (int64, error)

Exec executes a query without returning any rows. The args are for any placeholder parameters in the query. It returns the number of rows affected (of the database drive supports this).

func (DbUserTable) FullName

func (tbl DbUserTable) FullName() string

FullName gets the concatenated prefix and table name.

func (DbUserTable) GetUser

func (tbl DbUserTable) GetUser(id int64) (*User, error)

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

func (DbUserTable) Insert

func (tbl DbUserTable) Insert(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(Execer) 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) Query

func (tbl DbUserTable) Query(query string, args ...interface{}) ([]*User, error)

Query is the low-level access function for Users.

func (DbUserTable) QueryOne

func (tbl DbUserTable) QueryOne(query string, args ...interface{}) (*User, error)

QueryOne is the low-level access function for one User. If the query selected many rows, only the first is returned; the rest are discarded. If not found, *User will be nil.

func (DbUserTable) Select

func (tbl DbUserTable) Select(where where.Expression, orderBy string) ([]*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 'orderBy'; otherwise use a blank string.

func (DbUserTable) SelectOne

func (tbl DbUserTable) SelectOne(where where.Expression, orderBy string) (*User, error)

SelectOne allows a single User to be obtained from the sqlgen2. Any order, limit or offset clauses can be supplied in 'orderBy'; otherwise use a blank string. If not found, *Example will be nil.

func (DbUserTable) SelectOneSA

func (tbl DbUserTable) SelectOneSA(where, orderBy string, args ...interface{}) (*User, error)

SelectOneSA allows a single User 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'; otherwise use a blank string. If not found, *User will be nil.

func (DbUserTable) SelectSA

func (tbl DbUserTable) SelectSA(where, orderBy string, args ...interface{}) ([]*User, error)

SelectSA allows Users to be obtained from the table that match a 'where' clause. Any order, limit or offset clauses can be supplied in 'orderBy'; otherwise use a blank string.

func (DbUserTable) SetLogger

func (tbl DbUserTable) SetLogger(logger *log.Logger) sqlgen2.Table

SetLogger sets the logger for subsequent queries, returning the interface.

func (DbUserTable) SliceActive

func (tbl DbUserTable) SliceActive(where where.Expression, orderBy string) ([]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 'orderBy'; otherwise use a blank string.

func (DbUserTable) SliceAdmin

func (tbl DbUserTable) SliceAdmin(where where.Expression, orderBy string) ([]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 'orderBy'; otherwise use a blank string.

func (DbUserTable) SliceAvatar

func (tbl DbUserTable) SliceAvatar(where where.Expression, orderBy string) ([]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 'orderBy'; otherwise use a blank string.

func (DbUserTable) SliceEmailAddress

func (tbl DbUserTable) SliceEmailAddress(where where.Expression, orderBy string) ([]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 'orderBy'; otherwise use a blank string.

func (DbUserTable) SliceLastUpdated

func (tbl DbUserTable) SliceLastUpdated(where where.Expression, orderBy string) ([]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 'orderBy'; otherwise use a blank string.

func (DbUserTable) SliceLogin

func (tbl DbUserTable) SliceLogin(where where.Expression, orderBy string) ([]string, error)

SliceLogin gets the Login column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in 'orderBy'; otherwise use a blank string.

func (DbUserTable) SliceUid

func (tbl DbUserTable) SliceUid(where where.Expression, orderBy string) ([]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 'orderBy'; otherwise use a blank string.

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(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(where where.Expression, fields ...sql.NamedArg) (int64, error)

UpdateFields updates one or more columns, given a 'where' clause.

func (DbUserTable) WithContext

func (tbl DbUserTable) WithContext(ctx context.Context) DbUserTable

WithContext sets the context for subsequent queries.

func (DbUserTable) WithLogger

func (tbl DbUserTable) WithLogger(logger *log.Logger) DbUserTable

WithLogger sets the logger for subsequent queries.

func (DbUserTable) WithPrefix

func (tbl DbUserTable) WithPrefix(pfx string) DbUserTable

WithPrefix sets the prefix for subsequent queries.

type Email

type Email string

type Hook

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

type HookList

type HookList []*Hook

type HookTable

type HookTable struct {
	Prefix, Name string
	Db           sqlgen2.Execer
	Ctx          context.Context
	Dialect      schema.Dialect
	Logger       *log.Logger
}

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 NewHookTable

func NewHookTable(name string, d sqlgen2.Execer, dialect schema.Dialect) HookTable

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

func (HookTable) BeginTx

func (tbl HookTable) BeginTx(opts *sql.TxOptions) (HookTable, error)

Begin starts a transaction. The default isolation level is dependent on the driver.

func (HookTable) Count

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

Count counts the Hooks in the table that match a 'where' clause.

func (HookTable) CountSA

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

CountSA counts Hooks in the table that match a 'where' clause.

func (HookTable) CreateTable

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

CreateTable creates the table.

func (HookTable) DB

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

func (tbl HookTable) Delete(where where.Expression) (int64, error)

Delete deletes one or more rows from the table, given a 'where' clause.

func (HookTable) DropTable

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

DropTable drops the table, destroying all its data.

func (HookTable) Exec

func (tbl HookTable) Exec(query string, args ...interface{}) (int64, error)

Exec executes a query without returning any rows. The args are for any placeholder parameters in the query. It returns the number of rows affected (of the database drive supports this).

func (HookTable) FullName

func (tbl HookTable) FullName() string

FullName gets the concatenated prefix and table name.

func (HookTable) GetHook

func (tbl HookTable) GetHook(id int64) (*Hook, error)

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

func (HookTable) Insert

func (tbl HookTable) Insert(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(Execer) method will be called, if it exists.

func (HookTable) IsTx

func (tbl HookTable) IsTx() bool

IsTx tests whether this is within a transaction.

func (HookTable) Query

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

Query is the low-level access function for Hooks.

func (HookTable) QueryOne

func (tbl HookTable) QueryOne(query string, args ...interface{}) (*Hook, error)

QueryOne is the low-level access function for one Hook. If the query selected many rows, only the first is returned; the rest are discarded. If not found, *Hook will be nil.

func (HookTable) Select

func (tbl HookTable) Select(where where.Expression, orderBy string) (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 'orderBy'; otherwise use a blank string.

func (HookTable) SelectOne

func (tbl HookTable) SelectOne(where where.Expression, orderBy string) (*Hook, error)

SelectOne allows a single Hook to be obtained from the sqlgen2. Any order, limit or offset clauses can be supplied in 'orderBy'; otherwise use a blank string. If not found, *Example will be nil.

func (HookTable) SelectOneSA

func (tbl HookTable) SelectOneSA(where, orderBy string, args ...interface{}) (*Hook, error)

SelectOneSA allows a single Hook 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'; otherwise use a blank string. If not found, *Hook will be nil.

func (HookTable) SelectSA

func (tbl HookTable) SelectSA(where, orderBy string, args ...interface{}) (HookList, error)

SelectSA allows Hooks to be obtained from the table that match a 'where' clause. Any order, limit or offset clauses can be supplied in 'orderBy'; otherwise use a blank string.

func (HookTable) SetLogger

func (tbl HookTable) SetLogger(logger *log.Logger) sqlgen2.Table

SetLogger sets the logger for subsequent queries, returning the interface.

func (HookTable) SliceCategory

func (tbl HookTable) SliceCategory(where where.Expression, orderBy string) ([]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 'orderBy'; otherwise use a blank string.

func (HookTable) SliceCreated

func (tbl HookTable) SliceCreated(where where.Expression, orderBy string) ([]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 'orderBy'; otherwise use a blank string.

func (HookTable) SliceDeleted

func (tbl HookTable) SliceDeleted(where where.Expression, orderBy string) ([]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 'orderBy'; otherwise use a blank string.

func (HookTable) SliceForced

func (tbl HookTable) SliceForced(where where.Expression, orderBy string) ([]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 'orderBy'; otherwise use a blank string.

func (HookTable) SliceId

func (tbl HookTable) SliceId(where where.Expression, orderBy string) ([]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 'orderBy'; otherwise use a blank string.

func (HookTable) SliceSha

func (tbl HookTable) SliceSha(where where.Expression, orderBy string) ([]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 'orderBy'; otherwise use a blank string.

func (HookTable) Truncate

func (tbl HookTable) Truncate(force bool) (err error)

Truncate drops every record from the table, if possible. It might fail if constraints exist that prevent some or all rows from being deleted; use the force option to override this.

When 'force' is set true, be aware of the following consequences. When using Mysql, foreign keys in other tables can be left dangling. When using Postgres, a cascade happens, so all 'adjacent' tables (i.e. linked by foreign keys) are also truncated.

func (HookTable) Tx

func (tbl HookTable) Tx() *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 (HookTable) Update

func (tbl HookTable) Update(vv ...*Hook) (int64, error)

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

func (HookTable) UpdateFields

func (tbl HookTable) UpdateFields(where where.Expression, fields ...sql.NamedArg) (int64, error)

UpdateFields updates one or more columns, given a 'where' clause.

func (HookTable) WithContext

func (tbl HookTable) WithContext(ctx context.Context) HookTable

WithContext sets the context for subsequent queries.

func (HookTable) WithLogger

func (tbl HookTable) WithLogger(logger *log.Logger) HookTable

WithLogger sets the logger for subsequent queries.

func (HookTable) WithPrefix

func (tbl HookTable) WithPrefix(pfx string) HookTable

WithPrefix sets the prefix for subsequent queries.

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
}

type IssueTable

type IssueTable struct {
	Prefix, Name string
	Db           sqlgen2.Execer
	Ctx          context.Context
	Dialect      schema.Dialect
	Logger       *log.Logger
}

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 NewIssueTable

func NewIssueTable(name string, d sqlgen2.Execer, dialect schema.Dialect) IssueTable

NewIssueTable returns a new table instance. If a blank table name is supplied, the default name "issues" will be used instead. The table name prefix is initially blank and the request context is the background.

func (IssueTable) BeginTx

func (tbl IssueTable) BeginTx(opts *sql.TxOptions) (IssueTable, error)

Begin starts a transaction. The default isolation level is dependent on the driver.

func (IssueTable) Count

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

Count counts the Issues in the table that match a 'where' clause.

func (IssueTable) CountSA

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

CountSA counts Issues in the table that match a 'where' clause.

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

func (tbl IssueTable) Delete(where where.Expression) (int64, error)

Delete deletes one or more rows from the table, given a 'where' clause.

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(query string, args ...interface{}) (int64, error)

Exec executes a query without returning any rows. The args are for any placeholder parameters in the query. It returns the number of rows affected (of the database drive supports this).

func (IssueTable) FullName

func (tbl IssueTable) FullName() string

FullName gets the concatenated prefix and table name.

func (IssueTable) GetIssue

func (tbl IssueTable) GetIssue(id int64) (*Issue, error)

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

func (IssueTable) Insert

func (tbl IssueTable) Insert(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(Execer) 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{}) ([]*Issue, error)

Query is the low-level access function for Issues.

func (IssueTable) QueryOne

func (tbl IssueTable) QueryOne(query string, args ...interface{}) (*Issue, error)

QueryOne is the low-level access function for one Issue. If the query selected many rows, only the first is returned; the rest are discarded. If not found, *Issue will be nil.

func (IssueTable) Select

func (tbl IssueTable) Select(where where.Expression, orderBy string) ([]*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 'orderBy'; otherwise use a blank string.

func (IssueTable) SelectOne

func (tbl IssueTable) SelectOne(where where.Expression, orderBy string) (*Issue, error)

SelectOne allows a single Issue to be obtained from the sqlgen2. Any order, limit or offset clauses can be supplied in 'orderBy'; otherwise use a blank string. If not found, *Example will be nil.

func (IssueTable) SelectOneSA

func (tbl IssueTable) SelectOneSA(where, orderBy string, args ...interface{}) (*Issue, error)

SelectOneSA allows a single Issue 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'; otherwise use a blank string. If not found, *Issue will be nil.

func (IssueTable) SelectSA

func (tbl IssueTable) SelectSA(where, orderBy string, args ...interface{}) ([]*Issue, error)

SelectSA allows Issues to be obtained from the table that match a 'where' clause. Any order, limit or offset clauses can be supplied in 'orderBy'; otherwise use a blank string.

func (IssueTable) SetLogger

func (tbl IssueTable) SetLogger(logger *log.Logger) sqlgen2.Table

SetLogger sets the logger for subsequent queries, returning the interface.

func (IssueTable) SliceAssignee

func (tbl IssueTable) SliceAssignee(where where.Expression, orderBy string) ([]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 'orderBy'; otherwise use a blank string.

func (IssueTable) SliceBody

func (tbl IssueTable) SliceBody(where where.Expression, orderBy string) ([]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 'orderBy'; otherwise use a blank string.

func (IssueTable) SliceDate

func (tbl IssueTable) SliceDate(where where.Expression, orderBy string) ([]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 'orderBy'; otherwise use a blank string.

func (IssueTable) SliceId

func (tbl IssueTable) SliceId(where where.Expression, orderBy string) ([]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 'orderBy'; otherwise use a blank string.

func (IssueTable) SliceNumber

func (tbl IssueTable) SliceNumber(where where.Expression, orderBy string) ([]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 'orderBy'; otherwise use a blank string.

func (IssueTable) SliceState

func (tbl IssueTable) SliceState(where where.Expression, orderBy string) ([]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 'orderBy'; otherwise use a blank string.

func (IssueTable) SliceTitle

func (tbl IssueTable) SliceTitle(where where.Expression, orderBy string) ([]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 'orderBy'; otherwise use a blank string.

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(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(where where.Expression, fields ...sql.NamedArg) (int64, error)

UpdateFields updates one or more columns, given a 'where' clause.

func (IssueTable) WithContext

func (tbl IssueTable) WithContext(ctx context.Context) IssueTable

WithContext sets the context for subsequent queries.

func (IssueTable) WithLogger

func (tbl IssueTable) WithLogger(logger *log.Logger) IssueTable

WithLogger sets the logger for subsequent queries.

func (IssueTable) WithPrefix

func (tbl IssueTable) WithPrefix(pfx string) IssueTable

WithPrefix sets the prefix for subsequent queries.

type User

type User struct {
	Uid          int64  `sql:"pk: true, auto: true"`
	Login        string `sql:"unique: user_login"`
	EmailAddress string `sql:"unique: user_email"`
	Avatar       string
	Active       bool
	Admin        bool
	Fave         big.Int `sql:"encode: json"`
	LastUpdated  int64
	// contains filtered or unexported fields
}

func (*User) PreInsert

func (u *User) PreInsert(sqlgen2.Execer) error

func (*User) PreUpdate

func (u *User) PreUpdate(sqlgen2.Execer) error

type V2UserTable

type V2UserTable struct {
	Prefix, Name string
	Db           sqlgen2.Execer
	Ctx          context.Context
	Dialect      schema.Dialect
	Logger       *log.Logger
}

V2UserTable 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 NewV2UserTable

func NewV2UserTable(name string, d sqlgen2.Execer, dialect schema.Dialect) V2UserTable

NewV2UserTable returns a new table instance. If a blank table name is supplied, the default name "users" will be used instead. The table name prefix is initially blank and the request context is the background.

func (V2UserTable) BeginTx

func (tbl V2UserTable) BeginTx(opts *sql.TxOptions) (V2UserTable, error)

Begin starts a transaction. The default isolation level is dependent on the driver.

func (V2UserTable) Count

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

Count counts the Users in the table that match a 'where' clause.

func (V2UserTable) CountSA

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

CountSA counts Users in the table that match a 'where' clause.

func (V2UserTable) DB

func (tbl V2UserTable) 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 (V2UserTable) Delete

func (tbl V2UserTable) Delete(where where.Expression) (int64, error)

Delete deletes one or more rows from the table, given a 'where' clause.

func (V2UserTable) Exec

func (tbl V2UserTable) Exec(query string, args ...interface{}) (int64, error)

Exec executes a query without returning any rows. The args are for any placeholder parameters in the query. It returns the number of rows affected (of the database drive supports this).

func (V2UserTable) FullName

func (tbl V2UserTable) FullName() string

FullName gets the concatenated prefix and table name.

func (V2UserTable) GetUser

func (tbl V2UserTable) GetUser(id int64) (*User, error)

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

func (V2UserTable) Insert

func (tbl V2UserTable) Insert(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(Execer) method will be called, if it exists.

func (V2UserTable) IsTx

func (tbl V2UserTable) IsTx() bool

IsTx tests whether this is within a transaction.

func (V2UserTable) Query

func (tbl V2UserTable) Query(query string, args ...interface{}) ([]*User, error)

Query is the low-level access function for Users.

func (V2UserTable) QueryOne

func (tbl V2UserTable) QueryOne(query string, args ...interface{}) (*User, error)

QueryOne is the low-level access function for one User. If the query selected many rows, only the first is returned; the rest are discarded. If not found, *User will be nil.

func (V2UserTable) Select

func (tbl V2UserTable) Select(where where.Expression, orderBy string) ([]*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 'orderBy'; otherwise use a blank string.

func (V2UserTable) SelectOne

func (tbl V2UserTable) SelectOne(where where.Expression, orderBy string) (*User, error)

SelectOne allows a single User to be obtained from the sqlgen2. Any order, limit or offset clauses can be supplied in 'orderBy'; otherwise use a blank string. If not found, *Example will be nil.

func (V2UserTable) SelectOneSA

func (tbl V2UserTable) SelectOneSA(where, orderBy string, args ...interface{}) (*User, error)

SelectOneSA allows a single User 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'; otherwise use a blank string. If not found, *User will be nil.

func (V2UserTable) SelectSA

func (tbl V2UserTable) SelectSA(where, orderBy string, args ...interface{}) ([]*User, error)

SelectSA allows Users to be obtained from the table that match a 'where' clause. Any order, limit or offset clauses can be supplied in 'orderBy'; otherwise use a blank string.

func (V2UserTable) SetLogger

func (tbl V2UserTable) SetLogger(logger *log.Logger) sqlgen2.Table

SetLogger sets the logger for subsequent queries, returning the interface.

func (V2UserTable) SliceActive

func (tbl V2UserTable) SliceActive(where where.Expression, orderBy string) ([]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 'orderBy'; otherwise use a blank string.

func (V2UserTable) SliceAdmin

func (tbl V2UserTable) SliceAdmin(where where.Expression, orderBy string) ([]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 'orderBy'; otherwise use a blank string.

func (V2UserTable) SliceAvatar

func (tbl V2UserTable) SliceAvatar(where where.Expression, orderBy string) ([]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 'orderBy'; otherwise use a blank string.

func (V2UserTable) SliceEmailAddress

func (tbl V2UserTable) SliceEmailAddress(where where.Expression, orderBy string) ([]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 'orderBy'; otherwise use a blank string.

func (V2UserTable) SliceLastUpdated

func (tbl V2UserTable) SliceLastUpdated(where where.Expression, orderBy string) ([]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 'orderBy'; otherwise use a blank string.

func (V2UserTable) SliceLogin

func (tbl V2UserTable) SliceLogin(where where.Expression, orderBy string) ([]string, error)

SliceLogin gets the Login column for all rows that match the 'where' condition. Any order, limit or offset clauses can be supplied in 'orderBy'; otherwise use a blank string.

func (V2UserTable) SliceUid

func (tbl V2UserTable) SliceUid(where where.Expression, orderBy string) ([]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 'orderBy'; otherwise use a blank string.

func (V2UserTable) Truncate

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

func (tbl V2UserTable) 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 (V2UserTable) Update

func (tbl V2UserTable) Update(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 (V2UserTable) UpdateFields

func (tbl V2UserTable) UpdateFields(where where.Expression, fields ...sql.NamedArg) (int64, error)

UpdateFields updates one or more columns, given a 'where' clause.

func (V2UserTable) WithContext

func (tbl V2UserTable) WithContext(ctx context.Context) V2UserTable

WithContext sets the context for subsequent queries.

func (V2UserTable) WithLogger

func (tbl V2UserTable) WithLogger(logger *log.Logger) V2UserTable

WithLogger sets the logger for subsequent queries.

func (V2UserTable) WithPrefix

func (tbl V2UserTable) WithPrefix(pfx string) V2UserTable

WithPrefix sets the prefix for subsequent queries.

type V3UserTable

type V3UserTable struct {
	Prefix, Name string
	Db           sqlgen2.Execer
	Ctx          context.Context
	Dialect      schema.Dialect
	Logger       *log.Logger
}

V3UserTable 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 NewV3UserTable

func NewV3UserTable(name string, d sqlgen2.Execer, dialect schema.Dialect) V3UserTable

NewV3UserTable returns a new table instance. If a blank table name is supplied, the default name "users" will be used instead. The table name prefix is initially blank and the request context is the background.

func (V3UserTable) BeginTx

func (tbl V3UserTable) BeginTx(opts *sql.TxOptions) (V3UserTable, error)

Begin starts a transaction. The default isolation level is dependent on the driver.

func (V3UserTable) CreateIndexes

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

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

func (V3UserTable) CreateTable

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

CreateTable creates the table.

func (V3UserTable) CreateTableWithIndexes

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

CreateTableWithIndexes invokes CreateTable then CreateIndexes.

func (V3UserTable) CreateUserEmailIndex

func (tbl V3UserTable) CreateUserEmailIndex(ifNotExist bool) error

CreateUserEmailIndex creates the user_email index.

func (V3UserTable) CreateUserLoginIndex

func (tbl V3UserTable) CreateUserLoginIndex(ifNotExist bool) error

CreateUserLoginIndex creates the user_login index.

func (V3UserTable) DB

func (tbl V3UserTable) 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 (V3UserTable) DropIndexes

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

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

func (V3UserTable) DropTable

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

DropTable drops the table, destroying all its data.

func (V3UserTable) DropUserEmailIndex

func (tbl V3UserTable) DropUserEmailIndex(ifExists bool) error

DropUserEmailIndex drops the user_email index.

func (V3UserTable) DropUserLoginIndex

func (tbl V3UserTable) DropUserLoginIndex(ifExists bool) error

DropUserLoginIndex drops the user_login index.

func (V3UserTable) Exec

func (tbl V3UserTable) Exec(query string, args ...interface{}) (int64, error)

Exec executes a query without returning any rows. The args are for any placeholder parameters in the query. It returns the number of rows affected (of the database drive supports this).

func (V3UserTable) FullName

func (tbl V3UserTable) FullName() string

FullName gets the concatenated prefix and table name.

func (V3UserTable) IsTx

func (tbl V3UserTable) IsTx() bool

IsTx tests whether this is within a transaction.

func (V3UserTable) Query

func (tbl V3UserTable) Query(query string, args ...interface{}) ([]*User, error)

Query is the low-level access function for Users.

func (V3UserTable) QueryOne

func (tbl V3UserTable) QueryOne(query string, args ...interface{}) (*User, error)

QueryOne is the low-level access function for one User. If the query selected many rows, only the first is returned; the rest are discarded. If not found, *User will be nil.

func (V3UserTable) SetLogger

func (tbl V3UserTable) SetLogger(logger *log.Logger) sqlgen2.Table

SetLogger sets the logger for subsequent queries, returning the interface.

func (V3UserTable) Tx

func (tbl V3UserTable) 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 (V3UserTable) WithContext

func (tbl V3UserTable) WithContext(ctx context.Context) V3UserTable

WithContext sets the context for subsequent queries.

func (V3UserTable) WithLogger

func (tbl V3UserTable) WithLogger(logger *log.Logger) V3UserTable

WithLogger sets the logger for subsequent queries.

func (V3UserTable) WithPrefix

func (tbl V3UserTable) WithPrefix(pfx string) V3UserTable

WithPrefix sets the prefix for subsequent queries.

type V4UserTable

type V4UserTable struct {
	Prefix, Name string
	Db           sqlgen2.Execer
	Ctx          context.Context
	Dialect      schema.Dialect
	Logger       *log.Logger
}

V4UserTable 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 NewV4UserTable

func NewV4UserTable(name string, d sqlgen2.Execer, dialect schema.Dialect) V4UserTable

NewV4UserTable returns a new table instance. If a blank table name is supplied, the default name "users" will be used instead. The table name prefix is initially blank and the request context is the background.

func (V4UserTable) BeginTx

func (tbl V4UserTable) BeginTx(opts *sql.TxOptions) (V4UserTable, error)

Begin starts a transaction. The default isolation level is dependent on the driver.

func (V4UserTable) DB

func (tbl V4UserTable) 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 (V4UserTable) Exec

func (tbl V4UserTable) Exec(query string, args ...interface{}) (int64, error)

Exec executes a query without returning any rows. The args are for any placeholder parameters in the query. It returns the number of rows affected (of the database drive supports this).

func (V4UserTable) FullName

func (tbl V4UserTable) FullName() string

FullName gets the concatenated prefix and table name.

func (V4UserTable) IsTx

func (tbl V4UserTable) IsTx() bool

IsTx tests whether this is within a transaction.

func (V4UserTable) Query

func (tbl V4UserTable) Query(query string, args ...interface{}) ([]*User, error)

Query is the low-level access function for Users.

func (V4UserTable) QueryOne

func (tbl V4UserTable) QueryOne(query string, args ...interface{}) (*User, error)

QueryOne is the low-level access function for one User. If the query selected many rows, only the first is returned; the rest are discarded. If not found, *User will be nil.

func (V4UserTable) SetLogger

func (tbl V4UserTable) SetLogger(logger *log.Logger) sqlgen2.Table

SetLogger sets the logger for subsequent queries, returning the interface.

func (V4UserTable) Tx

func (tbl V4UserTable) 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 (V4UserTable) WithContext

func (tbl V4UserTable) WithContext(ctx context.Context) V4UserTable

WithContext sets the context for subsequent queries.

func (V4UserTable) WithLogger

func (tbl V4UserTable) WithLogger(logger *log.Logger) V4UserTable

WithLogger sets the logger for subsequent queries.

func (V4UserTable) WithPrefix

func (tbl V4UserTable) WithPrefix(pfx string) V4UserTable

WithPrefix sets the prefix for subsequent queries.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL