package bun
Import Path
github.com/uptrace/bun (on go.dev )
Dependency Relation
imports 18 packages , and imported by 3 packages
Package-Level Type Names (total 67, in which 42 are exported)
/* sort exporteds by: alphabet | popularity */
type AddColumnQuery (struct)
Fields (total 12, none are exported )
/* 12 unexporteds ... */ /* 12 unexporteds: */
baseQuery baseQuery
baseQuery .columns []schema .QueryWithArgs
baseQuery .conn IConn
baseQuery .db *DB
baseQuery .err error
baseQuery .flags internal .Flag
baseQuery .model model
baseQuery .modelTable schema .QueryWithArgs
baseQuery .table *schema .Table
baseQuery .tableModel tableModel
baseQuery .tables []schema .QueryWithArgs
baseQuery .with []withQuery
Methods (total 42, in which 12 are exported )
(*T) AppendNamedArg (fmter schema .Formatter , b []byte , name string ) ([]byte , bool )
(*T) AppendQuery (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) ColumnExpr (query string , args ...interface{}) *AddColumnQuery
(*T) Conn (db IConn ) *AddColumnQuery
(*T) DB () *DB
(*T) Exec (ctx context .Context , dest ...interface{}) (sql .Result , error )
(*T) GetModel () Model
(*T) Model (model interface{}) *AddColumnQuery
(*T) ModelTableExpr (query string , args ...interface{}) *AddColumnQuery
(*T) Operation () string
(*T) Table (tables ...string ) *AddColumnQuery
(*T) TableExpr (query string , args ...interface{}) *AddColumnQuery
/* 30 unexporteds ... */ /* 30 unexporteds: */
(*T) _appendFirstTable (fmter schema .Formatter , b []byte , withAlias bool ) ([]byte , error )
(*T) _appendTables (fmter schema .Formatter , b []byte , withAlias bool ) (_ []byte , err error )
(*T) _excludeColumn (column string ) bool
(*T) _getFields (omitPK bool ) ([]*schema .Field , error )
(*T) addColumn (column schema .QueryWithArgs )
(*T) addTable (table schema .QueryWithArgs )
(*T) addWith (name string , query schema .QueryAppender )
(*T) appendColumns (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendFirstTable (fmter schema .Formatter , b []byte ) ([]byte , error )
(*T) appendFirstTableWithAlias (fmter schema .Formatter , b []byte ) ([]byte , error )
(*T) appendOtherTables (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendTables (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendTablesWithAlias (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendWith (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) checkSoftDelete () error
(*T) excludeColumn (columns []string )
(*T) exec (ctx context .Context , queryApp schema .Query , query string ) (sql .Result , error )
(*T) getDataFields () ([]*schema .Field , error )
(*T) getFields () ([]*schema .Field , error )
(*T) getModel (dest []interface{}) (model , error )
(*T) hasMultiTables () bool
(*T) hasTables () bool
(*T) isSoftDelete () bool
(*T) modelHasTableName () bool
(*T) scan (ctx context .Context , queryApp schema .Query , query string , model model , hasDest bool ) (sql .Result , error )
(*T) setConn (db IConn )
(*T) setErr (err error )
(*T) setTableModel (modeli interface{})
TODO: rename to setModel
(*T) whereAllWithDeleted ()
AllWithDeleted changes query to return all rows including soft deleted ones.
(*T) whereDeleted ()
Deleted adds `WHERE deleted_at IS NOT NULL` clause for soft deleted models.
Implements (at least 3, all are exported )
*T : github.com/uptrace/bun/schema.NamedArgAppender
*T : github.com/uptrace/bun/schema.Query
*T : github.com/uptrace/bun/schema.QueryAppender
As Outputs Of (at least 11, all are exported )
func NewAddColumnQuery (db *DB ) *AddColumnQuery
func (*AddColumnQuery).ColumnExpr (query string , args ...interface{}) *AddColumnQuery
func (*AddColumnQuery).Conn (db IConn ) *AddColumnQuery
func (*AddColumnQuery).Model (model interface{}) *AddColumnQuery
func (*AddColumnQuery).ModelTableExpr (query string , args ...interface{}) *AddColumnQuery
func (*AddColumnQuery).Table (tables ...string ) *AddColumnQuery
func (*AddColumnQuery).TableExpr (query string , args ...interface{}) *AddColumnQuery
func Conn .NewAddColumn () *AddColumnQuery
func (*DB ).NewAddColumn () *AddColumnQuery
func IDB .NewAddColumn () *AddColumnQuery
func Tx .NewAddColumn () *AddColumnQuery
type Conn (struct)
Fields (total 6, in which 1 are exported )
Conn *sql .Conn
/* 5 unexporteds ... */ /* 5 unexporteds: */
Conn .closemu sync .RWMutex
closemu prevents the connection from closing while there
is an active query. It is held for read during queries
and exclusively during close.
Conn .db *sql .DB
Conn .dc *sql .driverConn
dc is owned until close, at which point
it's returned to the connection pool.
Conn .done int32
done transitions from 0 to 1 exactly once, on close.
Once done, all operations fail with ErrConnDone.
Use atomic operations on value when checking value.
db *DB
Methods (total 24, in which 20 are exported )
( T) BeginTx (ctx context .Context , opts *sql .TxOptions ) (*sql .Tx , error )
BeginTx starts a transaction.
The provided context is used until the transaction is committed or rolled back.
If the context is canceled, the sql package will roll back
the transaction. Tx.Commit will return an error if the context provided to
BeginTx is canceled.
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.
( T) Close () error
Close returns the connection to the connection pool.
All operations after a Close will return with ErrConnDone.
Close is safe to call concurrently with other operations and will
block until all other operations finish. It may be useful to first
cancel any used context and then call close directly after.
( T) ExecContext (ctx context .Context , query string , args ...interface{}) (sql .Result , error )
( T) NewAddColumn () *AddColumnQuery
( T) NewCreateIndex () *CreateIndexQuery
( T) NewCreateTable () *CreateTableQuery
( T) NewDelete () *DeleteQuery
( T) NewDropColumn () *DropColumnQuery
( T) NewDropIndex () *DropIndexQuery
( T) NewDropTable () *DropTableQuery
( T) NewInsert () *InsertQuery
( T) NewSelect () *SelectQuery
( T) NewTruncateTable () *TruncateTableQuery
( T) NewUpdate () *UpdateQuery
( T) NewValues (model interface{}) *ValuesQuery
( T) PingContext (ctx context .Context ) error
PingContext verifies the connection to the database is still alive.
( T) PrepareContext (ctx context .Context , query string ) (*sql .Stmt , error )
PrepareContext creates a prepared statement for later queries or executions.
Multiple queries or executions may be run concurrently from the
returned statement.
The caller must call the statement's Close method
when the statement is no longer needed.
The provided context is used for the preparation of the statement, not for the
execution of the statement.
( T) QueryContext (ctx context .Context , query string , args ...interface{}) (*sql .Rows , error )
( T) QueryRowContext (ctx context .Context , query string , args ...interface{}) *sql .Row
( T) Raw (f func(driverConn interface{}) error ) (err error )
Raw executes f exposing the underlying driver connection for the
duration of f. The driverConn must not be used outside of f.
Once f returns and err is nil, the Conn will continue to be usable
until Conn.Close is called.
/* 4 unexporteds ... */ /* 4 unexporteds: */
( T) close (err error ) error
( T) closemuRUnlockCondReleaseConn (err error )
closemuRUnlockCondReleaseConn read unlocks closemu
as the sql operation is done with the dc.
( T) grabConn (context .Context ) (*sql .driverConn , sql .releaseConn , error )
grabConn takes a context to implement stmtConnGrabber
but the context is not used.
( T) txCtx () context .Context
Implements (at least 4, in which 3 are exported )
T : IConn
T : IDB
T : io.Closer
/* at least one unexported ... */ /* at least one unexported: */
T : database/sql.stmtConnGrabber
As Outputs Of (at least one exported )
func (*DB ).Conn (ctx context .Context ) (Conn , error )
type CreateIndexQuery (struct)
Fields (total 22, none are exported )
/* 22 unexporteds ... */ /* 22 unexporteds: */
concurrently bool
fulltext bool
ifNotExists bool
include []schema .QueryWithArgs
index schema .QueryWithArgs
spatial bool
unique bool
using schema .QueryWithArgs
whereBaseQuery whereBaseQuery
whereBaseQuery .baseQuery baseQuery
whereBaseQuery .baseQuery .columns []schema .QueryWithArgs
whereBaseQuery .baseQuery .conn IConn
whereBaseQuery .baseQuery .db *DB
whereBaseQuery .baseQuery .err error
whereBaseQuery .baseQuery .flags internal .Flag
whereBaseQuery .baseQuery .model model
whereBaseQuery .baseQuery .modelTable schema .QueryWithArgs
whereBaseQuery .baseQuery .table *schema .Table
whereBaseQuery .baseQuery .tableModel tableModel
whereBaseQuery .baseQuery .tables []schema .QueryWithArgs
whereBaseQuery .baseQuery .with []withQuery
whereBaseQuery .where []schema .QueryWithSep
Methods (total 61, in which 24 are exported )
(*T) AppendNamedArg (fmter schema .Formatter , b []byte , name string ) ([]byte , bool )
(*T) AppendQuery (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) Column (columns ...string ) *CreateIndexQuery
(*T) ColumnExpr (query string , args ...interface{}) *CreateIndexQuery
(*T) Concurrently () *CreateIndexQuery
(*T) Conn (db IConn ) *CreateIndexQuery
(*T) DB () *DB
(*T) ExcludeColumn (columns ...string ) *CreateIndexQuery
(*T) Exec (ctx context .Context , dest ...interface{}) (sql .Result , error )
(*T) GetModel () Model
(*T) IfNotExists () *CreateIndexQuery
(*T) Include (columns ...string ) *CreateIndexQuery
(*T) IncludeExpr (query string , args ...interface{}) *CreateIndexQuery
(*T) Index (query string ) *CreateIndexQuery
(*T) IndexExpr (query string , args ...interface{}) *CreateIndexQuery
(*T) Model (model interface{}) *CreateIndexQuery
(*T) ModelTableExpr (query string , args ...interface{}) *CreateIndexQuery
(*T) Operation () string
(*T) Table (tables ...string ) *CreateIndexQuery
(*T) TableExpr (query string , args ...interface{}) *CreateIndexQuery
(*T) Unique () *CreateIndexQuery
(*T) Using (query string , args ...interface{}) *CreateIndexQuery
(*T) Where (query string , args ...interface{}) *CreateIndexQuery
(*T) WhereOr (query string , args ...interface{}) *CreateIndexQuery
/* 37 unexporteds ... */ /* 37 unexporteds: */
(*T) _appendFirstTable (fmter schema .Formatter , b []byte , withAlias bool ) ([]byte , error )
(*T) _appendTables (fmter schema .Formatter , b []byte , withAlias bool ) (_ []byte , err error )
(*T) _excludeColumn (column string ) bool
(*T) _getFields (omitPK bool ) ([]*schema .Field , error )
(*T) addColumn (column schema .QueryWithArgs )
(*T) addTable (table schema .QueryWithArgs )
(*T) addWhere (where schema .QueryWithSep )
(*T) addWhereGroup (sep string , where []schema .QueryWithSep )
(*T) addWith (name string , query schema .QueryAppender )
(*T) appendColumns (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendFirstTable (fmter schema .Formatter , b []byte ) ([]byte , error )
(*T) appendFirstTableWithAlias (fmter schema .Formatter , b []byte ) ([]byte , error )
(*T) appendOtherTables (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendTables (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendTablesWithAlias (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendWhere (fmter schema .Formatter , b []byte , withAlias bool ) (_ []byte , err error )
(*T) appendWherePK (fmter schema .Formatter , b []byte , withAlias bool ) (_ []byte , err error )
(*T) appendWherePKSlice (fmter schema .Formatter , b []byte , model *sliceTableModel , withAlias bool ) (_ []byte , err error )
(*T) appendWherePKStruct (fmter schema .Formatter , b []byte , model *structTableModel , withAlias bool ) (_ []byte , err error )
(*T) appendWith (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) checkSoftDelete () error
(*T) excludeColumn (columns []string )
(*T) exec (ctx context .Context , queryApp schema .Query , query string ) (sql .Result , error )
(*T) getDataFields () ([]*schema .Field , error )
(*T) getFields () ([]*schema .Field , error )
(*T) getModel (dest []interface{}) (model , error )
(*T) hasMultiTables () bool
(*T) hasTables () bool
(*T) isSoftDelete () bool
(*T) modelHasTableName () bool
(*T) mustAppendWhere (fmter schema .Formatter , b []byte , withAlias bool ) ([]byte , error )
(*T) scan (ctx context .Context , queryApp schema .Query , query string , model model , hasDest bool ) (sql .Result , error )
(*T) setConn (db IConn )
(*T) setErr (err error )
(*T) setTableModel (modeli interface{})
TODO: rename to setModel
(*T) whereAllWithDeleted ()
AllWithDeleted changes query to return all rows including soft deleted ones.
(*T) whereDeleted ()
Deleted adds `WHERE deleted_at IS NOT NULL` clause for soft deleted models.
Implements (at least 3, all are exported )
*T : github.com/uptrace/bun/schema.NamedArgAppender
*T : github.com/uptrace/bun/schema.Query
*T : github.com/uptrace/bun/schema.QueryAppender
As Outputs Of (at least 23, all are exported )
func NewCreateIndexQuery (db *DB ) *CreateIndexQuery
func Conn .NewCreateIndex () *CreateIndexQuery
func (*CreateIndexQuery).Column (columns ...string ) *CreateIndexQuery
func (*CreateIndexQuery).ColumnExpr (query string , args ...interface{}) *CreateIndexQuery
func (*CreateIndexQuery).Concurrently () *CreateIndexQuery
func (*CreateIndexQuery).Conn (db IConn ) *CreateIndexQuery
func (*CreateIndexQuery).ExcludeColumn (columns ...string ) *CreateIndexQuery
func (*CreateIndexQuery).IfNotExists () *CreateIndexQuery
func (*CreateIndexQuery).Include (columns ...string ) *CreateIndexQuery
func (*CreateIndexQuery).IncludeExpr (query string , args ...interface{}) *CreateIndexQuery
func (*CreateIndexQuery).Index (query string ) *CreateIndexQuery
func (*CreateIndexQuery).IndexExpr (query string , args ...interface{}) *CreateIndexQuery
func (*CreateIndexQuery).Model (model interface{}) *CreateIndexQuery
func (*CreateIndexQuery).ModelTableExpr (query string , args ...interface{}) *CreateIndexQuery
func (*CreateIndexQuery).Table (tables ...string ) *CreateIndexQuery
func (*CreateIndexQuery).TableExpr (query string , args ...interface{}) *CreateIndexQuery
func (*CreateIndexQuery).Unique () *CreateIndexQuery
func (*CreateIndexQuery).Using (query string , args ...interface{}) *CreateIndexQuery
func (*CreateIndexQuery).Where (query string , args ...interface{}) *CreateIndexQuery
func (*CreateIndexQuery).WhereOr (query string , args ...interface{}) *CreateIndexQuery
func (*DB ).NewCreateIndex () *CreateIndexQuery
func IDB .NewCreateIndex () *CreateIndexQuery
func Tx .NewCreateIndex () *CreateIndexQuery
type CreateTableQuery (struct)
Fields (total 18, none are exported )
/* 18 unexporteds ... */ /* 18 unexporteds: */
baseQuery baseQuery
baseQuery .columns []schema .QueryWithArgs
baseQuery .conn IConn
baseQuery .db *DB
baseQuery .err error
baseQuery .flags internal .Flag
baseQuery .model model
baseQuery .modelTable schema .QueryWithArgs
baseQuery .table *schema .Table
baseQuery .tableModel tableModel
baseQuery .tables []schema .QueryWithArgs
baseQuery .with []withQuery
fks []schema .QueryWithArgs
ifNotExists bool
partitionBy schema .QueryWithArgs
tablespace schema .QueryWithArgs
temp bool
varchar int
Methods (total 52, in which 15 are exported )
(*T) AppendNamedArg (fmter schema .Formatter , b []byte , name string ) ([]byte , bool )
(*T) AppendQuery (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) Conn (db IConn ) *CreateTableQuery
(*T) DB () *DB
(*T) Exec (ctx context .Context , dest ...interface{}) (sql .Result , error )
(*T) ForeignKey (query string , args ...interface{}) *CreateTableQuery
(*T) GetModel () Model
(*T) IfNotExists () *CreateTableQuery
(*T) Model (model interface{}) *CreateTableQuery
(*T) ModelTableExpr (query string , args ...interface{}) *CreateTableQuery
(*T) Operation () string
(*T) Table (tables ...string ) *CreateTableQuery
(*T) TableExpr (query string , args ...interface{}) *CreateTableQuery
(*T) Temp () *CreateTableQuery
(*T) Varchar (n int ) *CreateTableQuery
/* 37 unexporteds ... */ /* 37 unexporteds: */
(*T) _appendFirstTable (fmter schema .Formatter , b []byte , withAlias bool ) ([]byte , error )
(*T) _appendTables (fmter schema .Formatter , b []byte , withAlias bool ) (_ []byte , err error )
(*T) _excludeColumn (column string ) bool
(*T) _getFields (omitPK bool ) ([]*schema .Field , error )
(*T) addColumn (column schema .QueryWithArgs )
(*T) addTable (table schema .QueryWithArgs )
(*T) addWith (name string , query schema .QueryAppender )
(*T) afterCreateTableHook (ctx context .Context ) error
(*T) appenFKConstraints (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendColumns (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendFirstTable (fmter schema .Formatter , b []byte ) ([]byte , error )
(*T) appendFirstTableWithAlias (fmter schema .Formatter , b []byte ) ([]byte , error )
(*T) appendOtherTables (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendPKConstraint (b []byte , pks []*schema .Field ) []byte
(*T) appendSQLType (b []byte , field *schema .Field ) []byte
(*T) appendTables (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendTablesWithAlias (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendUniqueConstraint (fmter schema .Formatter , b []byte , name string , fields ...*schema .Field ) []byte
(*T) appendUniqueConstraints (fmter schema .Formatter , b []byte ) []byte
(*T) appendWith (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) beforeCreateTableHook (ctx context .Context ) error
(*T) checkSoftDelete () error
(*T) excludeColumn (columns []string )
(*T) exec (ctx context .Context , queryApp schema .Query , query string ) (sql .Result , error )
(*T) getDataFields () ([]*schema .Field , error )
(*T) getFields () ([]*schema .Field , error )
(*T) getModel (dest []interface{}) (model , error )
(*T) hasMultiTables () bool
(*T) hasTables () bool
(*T) isSoftDelete () bool
(*T) modelHasTableName () bool
(*T) scan (ctx context .Context , queryApp schema .Query , query string , model model , hasDest bool ) (sql .Result , error )
(*T) setConn (db IConn )
(*T) setErr (err error )
(*T) setTableModel (modeli interface{})
TODO: rename to setModel
(*T) whereAllWithDeleted ()
AllWithDeleted changes query to return all rows including soft deleted ones.
(*T) whereDeleted ()
Deleted adds `WHERE deleted_at IS NOT NULL` clause for soft deleted models.
Implements (at least 3, all are exported )
*T : github.com/uptrace/bun/schema.NamedArgAppender
*T : github.com/uptrace/bun/schema.Query
*T : github.com/uptrace/bun/schema.QueryAppender
As Outputs Of (at least 14, all are exported )
func NewCreateTableQuery (db *DB ) *CreateTableQuery
func Conn .NewCreateTable () *CreateTableQuery
func (*CreateTableQuery).Conn (db IConn ) *CreateTableQuery
func (*CreateTableQuery).ForeignKey (query string , args ...interface{}) *CreateTableQuery
func (*CreateTableQuery).IfNotExists () *CreateTableQuery
func (*CreateTableQuery).Model (model interface{}) *CreateTableQuery
func (*CreateTableQuery).ModelTableExpr (query string , args ...interface{}) *CreateTableQuery
func (*CreateTableQuery).Table (tables ...string ) *CreateTableQuery
func (*CreateTableQuery).TableExpr (query string , args ...interface{}) *CreateTableQuery
func (*CreateTableQuery).Temp () *CreateTableQuery
func (*CreateTableQuery).Varchar (n int ) *CreateTableQuery
func (*DB ).NewCreateTable () *CreateTableQuery
func IDB .NewCreateTable () *CreateTableQuery
func Tx .NewCreateTable () *CreateTableQuery
As Inputs Of (at least 2, both are exported )
func AfterCreateTableHook .AfterCreateTable (ctx context .Context , query *CreateTableQuery ) error
func BeforeCreateTableHook .BeforeCreateTable (ctx context .Context , query *CreateTableQuery ) error
type DB (struct)
Fields (total 29, in which 1 are exported )
DB *sql .DB
/* 28 unexporteds ... */ /* 28 unexporteds: */
DB .cleanerCh chan struct{}
DB .closed bool
DB .connRequests map[uint64 ]chan sql .connRequest
DB .connector driver .Connector
DB .dep map[sql .finalCloser ]sql .depSet
DB .freeConn []*sql .driverConn
DB .lastPut map[*sql .driverConn ]string
// stacktrace of last conn's put; debug only
DB .maxIdleClosed int64
// Total number of connections closed due to idle count.
DB .maxIdleCount int
// zero means defaultMaxIdleConns; negative means 0
DB .maxIdleTime time .Duration
// maximum amount of time a connection may be idle before being closed
DB .maxIdleTimeClosed int64
// Total number of connections closed due to idle time.
DB .maxLifetime time .Duration
// maximum amount of time a connection may be reused
DB .maxLifetimeClosed int64
// Total number of connections closed due to max connection lifetime limit.
DB .maxOpen int
// <= 0 means unlimited
DB .mu sync .Mutex
// protects following fields
DB .nextRequest uint64
// Next key to use in connRequests.
DB .numClosed uint64
numClosed is an atomic counter which represents a total number of
closed connections. Stmt.openStmt checks it before cleaning closed
connections in Stmt.css.
DB .numOpen int
// number of opened and pending open connections
DB .openerCh chan struct{}
Used to signal the need for new connections
a goroutine running connectionOpener() reads on this chan and
maybeOpenNewConnections sends on the chan (one send per needed connection)
It is closed during db.Close(). The close tells the connectionOpener
goroutine to exit.
DB .stop func()
// stop cancels the connection opener.
DB .waitCount int64
// Total number of connections waited for.
DB .waitDuration int64
Atomic access only. At top of struct to prevent mis-alignment
on 32-bit platforms. Of type time.Duration.
// Total time waited for new connections.
dialect schema .Dialect
features feature .Feature
flags internal .Flag
fmter schema .Formatter
queryHooks []QueryHook
stats DBStats
Methods (total 76, in which 44 are exported )
(*T) AddQueryHook (hook QueryHook )
(*T) Begin () (Tx , error )
(*T) BeginTx (ctx context .Context , opts *sql .TxOptions ) (Tx , error )
( T) Close () error
Close closes the database and prevents new queries from starting.
Close then waits for all queries that have started processing on the server
to finish.
It is rare to Close a DB, as the DB handle is meant to be
long-lived and shared between many goroutines.
(*T) Conn (ctx context .Context ) (Conn , error )
(*T) DBStats () DBStats
(*T) Dialect () schema .Dialect
( T) Driver () driver .Driver
Driver returns the database's underlying driver.
(*T) Exec (query string , args ...interface{}) (sql .Result , error )
(*T) ExecContext (ctx context .Context , query string , args ...interface{}) (sql .Result , error )
(*T) Formatter () schema .Formatter
(*T) NewAddColumn () *AddColumnQuery
(*T) NewCreateIndex () *CreateIndexQuery
(*T) NewCreateTable () *CreateTableQuery
(*T) NewDelete () *DeleteQuery
(*T) NewDropColumn () *DropColumnQuery
(*T) NewDropIndex () *DropIndexQuery
(*T) NewDropTable () *DropTableQuery
(*T) NewInsert () *InsertQuery
(*T) NewSelect () *SelectQuery
(*T) NewTruncateTable () *TruncateTableQuery
(*T) NewUpdate () *UpdateQuery
(*T) NewValues (model interface{}) *ValuesQuery
( T) Ping () error
Ping verifies a connection to the database is still alive,
establishing a connection if necessary.
( T) PingContext (ctx context .Context ) error
PingContext verifies a connection to the database is still alive,
establishing a connection if necessary.
(*T) Prepare (query string ) (Stmt , error )
(*T) PrepareContext (ctx context .Context , query string ) (Stmt , error )
(*T) Query (query string , args ...interface{}) (*sql .Rows , error )
(*T) QueryContext (ctx context .Context , query string , args ...interface{}) (*sql .Rows , error )
(*T) QueryRow (query string , args ...interface{}) *sql .Row
(*T) QueryRowContext (ctx context .Context , query string , args ...interface{}) *sql .Row
(*T) RegisterModel (models ...interface{})
(*T) ResetModel (ctx context .Context , models ...interface{}) error
(*T) RunInTx (ctx context .Context , opts *sql .TxOptions , fn func(ctx context .Context , tx Tx ) error ) error
RunInTx runs the function in a transaction. If the function returns an error,
the transaction is rolled back. Otherwise, the transaction is committed.
(*T) ScanRow (ctx context .Context , rows *sql .Rows , dest ...interface{}) error
(*T) ScanRows (ctx context .Context , rows *sql .Rows , dest ...interface{}) error
( T) SetConnMaxIdleTime (d time .Duration )
SetConnMaxIdleTime sets the maximum amount of time a connection may be idle.
Expired connections may be closed lazily before reuse.
If d <= 0, connections are not closed due to a connection's idle time.
( T) SetConnMaxLifetime (d time .Duration )
SetConnMaxLifetime sets the maximum amount of time a connection may be reused.
Expired connections may be closed lazily before reuse.
If d <= 0, connections are not closed due to a connection's age.
( T) SetMaxIdleConns (n int )
SetMaxIdleConns sets the maximum number of connections in the idle
connection pool.
If MaxOpenConns is greater than 0 but less than the new MaxIdleConns,
then the new MaxIdleConns will be reduced to match the MaxOpenConns limit.
If n <= 0, no idle connections are retained.
The default max idle connections is currently 2. This may change in
a future release.
( T) SetMaxOpenConns (n int )
SetMaxOpenConns sets the maximum number of open connections to the database.
If MaxIdleConns is greater than 0 and the new MaxOpenConns is less than
MaxIdleConns, then MaxIdleConns will be reduced to match the new
MaxOpenConns limit.
If n <= 0, then there is no limit on the number of open connections.
The default is 0 (unlimited).
( T) Stats () sql .DBStats
Stats returns database statistics.
(*T) String () string
(*T) Table (typ reflect .Type ) *schema .Table
(*T) WithNamedArg (name string , value interface{}) *DB
/* 32 unexporteds ... */ /* 32 unexporteds: */
( T) addDep (x sql .finalCloser , dep interface{})
addDep notes that x now depends on dep, and x's finalClose won't be
called until all of x's dependencies are removed with removeDep.
( T) addDepLocked (x sql .finalCloser , dep interface{})
(*T) afterQuery (ctx context .Context , event *QueryEvent , res sql .Result , err error )
(*T) afterQueryFromIndex (ctx context .Context , event *QueryEvent , hookIndex int )
(*T) beforeQuery (ctx context .Context , queryApp schema .Query , query string , queryArgs []interface{}) (context .Context , *QueryEvent )
( T) begin (ctx context .Context , opts *sql .TxOptions , strategy sql .connReuseStrategy ) (tx *sql .Tx , err error )
( T) beginDC (ctx context .Context , dc *sql .driverConn , release func(error ), opts *sql .TxOptions ) (tx *sql .Tx , err error )
beginDC starts a transaction. The provided dc must be valid and ready to use.
(*T) clone () *DB
( T) conn (ctx context .Context , strategy sql .connReuseStrategy ) (*sql .driverConn , error )
conn returns a newly-opened or cached *driverConn.
( T) connectionCleaner (d time .Duration )
( T) connectionCleanerRunLocked () (closing []*sql .driverConn )
( T) connectionOpener (ctx context .Context )
Runs in a separate goroutine, opens new connections when requested.
( T) exec (ctx context .Context , query string , args []interface{}, strategy sql .connReuseStrategy ) (sql .Result , error )
( T) execDC (ctx context .Context , dc *sql .driverConn , release func(error ), query string , args []interface{}) (res sql .Result , err error )
(*T) format (query string , args []interface{}) string
(*T) makeQueryBytes () []byte
( T) maxIdleConnsLocked () int
( T) maybeOpenNewConnections ()
Assumes db.mu is locked.
If there are connRequests and the connection limit hasn't been reached,
then tell the connectionOpener to open new connections.
( T) nextRequestKeyLocked () uint64
nextRequestKeyLocked returns the next connection request key.
It is assumed that nextRequest will not overflow.
( T) noteUnusedDriverStatement (c *sql .driverConn , ds *sql .driverStmt )
noteUnusedDriverStatement notes that ds is no longer used and should
be closed whenever possible (when c is next not in use), unless c is
already closed.
( T) openNewConnection (ctx context .Context )
Open one new connection
( T) pingDC (ctx context .Context , dc *sql .driverConn , release func(error )) error
( T) prepare (ctx context .Context , query string , strategy sql .connReuseStrategy ) (*sql .Stmt , error )
( T) prepareDC (ctx context .Context , dc *sql .driverConn , release func(error ), cg sql .stmtConnGrabber , query string ) (*sql .Stmt , error )
prepareDC prepares a query on the driverConn and calls release before
returning. When cg == nil it implies that a connection pool is used, and
when cg != nil only a single driver connection is used.
( T) putConn (dc *sql .driverConn , err error , resetSession bool )
putConn adds a connection to the db's free pool.
err is optionally the last error that occurred on this connection.
( T) putConnDBLocked (dc *sql .driverConn , err error ) bool
Satisfy a connRequest or put the driverConn in the idle pool and return true
or return false.
putConnDBLocked will satisfy a connRequest if there is one, or it will
return the *driverConn to the freeConn list if err == nil and the idle
connection limit will not be exceeded.
If err != nil, the value of dc is ignored.
If err == nil, then dc must not equal nil.
If a connRequest was fulfilled or the *driverConn was placed in the
freeConn list, then true is returned, otherwise false is returned.
( T) query (ctx context .Context , query string , args []interface{}, strategy sql .connReuseStrategy ) (*sql .Rows , error )
( T) queryDC (ctx, txctx context .Context , dc *sql .driverConn , releaseConn func(error ), query string , args []interface{}) (*sql .Rows , error )
queryDC executes a query on the given connection.
The connection gets released by the releaseConn function.
The ctx context is from a query method and the txctx context is from an
optional transaction context.
( T) removeDep (x sql .finalCloser , dep interface{}) error
removeDep notes that x no longer depends on dep.
If x still has dependencies, nil is returned.
If x no longer has any dependencies, its finalClose method will be
called and its error value will be returned.
( T) removeDepLocked (x sql .finalCloser , dep interface{}) func() error
( T) shortestIdleTimeLocked () time .Duration
( T) startCleanerLocked ()
startCleanerLocked starts connectionCleaner if needed.
Implements (at least 7, in which 4 are exported )
*T : IConn
*T : IDB
*T : fmt.Stringer
T : io.Closer
/* 3+ unexporteds ... */ /* 3+ unexporteds: */
*T : context.stringer
*T : os/signal.stringer
*T : runtime.stringer
As Outputs Of (at least 4, in which 3 are exported )
func NewDB (sqldb *sql .DB , dialect schema .Dialect , opts ...DBOption ) *DB
func (*DB).WithNamedArg (name string , value interface{}) *DB
func github.com/Golang-Tools/sqlhelper.NewDB (URL string , dopts *sqlhelper .Options ) (*DB , error )
/* at least one unexported ... */ /* at least one unexported: */
func (*DB).clone () *DB
As Inputs Of (at least 26, in which 15 are exported )
func NewAddColumnQuery (db *DB ) *AddColumnQuery
func NewCreateIndexQuery (db *DB ) *CreateIndexQuery
func NewCreateTableQuery (db *DB ) *CreateTableQuery
func NewDeleteQuery (db *DB ) *DeleteQuery
func NewDropColumnQuery (db *DB ) *DropColumnQuery
func NewDropIndexQuery (db *DB ) *DropIndexQuery
func NewDropTableQuery (db *DB ) *DropTableQuery
func NewInsertQuery (db *DB ) *InsertQuery
func NewSelectQuery (db *DB ) *SelectQuery
func NewTruncateTableQuery (db *DB ) *TruncateTableQuery
func NewUpdateQuery (db *DB ) *UpdateQuery
func NewValuesQuery (db *DB , model interface{}) *ValuesQuery
func github.com/uptrace/bun/driver/pgdriver.NewListener (db *DB ) *pgdriver .Listener
func github.com/Golang-Tools/sqlhelper.WithInstance (cli *DB ) sqlhelper .Option
func github.com/Golang-Tools/sqlhelper.(*Proxy ).SetConnect (cli *DB , parallelcallback bool ) error
/* 11+ unexporteds ... */ /* 11+ unexporteds: */
func _newModel (db *DB , dest interface{}, scan bool ) (model , error )
func newMapModel (db *DB , dest *map[string ]interface{}) *mapModel
func newMapSliceModel (db *DB , dest *[]map[string ]interface{}) *mapSliceModel
func newModel (db *DB , dest []interface{}) (model , error )
func newScanModel (db *DB , dest []interface{}) *scanModel
func newSingleModel (db *DB , dest interface{}) (model , error )
func newSliceModel (db *DB , dest []interface{}, values []reflect .Value ) *sliceModel
func newSliceTableModel (db *DB , dest interface{}, slice reflect .Value , elemType reflect .Type ) *sliceTableModel
func newStructTableModel (db *DB , dest interface{}, table *schema .Table ) *structTableModel
func newStructTableModelValue (db *DB , dest interface{}, v reflect .Value ) *structTableModel
func newTableModelIndex (db *DB , table *schema .Table , root reflect .Value , index []int , rel *schema .Relation ) (tableModel , error )
type DeleteQuery (struct)
Fields (total 17, none are exported )
/* 17 unexporteds ... */ /* 17 unexporteds: */
returningQuery returningQuery
returningQuery .returning []schema .QueryWithArgs
returningQuery .returningFields []*schema .Field
whereBaseQuery whereBaseQuery
whereBaseQuery .baseQuery baseQuery
whereBaseQuery .baseQuery .columns []schema .QueryWithArgs
whereBaseQuery .baseQuery .conn IConn
whereBaseQuery .baseQuery .db *DB
whereBaseQuery .baseQuery .err error
whereBaseQuery .baseQuery .flags internal .Flag
whereBaseQuery .baseQuery .model model
whereBaseQuery .baseQuery .modelTable schema .QueryWithArgs
whereBaseQuery .baseQuery .table *schema .Table
whereBaseQuery .baseQuery .tableModel tableModel
whereBaseQuery .baseQuery .tables []schema .QueryWithArgs
whereBaseQuery .baseQuery .with []withQuery
whereBaseQuery .where []schema .QueryWithSep
Methods (total 65, in which 21 are exported )
(*T) AppendNamedArg (fmter schema .Formatter , b []byte , name string ) ([]byte , bool )
(*T) AppendQuery (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) Apply (fn func(*DeleteQuery ) *DeleteQuery ) *DeleteQuery
Apply calls the fn passing the DeleteQuery as an argument.
(*T) Conn (db IConn ) *DeleteQuery
(*T) DB () *DB
(*T) Exec (ctx context .Context , dest ...interface{}) (sql .Result , error )
(*T) ForceDelete () *DeleteQuery
(*T) GetModel () Model
(*T) Model (model interface{}) *DeleteQuery
(*T) ModelTableExpr (query string , args ...interface{}) *DeleteQuery
(*T) Operation () string
(*T) Returning (query string , args ...interface{}) *DeleteQuery
Returning adds a RETURNING clause to the query.
To suppress the auto-generated RETURNING clause, use `Returning("NULL")`.
(*T) Table (tables ...string ) *DeleteQuery
(*T) TableExpr (query string , args ...interface{}) *DeleteQuery
(*T) Where (query string , args ...interface{}) *DeleteQuery
(*T) WhereAllWithDeleted () *DeleteQuery
(*T) WhereDeleted () *DeleteQuery
(*T) WhereGroup (sep string , fn func(*DeleteQuery ) *DeleteQuery ) *DeleteQuery
(*T) WhereOr (query string , args ...interface{}) *DeleteQuery
(*T) WherePK () *DeleteQuery
(*T) With (name string , query schema .QueryAppender ) *DeleteQuery
/* 44 unexporteds ... */ /* 44 unexporteds: */
(*T) _appendFirstTable (fmter schema .Formatter , b []byte , withAlias bool ) ([]byte , error )
(*T) _appendTables (fmter schema .Formatter , b []byte , withAlias bool ) (_ []byte , err error )
(*T) _excludeColumn (column string ) bool
(*T) _getFields (omitPK bool ) ([]*schema .Field , error )
(*T) addColumn (column schema .QueryWithArgs )
(*T) addReturning (ret schema .QueryWithArgs )
(*T) addReturningField (field *schema .Field )
(*T) addTable (table schema .QueryWithArgs )
(*T) addWhere (where schema .QueryWithSep )
(*T) addWhereGroup (sep string , where []schema .QueryWithSep )
(*T) addWith (name string , query schema .QueryAppender )
(*T) afterDeleteHook (ctx context .Context ) error
(*T) appendColumns (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendFirstTable (fmter schema .Formatter , b []byte ) ([]byte , error )
(*T) appendFirstTableWithAlias (fmter schema .Formatter , b []byte ) ([]byte , error )
(*T) appendOtherTables (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendReturning (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendTables (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendTablesWithAlias (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendWhere (fmter schema .Formatter , b []byte , withAlias bool ) (_ []byte , err error )
(*T) appendWherePK (fmter schema .Formatter , b []byte , withAlias bool ) (_ []byte , err error )
(*T) appendWherePKSlice (fmter schema .Formatter , b []byte , model *sliceTableModel , withAlias bool ) (_ []byte , err error )
(*T) appendWherePKStruct (fmter schema .Formatter , b []byte , model *structTableModel , withAlias bool ) (_ []byte , err error )
(*T) appendWith (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) beforeDeleteHook (ctx context .Context ) error
(*T) checkSoftDelete () error
(*T) excludeColumn (columns []string )
(*T) exec (ctx context .Context , queryApp schema .Query , query string ) (sql .Result , error )
(*T) getDataFields () ([]*schema .Field , error )
(*T) getFields () ([]*schema .Field , error )
(*T) getModel (dest []interface{}) (model , error )
(*T) hasMultiTables () bool
(*T) hasReturning () bool
(*T) hasTables () bool
(*T) isSoftDelete () bool
(*T) modelHasTableName () bool
(*T) mustAppendWhere (fmter schema .Formatter , b []byte , withAlias bool ) ([]byte , error )
(*T) scan (ctx context .Context , queryApp schema .Query , query string , model model , hasDest bool ) (sql .Result , error )
(*T) setConn (db IConn )
(*T) setErr (err error )
(*T) setTableModel (modeli interface{})
TODO: rename to setModel
(*T) softDeleteSet (fmter schema .Formatter , tm time .Time ) string
(*T) whereAllWithDeleted ()
AllWithDeleted changes query to return all rows including soft deleted ones.
(*T) whereDeleted ()
Deleted adds `WHERE deleted_at IS NOT NULL` clause for soft deleted models.
Implements (at least 3, all are exported )
*T : github.com/uptrace/bun/schema.NamedArgAppender
*T : github.com/uptrace/bun/schema.Query
*T : github.com/uptrace/bun/schema.QueryAppender
As Outputs Of (at least 20, all are exported )
func NewDeleteQuery (db *DB ) *DeleteQuery
func Conn .NewDelete () *DeleteQuery
func (*DB ).NewDelete () *DeleteQuery
func (*DeleteQuery).Apply (fn func(*DeleteQuery ) *DeleteQuery ) *DeleteQuery
func (*DeleteQuery).Conn (db IConn ) *DeleteQuery
func (*DeleteQuery).ForceDelete () *DeleteQuery
func (*DeleteQuery).Model (model interface{}) *DeleteQuery
func (*DeleteQuery).ModelTableExpr (query string , args ...interface{}) *DeleteQuery
func (*DeleteQuery).Returning (query string , args ...interface{}) *DeleteQuery
func (*DeleteQuery).Table (tables ...string ) *DeleteQuery
func (*DeleteQuery).TableExpr (query string , args ...interface{}) *DeleteQuery
func (*DeleteQuery).Where (query string , args ...interface{}) *DeleteQuery
func (*DeleteQuery).WhereAllWithDeleted () *DeleteQuery
func (*DeleteQuery).WhereDeleted () *DeleteQuery
func (*DeleteQuery).WhereGroup (sep string , fn func(*DeleteQuery ) *DeleteQuery ) *DeleteQuery
func (*DeleteQuery).WhereOr (query string , args ...interface{}) *DeleteQuery
func (*DeleteQuery).WherePK () *DeleteQuery
func (*DeleteQuery).With (name string , query schema .QueryAppender ) *DeleteQuery
func IDB .NewDelete () *DeleteQuery
func Tx .NewDelete () *DeleteQuery
As Inputs Of (at least 2, both are exported )
func AfterDeleteHook .AfterDelete (ctx context .Context , query *DeleteQuery ) error
func BeforeDeleteHook .BeforeDelete (ctx context .Context , query *DeleteQuery ) error
type DropColumnQuery (struct)
Fields (total 12, none are exported )
/* 12 unexporteds ... */ /* 12 unexporteds: */
baseQuery baseQuery
baseQuery .columns []schema .QueryWithArgs
baseQuery .conn IConn
baseQuery .db *DB
baseQuery .err error
baseQuery .flags internal .Flag
baseQuery .model model
baseQuery .modelTable schema .QueryWithArgs
baseQuery .table *schema .Table
baseQuery .tableModel tableModel
baseQuery .tables []schema .QueryWithArgs
baseQuery .with []withQuery
Methods (total 43, in which 13 are exported )
(*T) AppendNamedArg (fmter schema .Formatter , b []byte , name string ) ([]byte , bool )
(*T) AppendQuery (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) Column (columns ...string ) *DropColumnQuery
(*T) ColumnExpr (query string , args ...interface{}) *DropColumnQuery
(*T) Conn (db IConn ) *DropColumnQuery
(*T) DB () *DB
(*T) Exec (ctx context .Context , dest ...interface{}) (sql .Result , error )
(*T) GetModel () Model
(*T) Model (model interface{}) *DropColumnQuery
(*T) ModelTableExpr (query string , args ...interface{}) *DropColumnQuery
(*T) Operation () string
(*T) Table (tables ...string ) *DropColumnQuery
(*T) TableExpr (query string , args ...interface{}) *DropColumnQuery
/* 30 unexporteds ... */ /* 30 unexporteds: */
(*T) _appendFirstTable (fmter schema .Formatter , b []byte , withAlias bool ) ([]byte , error )
(*T) _appendTables (fmter schema .Formatter , b []byte , withAlias bool ) (_ []byte , err error )
(*T) _excludeColumn (column string ) bool
(*T) _getFields (omitPK bool ) ([]*schema .Field , error )
(*T) addColumn (column schema .QueryWithArgs )
(*T) addTable (table schema .QueryWithArgs )
(*T) addWith (name string , query schema .QueryAppender )
(*T) appendColumns (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendFirstTable (fmter schema .Formatter , b []byte ) ([]byte , error )
(*T) appendFirstTableWithAlias (fmter schema .Formatter , b []byte ) ([]byte , error )
(*T) appendOtherTables (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendTables (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendTablesWithAlias (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendWith (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) checkSoftDelete () error
(*T) excludeColumn (columns []string )
(*T) exec (ctx context .Context , queryApp schema .Query , query string ) (sql .Result , error )
(*T) getDataFields () ([]*schema .Field , error )
(*T) getFields () ([]*schema .Field , error )
(*T) getModel (dest []interface{}) (model , error )
(*T) hasMultiTables () bool
(*T) hasTables () bool
(*T) isSoftDelete () bool
(*T) modelHasTableName () bool
(*T) scan (ctx context .Context , queryApp schema .Query , query string , model model , hasDest bool ) (sql .Result , error )
(*T) setConn (db IConn )
(*T) setErr (err error )
(*T) setTableModel (modeli interface{})
TODO: rename to setModel
(*T) whereAllWithDeleted ()
AllWithDeleted changes query to return all rows including soft deleted ones.
(*T) whereDeleted ()
Deleted adds `WHERE deleted_at IS NOT NULL` clause for soft deleted models.
Implements (at least 3, all are exported )
*T : github.com/uptrace/bun/schema.NamedArgAppender
*T : github.com/uptrace/bun/schema.Query
*T : github.com/uptrace/bun/schema.QueryAppender
As Outputs Of (at least 12, all are exported )
func NewDropColumnQuery (db *DB ) *DropColumnQuery
func Conn .NewDropColumn () *DropColumnQuery
func (*DB ).NewDropColumn () *DropColumnQuery
func (*DropColumnQuery).Column (columns ...string ) *DropColumnQuery
func (*DropColumnQuery).ColumnExpr (query string , args ...interface{}) *DropColumnQuery
func (*DropColumnQuery).Conn (db IConn ) *DropColumnQuery
func (*DropColumnQuery).Model (model interface{}) *DropColumnQuery
func (*DropColumnQuery).ModelTableExpr (query string , args ...interface{}) *DropColumnQuery
func (*DropColumnQuery).Table (tables ...string ) *DropColumnQuery
func (*DropColumnQuery).TableExpr (query string , args ...interface{}) *DropColumnQuery
func IDB .NewDropColumn () *DropColumnQuery
func Tx .NewDropColumn () *DropColumnQuery
type DropIndexQuery (struct)
Fields (total 17, none are exported )
/* 17 unexporteds ... */ /* 17 unexporteds: */
baseQuery baseQuery
baseQuery .columns []schema .QueryWithArgs
baseQuery .conn IConn
baseQuery .db *DB
baseQuery .err error
baseQuery .flags internal .Flag
baseQuery .model model
baseQuery .modelTable schema .QueryWithArgs
baseQuery .table *schema .Table
baseQuery .tableModel tableModel
baseQuery .tables []schema .QueryWithArgs
baseQuery .with []withQuery
cascadeQuery cascadeQuery
cascadeQuery .restrict bool
concurrently bool
ifExists bool
index schema .QueryWithArgs
Methods (total 43, in which 12 are exported )
(*T) AppendNamedArg (fmter schema .Formatter , b []byte , name string ) ([]byte , bool )
(*T) AppendQuery (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) Concurrently () *DropIndexQuery
(*T) Conn (db IConn ) *DropIndexQuery
(*T) DB () *DB
(*T) Exec (ctx context .Context , dest ...interface{}) (sql .Result , error )
(*T) GetModel () Model
(*T) IfExists () *DropIndexQuery
(*T) Index (query string , args ...interface{}) *DropIndexQuery
(*T) Model (model interface{}) *DropIndexQuery
(*T) Operation () string
(*T) Restrict () *DropIndexQuery
/* 31 unexporteds ... */ /* 31 unexporteds: */
(*T) _appendFirstTable (fmter schema .Formatter , b []byte , withAlias bool ) ([]byte , error )
(*T) _appendTables (fmter schema .Formatter , b []byte , withAlias bool ) (_ []byte , err error )
(*T) _excludeColumn (column string ) bool
(*T) _getFields (omitPK bool ) ([]*schema .Field , error )
(*T) addColumn (column schema .QueryWithArgs )
(*T) addTable (table schema .QueryWithArgs )
(*T) addWith (name string , query schema .QueryAppender )
( T) appendCascade (fmter schema .Formatter , b []byte ) []byte
(*T) appendColumns (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendFirstTable (fmter schema .Formatter , b []byte ) ([]byte , error )
(*T) appendFirstTableWithAlias (fmter schema .Formatter , b []byte ) ([]byte , error )
(*T) appendOtherTables (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendTables (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendTablesWithAlias (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendWith (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) checkSoftDelete () error
(*T) excludeColumn (columns []string )
(*T) exec (ctx context .Context , queryApp schema .Query , query string ) (sql .Result , error )
(*T) getDataFields () ([]*schema .Field , error )
(*T) getFields () ([]*schema .Field , error )
(*T) getModel (dest []interface{}) (model , error )
(*T) hasMultiTables () bool
(*T) hasTables () bool
(*T) isSoftDelete () bool
(*T) modelHasTableName () bool
(*T) scan (ctx context .Context , queryApp schema .Query , query string , model model , hasDest bool ) (sql .Result , error )
(*T) setConn (db IConn )
(*T) setErr (err error )
(*T) setTableModel (modeli interface{})
TODO: rename to setModel
(*T) whereAllWithDeleted ()
AllWithDeleted changes query to return all rows including soft deleted ones.
(*T) whereDeleted ()
Deleted adds `WHERE deleted_at IS NOT NULL` clause for soft deleted models.
Implements (at least 3, all are exported )
*T : github.com/uptrace/bun/schema.NamedArgAppender
*T : github.com/uptrace/bun/schema.Query
*T : github.com/uptrace/bun/schema.QueryAppender
As Outputs Of (at least 11, all are exported )
func NewDropIndexQuery (db *DB ) *DropIndexQuery
func Conn .NewDropIndex () *DropIndexQuery
func (*DB ).NewDropIndex () *DropIndexQuery
func (*DropIndexQuery).Concurrently () *DropIndexQuery
func (*DropIndexQuery).Conn (db IConn ) *DropIndexQuery
func (*DropIndexQuery).IfExists () *DropIndexQuery
func (*DropIndexQuery).Index (query string , args ...interface{}) *DropIndexQuery
func (*DropIndexQuery).Model (model interface{}) *DropIndexQuery
func (*DropIndexQuery).Restrict () *DropIndexQuery
func IDB .NewDropIndex () *DropIndexQuery
func Tx .NewDropIndex () *DropIndexQuery
type DropTableQuery (struct)
Fields (total 15, none are exported )
/* 15 unexporteds ... */ /* 15 unexporteds: */
baseQuery baseQuery
baseQuery .columns []schema .QueryWithArgs
baseQuery .conn IConn
baseQuery .db *DB
baseQuery .err error
baseQuery .flags internal .Flag
baseQuery .model model
baseQuery .modelTable schema .QueryWithArgs
baseQuery .table *schema .Table
baseQuery .tableModel tableModel
baseQuery .tables []schema .QueryWithArgs
baseQuery .with []withQuery
cascadeQuery cascadeQuery
cascadeQuery .restrict bool
ifExists bool
Methods (total 46, in which 13 are exported )
(*T) AppendNamedArg (fmter schema .Formatter , b []byte , name string ) ([]byte , bool )
(*T) AppendQuery (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) Conn (db IConn ) *DropTableQuery
(*T) DB () *DB
(*T) Exec (ctx context .Context , dest ...interface{}) (sql .Result , error )
(*T) GetModel () Model
(*T) IfExists () *DropTableQuery
(*T) Model (model interface{}) *DropTableQuery
(*T) ModelTableExpr (query string , args ...interface{}) *DropTableQuery
(*T) Operation () string
(*T) Restrict () *DropTableQuery
(*T) Table (tables ...string ) *DropTableQuery
(*T) TableExpr (query string , args ...interface{}) *DropTableQuery
/* 33 unexporteds ... */ /* 33 unexporteds: */
(*T) _appendFirstTable (fmter schema .Formatter , b []byte , withAlias bool ) ([]byte , error )
(*T) _appendTables (fmter schema .Formatter , b []byte , withAlias bool ) (_ []byte , err error )
(*T) _excludeColumn (column string ) bool
(*T) _getFields (omitPK bool ) ([]*schema .Field , error )
(*T) addColumn (column schema .QueryWithArgs )
(*T) addTable (table schema .QueryWithArgs )
(*T) addWith (name string , query schema .QueryAppender )
(*T) afterDropTableHook (ctx context .Context ) error
( T) appendCascade (fmter schema .Formatter , b []byte ) []byte
(*T) appendColumns (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendFirstTable (fmter schema .Formatter , b []byte ) ([]byte , error )
(*T) appendFirstTableWithAlias (fmter schema .Formatter , b []byte ) ([]byte , error )
(*T) appendOtherTables (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendTables (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendTablesWithAlias (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendWith (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) beforeDropTableHook (ctx context .Context ) error
(*T) checkSoftDelete () error
(*T) excludeColumn (columns []string )
(*T) exec (ctx context .Context , queryApp schema .Query , query string ) (sql .Result , error )
(*T) getDataFields () ([]*schema .Field , error )
(*T) getFields () ([]*schema .Field , error )
(*T) getModel (dest []interface{}) (model , error )
(*T) hasMultiTables () bool
(*T) hasTables () bool
(*T) isSoftDelete () bool
(*T) modelHasTableName () bool
(*T) scan (ctx context .Context , queryApp schema .Query , query string , model model , hasDest bool ) (sql .Result , error )
(*T) setConn (db IConn )
(*T) setErr (err error )
(*T) setTableModel (modeli interface{})
TODO: rename to setModel
(*T) whereAllWithDeleted ()
AllWithDeleted changes query to return all rows including soft deleted ones.
(*T) whereDeleted ()
Deleted adds `WHERE deleted_at IS NOT NULL` clause for soft deleted models.
Implements (at least 3, all are exported )
*T : github.com/uptrace/bun/schema.NamedArgAppender
*T : github.com/uptrace/bun/schema.Query
*T : github.com/uptrace/bun/schema.QueryAppender
As Outputs Of (at least 12, all are exported )
func NewDropTableQuery (db *DB ) *DropTableQuery
func Conn .NewDropTable () *DropTableQuery
func (*DB ).NewDropTable () *DropTableQuery
func (*DropTableQuery).Conn (db IConn ) *DropTableQuery
func (*DropTableQuery).IfExists () *DropTableQuery
func (*DropTableQuery).Model (model interface{}) *DropTableQuery
func (*DropTableQuery).ModelTableExpr (query string , args ...interface{}) *DropTableQuery
func (*DropTableQuery).Restrict () *DropTableQuery
func (*DropTableQuery).Table (tables ...string ) *DropTableQuery
func (*DropTableQuery).TableExpr (query string , args ...interface{}) *DropTableQuery
func IDB .NewDropTable () *DropTableQuery
func Tx .NewDropTable () *DropTableQuery
As Inputs Of (at least 2, both are exported )
func AfterDropTableHook .AfterDropTable (ctx context .Context , query *DropTableQuery ) error
func BeforeDropTableHook .BeforeDropTable (ctx context .Context , query *DropTableQuery ) error
type IConn (interface)
IConn is a common interface for *sql.DB, *sql.Conn, and *sql.Tx.
Methods (total 3, all are exported )
( T) ExecContext (ctx context .Context , query string , args ...interface{}) (sql .Result , error )
( T) QueryContext (ctx context .Context , query string , args ...interface{}) (*sql .Rows , error )
( T) QueryRowContext (ctx context .Context , query string , args ...interface{}) *sql .Row
Implemented By (at least 8, all are exported )
Conn
*DB
IDB (interface)
Tx
github.com/Golang-Tools/sqlhelper.Proxy
*database/sql.Conn
*database/sql.DB
*database/sql.Tx
As Inputs Of (at least 12, all are exported )
func (*AddColumnQuery ).Conn (db IConn ) *AddColumnQuery
func (*CreateIndexQuery ).Conn (db IConn ) *CreateIndexQuery
func (*CreateTableQuery ).Conn (db IConn ) *CreateTableQuery
func (*DeleteQuery ).Conn (db IConn ) *DeleteQuery
func (*DropColumnQuery ).Conn (db IConn ) *DropColumnQuery
func (*DropIndexQuery ).Conn (db IConn ) *DropIndexQuery
func (*DropTableQuery ).Conn (db IConn ) *DropTableQuery
func (*InsertQuery ).Conn (db IConn ) *InsertQuery
func (*SelectQuery ).Conn (db IConn ) *SelectQuery
func (*TruncateTableQuery ).Conn (db IConn ) *TruncateTableQuery
func (*UpdateQuery ).Conn (db IConn ) *UpdateQuery
func (*ValuesQuery ).Conn (db IConn ) *ValuesQuery
type IDB (interface)
IDB is a common interface for *bun.DB, bun.Conn, and bun.Tx.
Methods (total 15, all are exported )
( T) ExecContext (ctx context .Context , query string , args ...interface{}) (sql .Result , error )
( T) NewAddColumn () *AddColumnQuery
( T) NewCreateIndex () *CreateIndexQuery
( T) NewCreateTable () *CreateTableQuery
( T) NewDelete () *DeleteQuery
( T) NewDropColumn () *DropColumnQuery
( T) NewDropIndex () *DropIndexQuery
( T) NewDropTable () *DropTableQuery
( T) NewInsert () *InsertQuery
( T) NewSelect () *SelectQuery
( T) NewTruncateTable () *TruncateTableQuery
( T) NewUpdate () *UpdateQuery
( T) NewValues (model interface{}) *ValuesQuery
( T) QueryContext (ctx context .Context , query string , args ...interface{}) (*sql .Rows , error )
( T) QueryRowContext (ctx context .Context , query string , args ...interface{}) *sql .Row
Implemented By (at least 4, all are exported )
Conn
*DB
Tx
github.com/Golang-Tools/sqlhelper.Proxy
Implements (at least one exported )
T : IConn
type InsertQuery (struct)
Fields (total 25, none are exported )
/* 25 unexporteds ... */ /* 25 unexporteds: */
customValueQuery customValueQuery
customValueQuery .extraValues []columnValue
customValueQuery .modelValues map[string ]schema .QueryWithArgs
ignore bool
on schema .QueryWithArgs
replace bool
returningQuery returningQuery
returningQuery .returning []schema .QueryWithArgs
returningQuery .returningFields []*schema .Field
setQuery setQuery
setQuery .set []schema .QueryWithArgs
whereBaseQuery whereBaseQuery
whereBaseQuery .baseQuery baseQuery
whereBaseQuery .baseQuery .columns []schema .QueryWithArgs
whereBaseQuery .baseQuery .conn IConn
whereBaseQuery .baseQuery .db *DB
whereBaseQuery .baseQuery .err error
whereBaseQuery .baseQuery .flags internal .Flag
whereBaseQuery .baseQuery .model model
whereBaseQuery .baseQuery .modelTable schema .QueryWithArgs
whereBaseQuery .baseQuery .table *schema .Table
whereBaseQuery .baseQuery .tableModel tableModel
whereBaseQuery .baseQuery .tables []schema .QueryWithArgs
whereBaseQuery .baseQuery .with []withQuery
whereBaseQuery .where []schema .QueryWithSep
Methods (total 77, in which 23 are exported )
(*T) AppendNamedArg (fmter schema .Formatter , b []byte , name string ) ([]byte , bool )
(*T) AppendQuery (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) Apply (fn func(*InsertQuery ) *InsertQuery ) *InsertQuery
Apply calls the fn passing the SelectQuery as an argument.
(*T) Column (columns ...string ) *InsertQuery
(*T) Conn (db IConn ) *InsertQuery
(*T) DB () *DB
(*T) ExcludeColumn (columns ...string ) *InsertQuery
(*T) Exec (ctx context .Context , dest ...interface{}) (sql .Result , error )
(*T) GetModel () Model
(*T) Ignore () *InsertQuery
Ignore generates an `INSERT IGNORE INTO` query (MySQL).
(*T) Model (model interface{}) *InsertQuery
(*T) ModelTableExpr (query string , args ...interface{}) *InsertQuery
(*T) On (s string , args ...interface{}) *InsertQuery
(*T) Operation () string
(*T) Replace () *InsertQuery
Replaces generates a `REPLACE INTO` query (MySQL).
(*T) Returning (query string , args ...interface{}) *InsertQuery
Returning adds a RETURNING clause to the query.
To suppress the auto-generated RETURNING clause, use `Returning("NULL")`.
(*T) Set (query string , args ...interface{}) *InsertQuery
(*T) Table (tables ...string ) *InsertQuery
(*T) TableExpr (query string , args ...interface{}) *InsertQuery
(*T) Value (column string , expr string , args ...interface{}) *InsertQuery
Value overwrites model value for the column.
(*T) Where (query string , args ...interface{}) *InsertQuery
(*T) WhereOr (query string , args ...interface{}) *InsertQuery
(*T) With (name string , query schema .QueryAppender ) *InsertQuery
/* 54 unexporteds ... */ /* 54 unexporteds: */
(*T) _appendFirstTable (fmter schema .Formatter , b []byte , withAlias bool ) ([]byte , error )
(*T) _appendTables (fmter schema .Formatter , b []byte , withAlias bool ) (_ []byte , err error )
(*T) _excludeColumn (column string ) bool
(*T) _getFields (omitPK bool ) ([]*schema .Field , error )
(*T) addColumn (column schema .QueryWithArgs )
(*T) addReturning (ret schema .QueryWithArgs )
(*T) addReturningField (field *schema .Field )
(*T) addSet (set schema .QueryWithArgs )
(*T) addTable (table schema .QueryWithArgs )
(*T) addValue (table *schema .Table , column string , value string , args []interface{})
(*T) addWhere (where schema .QueryWithSep )
(*T) addWhereGroup (sep string , where []schema .QueryWithSep )
(*T) addWith (name string , query schema .QueryAppender )
(*T) afterInsertHook (ctx context .Context ) error
(*T) appendColumns (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendColumnsValues (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendFields (fmter schema .Formatter , b []byte , fields []*schema .Field ) []byte
(*T) appendFirstTable (fmter schema .Formatter , b []byte ) ([]byte , error )
(*T) appendFirstTableWithAlias (fmter schema .Formatter , b []byte ) ([]byte , error )
(*T) appendOn (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendOtherTables (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendReturning (fmter schema .Formatter , b []byte ) (_ []byte , err error )
( T) appendSet (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendSetExcluded (b []byte , fields []*schema .Field ) []byte
(*T) appendSliceValues (fmter schema .Formatter , b []byte , fields []*schema .Field , slice reflect .Value ) (_ []byte , err error )
(*T) appendStructValues (fmter schema .Formatter , b []byte , fields []*schema .Field , strct reflect .Value ) (_ []byte , err error )
(*T) appendTables (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendTablesWithAlias (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendWhere (fmter schema .Formatter , b []byte , withAlias bool ) (_ []byte , err error )
(*T) appendWherePK (fmter schema .Formatter , b []byte , withAlias bool ) (_ []byte , err error )
(*T) appendWherePKSlice (fmter schema .Formatter , b []byte , model *sliceTableModel , withAlias bool ) (_ []byte , err error )
(*T) appendWherePKStruct (fmter schema .Formatter , b []byte , model *structTableModel , withAlias bool ) (_ []byte , err error )
(*T) appendWith (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) beforeInsertHook (ctx context .Context ) error
(*T) checkSoftDelete () error
(*T) excludeColumn (columns []string )
(*T) exec (ctx context .Context , queryApp schema .Query , query string ) (sql .Result , error )
(*T) getDataFields () ([]*schema .Field , error )
(*T) getFields () ([]*schema .Field , error )
(*T) getModel (dest []interface{}) (model , error )
(*T) hasMultiTables () bool
(*T) hasReturning () bool
(*T) hasTables () bool
(*T) isSoftDelete () bool
(*T) modelHasTableName () bool
(*T) mustAppendWhere (fmter schema .Formatter , b []byte , withAlias bool ) ([]byte , error )
(*T) onConflictDoUpdate () bool
(*T) scan (ctx context .Context , queryApp schema .Query , query string , model model , hasDest bool ) (sql .Result , error )
(*T) setConn (db IConn )
(*T) setErr (err error )
(*T) setTableModel (modeli interface{})
TODO: rename to setModel
(*T) tryLastInsertID (res sql .Result , dest []interface{}) error
(*T) whereAllWithDeleted ()
AllWithDeleted changes query to return all rows including soft deleted ones.
(*T) whereDeleted ()
Deleted adds `WHERE deleted_at IS NOT NULL` clause for soft deleted models.
Implements (at least 3, all are exported )
*T : github.com/uptrace/bun/schema.NamedArgAppender
*T : github.com/uptrace/bun/schema.Query
*T : github.com/uptrace/bun/schema.QueryAppender
As Outputs Of (at least 22, all are exported )
func NewInsertQuery (db *DB ) *InsertQuery
func Conn .NewInsert () *InsertQuery
func (*DB ).NewInsert () *InsertQuery
func IDB .NewInsert () *InsertQuery
func (*InsertQuery).Apply (fn func(*InsertQuery ) *InsertQuery ) *InsertQuery
func (*InsertQuery).Column (columns ...string ) *InsertQuery
func (*InsertQuery).Conn (db IConn ) *InsertQuery
func (*InsertQuery).ExcludeColumn (columns ...string ) *InsertQuery
func (*InsertQuery).Ignore () *InsertQuery
func (*InsertQuery).Model (model interface{}) *InsertQuery
func (*InsertQuery).ModelTableExpr (query string , args ...interface{}) *InsertQuery
func (*InsertQuery).On (s string , args ...interface{}) *InsertQuery
func (*InsertQuery).Replace () *InsertQuery
func (*InsertQuery).Returning (query string , args ...interface{}) *InsertQuery
func (*InsertQuery).Set (query string , args ...interface{}) *InsertQuery
func (*InsertQuery).Table (tables ...string ) *InsertQuery
func (*InsertQuery).TableExpr (query string , args ...interface{}) *InsertQuery
func (*InsertQuery).Value (column string , expr string , args ...interface{}) *InsertQuery
func (*InsertQuery).Where (query string , args ...interface{}) *InsertQuery
func (*InsertQuery).WhereOr (query string , args ...interface{}) *InsertQuery
func (*InsertQuery).With (name string , query schema .QueryAppender ) *InsertQuery
func Tx .NewInsert () *InsertQuery
As Inputs Of (at least 2, both are exported )
func AfterInsertHook .AfterInsert (ctx context .Context , query *InsertQuery ) error
func BeforeInsertHook .BeforeInsert (ctx context .Context , query *InsertQuery ) error
type QueryEvent (struct)
Fields (total 8, all are exported )
DB *DB
Err error
Query string
QueryAppender schema .Query
QueryArgs []interface{}
Result sql .Result
StartTime time .Time
Stash map[interface{}]interface{}
Methods (only one, which is exported )
(*T) Operation () string
As Outputs Of (at least one unexported )
/* at least one unexported ... */ /* at least one unexported: */
func (*DB ).beforeQuery (ctx context .Context , queryApp schema .Query , query string , queryArgs []interface{}) (context .Context , *QueryEvent )
As Inputs Of (at least 7, in which 4 are exported )
func QueryHook .AfterQuery (context .Context , *QueryEvent )
func QueryHook .BeforeQuery (context .Context , *QueryEvent ) context .Context
func github.com/oiime/logrusbun.(*QueryHook ).AfterQuery (ctx context .Context , event *QueryEvent )
func github.com/oiime/logrusbun.(*QueryHook ).BeforeQuery (ctx context .Context , event *QueryEvent ) context .Context
/* 3+ unexporteds ... */ /* 3+ unexporteds: */
func (*DB ).afterQuery (ctx context .Context , event *QueryEvent , res sql .Result , err error )
func (*DB ).afterQueryFromIndex (ctx context .Context , event *QueryEvent , hookIndex int )
func github.com/oiime/logrusbun.eventOperation (event *QueryEvent ) string
type SelectQuery (struct)
Fields (total 23, none are exported )
/* 23 unexporteds ... */ /* 23 unexporteds: */
distinctOn []schema .QueryWithArgs
group []schema .QueryWithArgs
having []schema .QueryWithArgs
joins []joinQuery
limit int32
offset int32
order []schema .QueryWithArgs
selFor schema .QueryWithArgs
union []union
whereBaseQuery whereBaseQuery
whereBaseQuery .baseQuery baseQuery
whereBaseQuery .baseQuery .columns []schema .QueryWithArgs
whereBaseQuery .baseQuery .conn IConn
whereBaseQuery .baseQuery .db *DB
whereBaseQuery .baseQuery .err error
whereBaseQuery .baseQuery .flags internal .Flag
whereBaseQuery .baseQuery .model model
whereBaseQuery .baseQuery .modelTable schema .QueryWithArgs
whereBaseQuery .baseQuery .table *schema .Table
whereBaseQuery .baseQuery .tableModel tableModel
whereBaseQuery .baseQuery .tables []schema .QueryWithArgs
whereBaseQuery .baseQuery .with []withQuery
whereBaseQuery .where []schema .QueryWithSep
Methods (total 94, in which 47 are exported )
(*T) AppendNamedArg (fmter schema .Formatter , b []byte , name string ) ([]byte , bool )
(*T) AppendQuery (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) Apply (fn func(*SelectQuery ) *SelectQuery ) *SelectQuery
Apply calls the fn passing the SelectQuery as an argument.
(*T) Column (columns ...string ) *SelectQuery
(*T) ColumnExpr (query string , args ...interface{}) *SelectQuery
(*T) Conn (db IConn ) *SelectQuery
(*T) Count (ctx context .Context ) (int , error )
(*T) DB () *DB
(*T) Distinct () *SelectQuery
(*T) DistinctOn (query string , args ...interface{}) *SelectQuery
(*T) Except (other *SelectQuery ) *SelectQuery
(*T) ExceptAll (other *SelectQuery ) *SelectQuery
(*T) ExcludeColumn (columns ...string ) *SelectQuery
(*T) Exec (ctx context .Context ) (res sql .Result , err error )
(*T) Exists (ctx context .Context ) (bool , error )
(*T) For (s string , args ...interface{}) *SelectQuery
(*T) GetModel () Model
(*T) Group (columns ...string ) *SelectQuery
(*T) GroupExpr (group string , args ...interface{}) *SelectQuery
(*T) Having (having string , args ...interface{}) *SelectQuery
(*T) Intersect (other *SelectQuery ) *SelectQuery
(*T) IntersectAll (other *SelectQuery ) *SelectQuery
(*T) Join (join string , args ...interface{}) *SelectQuery
(*T) JoinOn (cond string , args ...interface{}) *SelectQuery
(*T) JoinOnOr (cond string , args ...interface{}) *SelectQuery
(*T) Limit (n int ) *SelectQuery
(*T) Model (model interface{}) *SelectQuery
(*T) ModelTableExpr (query string , args ...interface{}) *SelectQuery
(*T) Offset (n int ) *SelectQuery
(*T) Operation () string
(*T) Order (orders ...string ) *SelectQuery
(*T) OrderExpr (query string , args ...interface{}) *SelectQuery
(*T) Relation (name string , apply ...func(*SelectQuery ) *SelectQuery ) *SelectQuery
Relation adds a relation to the query.
(*T) Rows (ctx context .Context ) (*sql .Rows , error )
(*T) Scan (ctx context .Context , dest ...interface{}) error
(*T) ScanAndCount (ctx context .Context , dest ...interface{}) (int , error )
(*T) Table (tables ...string ) *SelectQuery
(*T) TableExpr (query string , args ...interface{}) *SelectQuery
(*T) Union (other *SelectQuery ) *SelectQuery
(*T) UnionAll (other *SelectQuery ) *SelectQuery
(*T) Where (query string , args ...interface{}) *SelectQuery
(*T) WhereAllWithDeleted () *SelectQuery
(*T) WhereDeleted () *SelectQuery
(*T) WhereGroup (sep string , fn func(*SelectQuery ) *SelectQuery ) *SelectQuery
(*T) WhereOr (query string , args ...interface{}) *SelectQuery
(*T) WherePK () *SelectQuery
(*T) With (name string , query schema .QueryAppender ) *SelectQuery
/* 47 unexporteds ... */ /* 47 unexporteds: */
(*T) _appendFirstTable (fmter schema .Formatter , b []byte , withAlias bool ) ([]byte , error )
(*T) _appendTables (fmter schema .Formatter , b []byte , withAlias bool ) (_ []byte , err error )
(*T) _excludeColumn (column string ) bool
(*T) _forEachHasOneJoin (fn func(*relationJoin ) error , joins []relationJoin ) error
(*T) _getFields (omitPK bool ) ([]*schema .Field , error )
(*T) addColumn (column schema .QueryWithArgs )
(*T) addTable (table schema .QueryWithArgs )
(*T) addUnion (expr string , other *SelectQuery ) *SelectQuery
(*T) addWhere (where schema .QueryWithSep )
(*T) addWhereGroup (sep string , where []schema .QueryWithSep )
(*T) addWith (name string , query schema .QueryAppender )
(*T) afterSelectHook (ctx context .Context ) error
(*T) appendColumns (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendFirstTable (fmter schema .Formatter , b []byte ) ([]byte , error )
(*T) appendFirstTableWithAlias (fmter schema .Formatter , b []byte ) ([]byte , error )
(*T) appendHasOneColumns (fmter schema .Formatter , b []byte , join *relationJoin ) (_ []byte , err error )
(*T) appendOrder (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendOtherTables (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendQuery (fmter schema .Formatter , b []byte , count bool ) (_ []byte , err error )
(*T) appendTables (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendTablesWithAlias (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendWhere (fmter schema .Formatter , b []byte , withAlias bool ) (_ []byte , err error )
(*T) appendWherePK (fmter schema .Formatter , b []byte , withAlias bool ) (_ []byte , err error )
(*T) appendWherePKSlice (fmter schema .Formatter , b []byte , model *sliceTableModel , withAlias bool ) (_ []byte , err error )
(*T) appendWherePKStruct (fmter schema .Formatter , b []byte , model *structTableModel , withAlias bool ) (_ []byte , err error )
(*T) appendWith (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) beforeSelectHook (ctx context .Context ) error
(*T) checkSoftDelete () error
(*T) excludeColumn (columns []string )
(*T) exec (ctx context .Context , queryApp schema .Query , query string ) (sql .Result , error )
(*T) forEachHasOneJoin (fn func(*relationJoin ) error ) error
(*T) getDataFields () ([]*schema .Field , error )
(*T) getFields () ([]*schema .Field , error )
(*T) getModel (dest []interface{}) (model , error )
(*T) hasMultiTables () bool
(*T) hasTables () bool
(*T) isSoftDelete () bool
(*T) joinOn (cond string , args []interface{}, sep string ) *SelectQuery
(*T) modelHasTableName () bool
(*T) mustAppendWhere (fmter schema .Formatter , b []byte , withAlias bool ) ([]byte , error )
(*T) scan (ctx context .Context , queryApp schema .Query , query string , model model , hasDest bool ) (sql .Result , error )
(*T) selectJoins (ctx context .Context , joins []relationJoin ) error
(*T) setConn (db IConn )
(*T) setErr (err error )
(*T) setTableModel (modeli interface{})
TODO: rename to setModel
(*T) whereAllWithDeleted ()
AllWithDeleted changes query to return all rows including soft deleted ones.
(*T) whereDeleted ()
Deleted adds `WHERE deleted_at IS NOT NULL` clause for soft deleted models.
Implements (at least 3, all are exported )
*T : github.com/uptrace/bun/schema.NamedArgAppender
*T : github.com/uptrace/bun/schema.Query
*T : github.com/uptrace/bun/schema.QueryAppender
As Outputs Of (at least 43, in which 41 are exported )
func NewSelectQuery (db *DB ) *SelectQuery
func Conn .NewSelect () *SelectQuery
func (*DB ).NewSelect () *SelectQuery
func IDB .NewSelect () *SelectQuery
func (*SelectQuery).Apply (fn func(*SelectQuery ) *SelectQuery ) *SelectQuery
func (*SelectQuery).Column (columns ...string ) *SelectQuery
func (*SelectQuery).ColumnExpr (query string , args ...interface{}) *SelectQuery
func (*SelectQuery).Conn (db IConn ) *SelectQuery
func (*SelectQuery).Distinct () *SelectQuery
func (*SelectQuery).DistinctOn (query string , args ...interface{}) *SelectQuery
func (*SelectQuery).Except (other *SelectQuery ) *SelectQuery
func (*SelectQuery).ExceptAll (other *SelectQuery ) *SelectQuery
func (*SelectQuery).ExcludeColumn (columns ...string ) *SelectQuery
func (*SelectQuery).For (s string , args ...interface{}) *SelectQuery
func (*SelectQuery).Group (columns ...string ) *SelectQuery
func (*SelectQuery).GroupExpr (group string , args ...interface{}) *SelectQuery
func (*SelectQuery).Having (having string , args ...interface{}) *SelectQuery
func (*SelectQuery).Intersect (other *SelectQuery ) *SelectQuery
func (*SelectQuery).IntersectAll (other *SelectQuery ) *SelectQuery
func (*SelectQuery).Join (join string , args ...interface{}) *SelectQuery
func (*SelectQuery).JoinOn (cond string , args ...interface{}) *SelectQuery
func (*SelectQuery).JoinOnOr (cond string , args ...interface{}) *SelectQuery
func (*SelectQuery).Limit (n int ) *SelectQuery
func (*SelectQuery).Model (model interface{}) *SelectQuery
func (*SelectQuery).ModelTableExpr (query string , args ...interface{}) *SelectQuery
func (*SelectQuery).Offset (n int ) *SelectQuery
func (*SelectQuery).Order (orders ...string ) *SelectQuery
func (*SelectQuery).OrderExpr (query string , args ...interface{}) *SelectQuery
func (*SelectQuery).Relation (name string , apply ...func(*SelectQuery ) *SelectQuery ) *SelectQuery
func (*SelectQuery).Table (tables ...string ) *SelectQuery
func (*SelectQuery).TableExpr (query string , args ...interface{}) *SelectQuery
func (*SelectQuery).Union (other *SelectQuery ) *SelectQuery
func (*SelectQuery).UnionAll (other *SelectQuery ) *SelectQuery
func (*SelectQuery).Where (query string , args ...interface{}) *SelectQuery
func (*SelectQuery).WhereAllWithDeleted () *SelectQuery
func (*SelectQuery).WhereDeleted () *SelectQuery
func (*SelectQuery).WhereGroup (sep string , fn func(*SelectQuery ) *SelectQuery ) *SelectQuery
func (*SelectQuery).WhereOr (query string , args ...interface{}) *SelectQuery
func (*SelectQuery).WherePK () *SelectQuery
func (*SelectQuery).With (name string , query schema .QueryAppender ) *SelectQuery
func Tx .NewSelect () *SelectQuery
/* 2+ unexporteds ... */ /* 2+ unexporteds: */
func (*SelectQuery).addUnion (expr string , other *SelectQuery ) *SelectQuery
func (*SelectQuery).joinOn (cond string , args []interface{}, sep string ) *SelectQuery
As Inputs Of (at least 9, in which 8 are exported )
func AfterSelectHook .AfterSelect (ctx context .Context , query *SelectQuery ) error
func BeforeSelectHook .BeforeSelect (ctx context .Context , query *SelectQuery ) error
func (*SelectQuery).Except (other *SelectQuery ) *SelectQuery
func (*SelectQuery).ExceptAll (other *SelectQuery ) *SelectQuery
func (*SelectQuery).Intersect (other *SelectQuery ) *SelectQuery
func (*SelectQuery).IntersectAll (other *SelectQuery ) *SelectQuery
func (*SelectQuery).Union (other *SelectQuery ) *SelectQuery
func (*SelectQuery).UnionAll (other *SelectQuery ) *SelectQuery
/* at least one unexported ... */ /* at least one unexported: */
func (*SelectQuery).addUnion (expr string , other *SelectQuery ) *SelectQuery
type Stmt (struct)
Fields (total 12, in which 1 are exported )
Stmt *sql .Stmt
/* 11 unexporteds ... */ /* 11 unexporteds: */
Stmt .cg sql .stmtConnGrabber
If Stmt is prepared on a Tx or Conn then cg is present and will
only ever grab a connection from cg.
If cg is nil then the Stmt must grab an arbitrary connection
from db and determine if it must prepare the stmt again by
inspecting css.
Stmt .cgds *sql .driverStmt
Stmt .closed bool
Stmt .closemu sync .RWMutex
// held exclusively during close, for read otherwise.
Stmt .css []sql .connStmt
css is a list of underlying driver statement interfaces
that are valid on particular connections. This is only
used if cg == nil and one is found that has idle
connections. If cg != nil, cgds is always used.
Stmt .db *sql .DB
Immutable:
// where we came from
Stmt .lastNumClosed uint64
lastNumClosed is copied from db.numClosed when Stmt is created
without tx and closed connections in css are removed.
Stmt .mu sync .Mutex
// protects the rest of the fields
Stmt .parentStmt *sql .Stmt
parentStmt is set when a transaction-specific statement
is requested from an identical statement prepared on the same
conn. parentStmt is used to track the dependency of this statement
on its originating ("parent") statement so that parentStmt may
be closed by the user without them having to know whether or not
any transactions are still using it.
Stmt .query string
// that created the Stmt
Stmt .stickyErr error
// if non-nil, this error is returned for all operations
Methods (total 11, in which 7 are exported )
( T) Close () error
Close closes the statement.
( T) Exec (args ...interface{}) (sql .Result , error )
Exec executes a prepared statement with the given arguments and
returns a Result summarizing the effect of the statement.
( T) ExecContext (ctx context .Context , args ...interface{}) (sql .Result , error )
ExecContext executes a prepared statement with the given arguments and
returns a Result summarizing the effect of the statement.
( T) Query (args ...interface{}) (*sql .Rows , error )
Query executes a prepared query statement with the given arguments
and returns the query results as a *Rows.
( T) QueryContext (ctx context .Context , args ...interface{}) (*sql .Rows , error )
QueryContext executes a prepared query statement with the given arguments
and returns the query results as a *Rows.
( T) QueryRow (args ...interface{}) *sql .Row
QueryRow executes a prepared query statement with the given arguments.
If an error occurs during the execution of the statement, that error will
be returned by a call to Scan on the returned *Row, which is always non-nil.
If the query selects no rows, the *Row's Scan will return ErrNoRows.
Otherwise, the *Row's Scan scans the first selected row and discards
the rest.
Example usage:
var name string
err := nameByUseridStmt.QueryRow(id).Scan(&name)
( T) QueryRowContext (ctx context .Context , args ...interface{}) *sql .Row
QueryRowContext executes a prepared query statement with the given arguments.
If an error occurs during the execution of the statement, that error will
be returned by a call to Scan on the returned *Row, which is always non-nil.
If the query selects no rows, the *Row's Scan will return ErrNoRows.
Otherwise, the *Row's Scan scans the first selected row and discards
the rest.
/* 4 unexporteds ... */ /* 4 unexporteds: */
( T) connStmt (ctx context .Context , strategy sql .connReuseStrategy ) (dc *sql .driverConn , releaseConn func(error ), ds *sql .driverStmt , err error )
connStmt returns a free driver connection on which to execute the
statement, a function to call to release the connection, and a
statement bound to that connection.
( T) finalClose () error
( T) prepareOnConnLocked (ctx context .Context , dc *sql .driverConn ) (*sql .driverStmt , error )
prepareOnConnLocked prepares the query in Stmt s on dc and adds it to the list of
open connStmt on the statement. It assumes the caller is holding the lock on dc.
( T) removeClosedStmtLocked ()
removeClosedStmtLocked removes closed conns in s.css.
To avoid lock contention on DB.mu, we do it only when
s.db.numClosed - s.lastNum is large enough.
Implements (at least 2, in which 1 are exported )
T : io.Closer
/* at least one unexported ... */ /* at least one unexported: */
T : database/sql.finalCloser
As Outputs Of (at least 2, both are exported )
func (*DB ).Prepare (query string ) (Stmt , error )
func (*DB ).PrepareContext (ctx context .Context , query string ) (Stmt , error )
type TruncateTableQuery (struct)
Fields (total 15, none are exported )
/* 15 unexporteds ... */ /* 15 unexporteds: */
baseQuery baseQuery
baseQuery .columns []schema .QueryWithArgs
baseQuery .conn IConn
baseQuery .db *DB
baseQuery .err error
baseQuery .flags internal .Flag
baseQuery .model model
baseQuery .modelTable schema .QueryWithArgs
baseQuery .table *schema .Table
baseQuery .tableModel tableModel
baseQuery .tables []schema .QueryWithArgs
baseQuery .with []withQuery
cascadeQuery cascadeQuery
cascadeQuery .restrict bool
continueIdentity bool
Methods (total 43, in which 12 are exported )
(*T) AppendNamedArg (fmter schema .Formatter , b []byte , name string ) ([]byte , bool )
(*T) AppendQuery (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) Conn (db IConn ) *TruncateTableQuery
(*T) ContinueIdentity () *TruncateTableQuery
(*T) DB () *DB
(*T) Exec (ctx context .Context , dest ...interface{}) (sql .Result , error )
(*T) GetModel () Model
(*T) Model (model interface{}) *TruncateTableQuery
(*T) Operation () string
(*T) Restrict () *TruncateTableQuery
(*T) Table (tables ...string ) *TruncateTableQuery
(*T) TableExpr (query string , args ...interface{}) *TruncateTableQuery
/* 31 unexporteds ... */ /* 31 unexporteds: */
(*T) _appendFirstTable (fmter schema .Formatter , b []byte , withAlias bool ) ([]byte , error )
(*T) _appendTables (fmter schema .Formatter , b []byte , withAlias bool ) (_ []byte , err error )
(*T) _excludeColumn (column string ) bool
(*T) _getFields (omitPK bool ) ([]*schema .Field , error )
(*T) addColumn (column schema .QueryWithArgs )
(*T) addTable (table schema .QueryWithArgs )
(*T) addWith (name string , query schema .QueryAppender )
( T) appendCascade (fmter schema .Formatter , b []byte ) []byte
(*T) appendColumns (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendFirstTable (fmter schema .Formatter , b []byte ) ([]byte , error )
(*T) appendFirstTableWithAlias (fmter schema .Formatter , b []byte ) ([]byte , error )
(*T) appendOtherTables (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendTables (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendTablesWithAlias (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendWith (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) checkSoftDelete () error
(*T) excludeColumn (columns []string )
(*T) exec (ctx context .Context , queryApp schema .Query , query string ) (sql .Result , error )
(*T) getDataFields () ([]*schema .Field , error )
(*T) getFields () ([]*schema .Field , error )
(*T) getModel (dest []interface{}) (model , error )
(*T) hasMultiTables () bool
(*T) hasTables () bool
(*T) isSoftDelete () bool
(*T) modelHasTableName () bool
(*T) scan (ctx context .Context , queryApp schema .Query , query string , model model , hasDest bool ) (sql .Result , error )
(*T) setConn (db IConn )
(*T) setErr (err error )
(*T) setTableModel (modeli interface{})
TODO: rename to setModel
(*T) whereAllWithDeleted ()
AllWithDeleted changes query to return all rows including soft deleted ones.
(*T) whereDeleted ()
Deleted adds `WHERE deleted_at IS NOT NULL` clause for soft deleted models.
Implements (at least 3, all are exported )
*T : github.com/uptrace/bun/schema.NamedArgAppender
*T : github.com/uptrace/bun/schema.Query
*T : github.com/uptrace/bun/schema.QueryAppender
As Outputs Of (at least 11, all are exported )
func NewTruncateTableQuery (db *DB ) *TruncateTableQuery
func Conn .NewTruncateTable () *TruncateTableQuery
func (*DB ).NewTruncateTable () *TruncateTableQuery
func IDB .NewTruncateTable () *TruncateTableQuery
func (*TruncateTableQuery).Conn (db IConn ) *TruncateTableQuery
func (*TruncateTableQuery).ContinueIdentity () *TruncateTableQuery
func (*TruncateTableQuery).Model (model interface{}) *TruncateTableQuery
func (*TruncateTableQuery).Restrict () *TruncateTableQuery
func (*TruncateTableQuery).Table (tables ...string ) *TruncateTableQuery
func (*TruncateTableQuery).TableExpr (query string , args ...interface{}) *TruncateTableQuery
func Tx .NewTruncateTable () *TruncateTableQuery
type Tx (struct)
Fields (total 12, in which 1 are exported )
Tx *sql .Tx
/* 11 unexporteds ... */ /* 11 unexporteds: */
db *DB
Tx .cancel func()
cancel is called after done transitions from 0 to 1.
Tx .closemu sync .RWMutex
closemu prevents the transaction from closing while there
is an active query. It is held for read during queries
and exclusively during close.
Tx .ctx context .Context
ctx lives for the life of the transaction.
Tx .db *sql .DB
Tx .dc *sql .driverConn
dc is owned exclusively until Commit or Rollback, at which point
it's returned with putConn.
Tx .done int32
done transitions from 0 to 1 exactly once, on Commit
or Rollback. once done, all operations fail with
ErrTxDone.
Use atomic operations on value when checking value.
Tx .keepConnOnRollback bool
keepConnOnRollback is true if the driver knows
how to reset the connection's session and if need be discard
the connection.
Tx .releaseConn func(error )
releaseConn is called once the Tx is closed to release
any held driverConn back to the pool.
Tx .stmts struct{sync .Mutex ; v []*sql .Stmt }
All Stmts prepared for this transaction. These will be closed after the
transaction has been committed or rolled back.
Tx .txi driver .Tx
Methods (total 32, in which 24 are exported )
( T) Commit () error
Commit commits the transaction.
( T) Exec (query string , args ...interface{}) (sql .Result , error )
( T) ExecContext (ctx context .Context , query string , args ...interface{}) (sql .Result , error )
( T) NewAddColumn () *AddColumnQuery
( T) NewCreateIndex () *CreateIndexQuery
( T) NewCreateTable () *CreateTableQuery
( T) NewDelete () *DeleteQuery
( T) NewDropColumn () *DropColumnQuery
( T) NewDropIndex () *DropIndexQuery
( T) NewDropTable () *DropTableQuery
( T) NewInsert () *InsertQuery
( T) NewSelect () *SelectQuery
( T) NewTruncateTable () *TruncateTableQuery
( T) NewUpdate () *UpdateQuery
( T) NewValues (model interface{}) *ValuesQuery
( T) Prepare (query string ) (*sql .Stmt , error )
Prepare creates a prepared statement for use within a transaction.
The returned statement operates within the transaction and can no longer
be used once the transaction has been committed or rolled back.
To use an existing prepared statement on this transaction, see Tx.Stmt.
( T) PrepareContext (ctx context .Context , query string ) (*sql .Stmt , error )
PrepareContext creates a prepared statement for use within a transaction.
The returned statement operates within the transaction and will be closed
when the transaction has been committed or rolled back.
To use an existing prepared statement on this transaction, see Tx.Stmt.
The provided context will be used for the preparation of the context, not
for the execution of the returned statement. The returned statement
will run in the transaction context.
( T) Query (query string , args ...interface{}) (*sql .Rows , error )
( T) QueryContext (ctx context .Context , query string , args ...interface{}) (*sql .Rows , error )
( T) QueryRow (query string , args ...interface{}) *sql .Row
( T) QueryRowContext (ctx context .Context , query string , args ...interface{}) *sql .Row
( T) Rollback () error
Rollback aborts the transaction.
( T) Stmt (stmt *sql .Stmt ) *sql .Stmt
Stmt returns a transaction-specific prepared statement from
an existing statement.
Example:
updateMoney, err := db.Prepare("UPDATE balance SET money=money+? WHERE id=?")
...
tx, err := db.Begin()
...
res, err := tx.Stmt(updateMoney).Exec(123.45, 98293203)
The returned statement operates within the transaction and will be closed
when the transaction has been committed or rolled back.
( T) StmtContext (ctx context .Context , stmt *sql .Stmt ) *sql .Stmt
StmtContext returns a transaction-specific prepared statement from
an existing statement.
Example:
updateMoney, err := db.Prepare("UPDATE balance SET money=money+? WHERE id=?")
...
tx, err := db.Begin()
...
res, err := tx.StmtContext(ctx, updateMoney).Exec(123.45, 98293203)
The provided context is used for the preparation of the statement, not for the
execution of the statement.
The returned statement operates within the transaction and will be closed
when the transaction has been committed or rolled back.
/* 8 unexporteds ... */ /* 8 unexporteds: */
( T) awaitDone ()
awaitDone blocks until the context in Tx is canceled and rolls back
the transaction if it's not already done.
( T) close (err error )
close returns the connection to the pool and
must only be called by Tx.rollback or Tx.Commit while
tx is already canceled and won't be executed concurrently.
( T) closePrepared ()
Closes all Stmts prepared for this transaction.
( T) closemuRUnlockRelease (error )
closemuRUnlockRelease is used as a func(error) method value in
ExecContext and QueryContext. Unlocking in the releaseConn keeps
the driver conn from being returned to the connection pool until
the Rows has been closed.
( T) grabConn (ctx context .Context ) (*sql .driverConn , sql .releaseConn , error )
( T) isDone () bool
( T) rollback (discardConn bool ) error
rollback aborts the transaction and optionally forces the pool to discard
the connection.
( T) txCtx () context .Context
Implements (at least 4, in which 3 are exported )
T : IConn
T : IDB
T : database/sql/driver.Tx
/* at least one unexported ... */ /* at least one unexported: */
T : database/sql.stmtConnGrabber
As Outputs Of (at least 2, both are exported )
func (*DB ).Begin () (Tx , error )
func (*DB ).BeginTx (ctx context .Context , opts *sql .TxOptions ) (Tx , error )
type UpdateQuery (struct)
Fields (total 23, none are exported )
/* 23 unexporteds ... */ /* 23 unexporteds: */
customValueQuery customValueQuery
customValueQuery .extraValues []columnValue
customValueQuery .modelValues map[string ]schema .QueryWithArgs
omitZero bool
returningQuery returningQuery
returningQuery .returning []schema .QueryWithArgs
returningQuery .returningFields []*schema .Field
setQuery setQuery
setQuery .set []schema .QueryWithArgs
whereBaseQuery whereBaseQuery
whereBaseQuery .baseQuery baseQuery
whereBaseQuery .baseQuery .columns []schema .QueryWithArgs
whereBaseQuery .baseQuery .conn IConn
whereBaseQuery .baseQuery .db *DB
whereBaseQuery .baseQuery .err error
whereBaseQuery .baseQuery .flags internal .Flag
whereBaseQuery .baseQuery .model model
whereBaseQuery .baseQuery .modelTable schema .QueryWithArgs
whereBaseQuery .baseQuery .table *schema .Table
whereBaseQuery .baseQuery .tableModel tableModel
whereBaseQuery .baseQuery .tables []schema .QueryWithArgs
whereBaseQuery .baseQuery .with []withQuery
whereBaseQuery .where []schema .QueryWithSep
Methods (total 76, in which 26 are exported )
(*T) AppendNamedArg (fmter schema .Formatter , b []byte , name string ) ([]byte , bool )
(*T) AppendQuery (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) Apply (fn func(*UpdateQuery ) *UpdateQuery ) *UpdateQuery
Apply calls the fn passing the SelectQuery as an argument.
(*T) Bulk () *UpdateQuery
(*T) Column (columns ...string ) *UpdateQuery
(*T) Conn (db IConn ) *UpdateQuery
(*T) DB () *DB
(*T) ExcludeColumn (columns ...string ) *UpdateQuery
(*T) Exec (ctx context .Context , dest ...interface{}) (sql .Result , error )
(*T) FQN (name string ) Ident
FQN returns a fully qualified column name. For MySQL, it returns the column name with
the table alias. For other RDBMS, it returns just the column name.
(*T) GetModel () Model
(*T) Model (model interface{}) *UpdateQuery
(*T) ModelTableExpr (query string , args ...interface{}) *UpdateQuery
(*T) Operation () string
(*T) Returning (query string , args ...interface{}) *UpdateQuery
Returning adds a RETURNING clause to the query.
To suppress the auto-generated RETURNING clause, use `Returning("NULL")`.
(*T) Set (query string , args ...interface{}) *UpdateQuery
(*T) Table (tables ...string ) *UpdateQuery
(*T) TableExpr (query string , args ...interface{}) *UpdateQuery
(*T) Value (column string , expr string , args ...interface{}) *UpdateQuery
Value overwrites model value for the column.
(*T) Where (query string , args ...interface{}) *UpdateQuery
(*T) WhereAllWithDeleted () *UpdateQuery
(*T) WhereDeleted () *UpdateQuery
(*T) WhereGroup (sep string , fn func(*UpdateQuery ) *UpdateQuery ) *UpdateQuery
(*T) WhereOr (query string , args ...interface{}) *UpdateQuery
(*T) WherePK () *UpdateQuery
(*T) With (name string , query schema .QueryAppender ) *UpdateQuery
/* 50 unexporteds ... */ /* 50 unexporteds: */
(*T) _appendFirstTable (fmter schema .Formatter , b []byte , withAlias bool ) ([]byte , error )
(*T) _appendTables (fmter schema .Formatter , b []byte , withAlias bool ) (_ []byte , err error )
(*T) _excludeColumn (column string ) bool
(*T) _getFields (omitPK bool ) ([]*schema .Field , error )
(*T) addColumn (column schema .QueryWithArgs )
(*T) addReturning (ret schema .QueryWithArgs )
(*T) addReturningField (field *schema .Field )
(*T) addSet (set schema .QueryWithArgs )
(*T) addTable (table schema .QueryWithArgs )
(*T) addValue (table *schema .Table , column string , value string , args []interface{})
(*T) addWhere (where schema .QueryWithSep )
(*T) addWhereGroup (sep string , where []schema .QueryWithSep )
(*T) addWith (name string , query schema .QueryAppender )
(*T) afterUpdateHook (ctx context .Context ) error
(*T) appendColumns (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendFirstTable (fmter schema .Formatter , b []byte ) ([]byte , error )
(*T) appendFirstTableWithAlias (fmter schema .Formatter , b []byte ) ([]byte , error )
(*T) appendOtherTables (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendReturning (fmter schema .Formatter , b []byte ) (_ []byte , err error )
( T) appendSet (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendSetStruct (fmter schema .Formatter , b []byte , model *structTableModel ) ([]byte , error )
(*T) appendTables (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendTablesWithAlias (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendWhere (fmter schema .Formatter , b []byte , withAlias bool ) (_ []byte , err error )
(*T) appendWherePK (fmter schema .Formatter , b []byte , withAlias bool ) (_ []byte , err error )
(*T) appendWherePKSlice (fmter schema .Formatter , b []byte , model *sliceTableModel , withAlias bool ) (_ []byte , err error )
(*T) appendWherePKStruct (fmter schema .Formatter , b []byte , model *structTableModel , withAlias bool ) (_ []byte , err error )
(*T) appendWith (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) beforeUpdateHook (ctx context .Context ) error
(*T) checkSoftDelete () error
(*T) excludeColumn (columns []string )
(*T) exec (ctx context .Context , queryApp schema .Query , query string ) (sql .Result , error )
(*T) getDataFields () ([]*schema .Field , error )
(*T) getFields () ([]*schema .Field , error )
(*T) getModel (dest []interface{}) (model , error )
(*T) hasMultiTables () bool
(*T) hasReturning () bool
(*T) hasTables () bool
(*T) isSoftDelete () bool
(*T) modelHasTableName () bool
(*T) mustAppendSet (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) mustAppendWhere (fmter schema .Formatter , b []byte , withAlias bool ) ([]byte , error )
(*T) scan (ctx context .Context , queryApp schema .Query , query string , model model , hasDest bool ) (sql .Result , error )
(*T) setConn (db IConn )
(*T) setErr (err error )
(*T) setTableModel (modeli interface{})
TODO: rename to setModel
(*T) updateSliceSet (fmter schema .Formatter , model *sliceTableModel ) (string , error )
(*T) updateSliceWhere (model *sliceTableModel ) string
(*T) whereAllWithDeleted ()
AllWithDeleted changes query to return all rows including soft deleted ones.
(*T) whereDeleted ()
Deleted adds `WHERE deleted_at IS NOT NULL` clause for soft deleted models.
Implements (at least 3, all are exported )
*T : github.com/uptrace/bun/schema.NamedArgAppender
*T : github.com/uptrace/bun/schema.Query
*T : github.com/uptrace/bun/schema.QueryAppender
As Outputs Of (at least 24, all are exported )
func NewUpdateQuery (db *DB ) *UpdateQuery
func Conn .NewUpdate () *UpdateQuery
func (*DB ).NewUpdate () *UpdateQuery
func IDB .NewUpdate () *UpdateQuery
func Tx .NewUpdate () *UpdateQuery
func (*UpdateQuery).Apply (fn func(*UpdateQuery ) *UpdateQuery ) *UpdateQuery
func (*UpdateQuery).Bulk () *UpdateQuery
func (*UpdateQuery).Column (columns ...string ) *UpdateQuery
func (*UpdateQuery).Conn (db IConn ) *UpdateQuery
func (*UpdateQuery).ExcludeColumn (columns ...string ) *UpdateQuery
func (*UpdateQuery).Model (model interface{}) *UpdateQuery
func (*UpdateQuery).ModelTableExpr (query string , args ...interface{}) *UpdateQuery
func (*UpdateQuery).Returning (query string , args ...interface{}) *UpdateQuery
func (*UpdateQuery).Set (query string , args ...interface{}) *UpdateQuery
func (*UpdateQuery).Table (tables ...string ) *UpdateQuery
func (*UpdateQuery).TableExpr (query string , args ...interface{}) *UpdateQuery
func (*UpdateQuery).Value (column string , expr string , args ...interface{}) *UpdateQuery
func (*UpdateQuery).Where (query string , args ...interface{}) *UpdateQuery
func (*UpdateQuery).WhereAllWithDeleted () *UpdateQuery
func (*UpdateQuery).WhereDeleted () *UpdateQuery
func (*UpdateQuery).WhereGroup (sep string , fn func(*UpdateQuery ) *UpdateQuery ) *UpdateQuery
func (*UpdateQuery).WhereOr (query string , args ...interface{}) *UpdateQuery
func (*UpdateQuery).WherePK () *UpdateQuery
func (*UpdateQuery).With (name string , query schema .QueryAppender ) *UpdateQuery
As Inputs Of (at least 2, both are exported )
func AfterUpdateHook .AfterUpdate (ctx context .Context , query *UpdateQuery ) error
func BeforeUpdateHook .BeforeUpdate (ctx context .Context , query *UpdateQuery ) error
type ValuesQuery (struct)
Fields (total 16, none are exported )
/* 16 unexporteds ... */ /* 16 unexporteds: */
baseQuery baseQuery
baseQuery .columns []schema .QueryWithArgs
baseQuery .conn IConn
baseQuery .db *DB
baseQuery .err error
baseQuery .flags internal .Flag
baseQuery .model model
baseQuery .modelTable schema .QueryWithArgs
baseQuery .table *schema .Table
baseQuery .tableModel tableModel
baseQuery .tables []schema .QueryWithArgs
baseQuery .with []withQuery
customValueQuery customValueQuery
customValueQuery .extraValues []columnValue
customValueQuery .modelValues map[string ]schema .QueryWithArgs
withOrder bool
Methods (total 42, in which 9 are exported )
(*T) AppendColumns (fmter schema .Formatter , b []byte ) (_ []byte , err error )
AppendColumns appends the table columns. It is used by CTE.
(*T) AppendNamedArg (fmter schema .Formatter , b []byte , name string ) ([]byte , bool )
(*T) AppendQuery (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) Conn (db IConn ) *ValuesQuery
(*T) DB () *DB
(*T) GetModel () Model
(*T) Operation () string
(*T) Value (column string , expr string , args ...interface{}) *ValuesQuery
Value overwrites model value for the column.
(*T) WithOrder () *ValuesQuery
/* 33 unexporteds ... */ /* 33 unexporteds: */
(*T) _appendFirstTable (fmter schema .Formatter , b []byte , withAlias bool ) ([]byte , error )
(*T) _appendTables (fmter schema .Formatter , b []byte , withAlias bool ) (_ []byte , err error )
(*T) _excludeColumn (column string ) bool
(*T) _getFields (omitPK bool ) ([]*schema .Field , error )
(*T) addColumn (column schema .QueryWithArgs )
(*T) addTable (table schema .QueryWithArgs )
(*T) addValue (table *schema .Table , column string , value string , args []interface{})
(*T) addWith (name string , query schema .QueryAppender )
(*T) appendColumns (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendFirstTable (fmter schema .Formatter , b []byte ) ([]byte , error )
(*T) appendFirstTableWithAlias (fmter schema .Formatter , b []byte ) ([]byte , error )
(*T) appendOtherTables (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendQuery (fmter schema .Formatter , b []byte , fields []*schema .Field ) (_ []byte , err error )
(*T) appendTables (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendTablesWithAlias (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendValues (fmter schema .Formatter , b []byte , fields []*schema .Field , strct reflect .Value ) (_ []byte , err error )
(*T) appendWith (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) checkSoftDelete () error
(*T) excludeColumn (columns []string )
(*T) exec (ctx context .Context , queryApp schema .Query , query string ) (sql .Result , error )
(*T) getDataFields () ([]*schema .Field , error )
(*T) getFields () ([]*schema .Field , error )
(*T) getModel (dest []interface{}) (model , error )
(*T) hasMultiTables () bool
(*T) hasTables () bool
(*T) isSoftDelete () bool
(*T) modelHasTableName () bool
(*T) scan (ctx context .Context , queryApp schema .Query , query string , model model , hasDest bool ) (sql .Result , error )
(*T) setConn (db IConn )
(*T) setErr (err error )
(*T) setTableModel (modeli interface{})
TODO: rename to setModel
(*T) whereAllWithDeleted ()
AllWithDeleted changes query to return all rows including soft deleted ones.
(*T) whereDeleted ()
Deleted adds `WHERE deleted_at IS NOT NULL` clause for soft deleted models.
Implements (at least 4, all are exported )
*T : github.com/uptrace/bun/schema.ColumnsAppender
*T : github.com/uptrace/bun/schema.NamedArgAppender
*T : github.com/uptrace/bun/schema.Query
*T : github.com/uptrace/bun/schema.QueryAppender
As Outputs Of (at least 8, all are exported )
func NewValuesQuery (db *DB , model interface{}) *ValuesQuery
func Conn .NewValues (model interface{}) *ValuesQuery
func (*DB ).NewValues (model interface{}) *ValuesQuery
func IDB .NewValues (model interface{}) *ValuesQuery
func Tx .NewValues (model interface{}) *ValuesQuery
func (*ValuesQuery).Conn (db IConn ) *ValuesQuery
func (*ValuesQuery).Value (column string , expr string , args ...interface{}) *ValuesQuery
func (*ValuesQuery).WithOrder () *ValuesQuery
/* 25 unexporteds ... */ /* 25 unexporteds: */ type baseQuery (struct)
Fields (total 11, none are exported )
/* 11 unexporteds ... */ /* 11 unexporteds: */
columns []schema .QueryWithArgs
conn IConn
db *DB
err error
flags internal .Flag
model model
modelTable schema .QueryWithArgs
table *schema .Table
tableModel tableModel
tables []schema .QueryWithArgs
with []withQuery
Methods (total 33, in which 3 are exported )
(*T) AppendNamedArg (fmter schema .Formatter , b []byte , name string ) ([]byte , bool )
(*T) DB () *DB
(*T) GetModel () Model
/* 30 unexporteds ... */ /* 30 unexporteds: */
(*T) _appendFirstTable (fmter schema .Formatter , b []byte , withAlias bool ) ([]byte , error )
(*T) _appendTables (fmter schema .Formatter , b []byte , withAlias bool ) (_ []byte , err error )
(*T) _excludeColumn (column string ) bool
(*T) _getFields (omitPK bool ) ([]*schema .Field , error )
(*T) addColumn (column schema .QueryWithArgs )
(*T) addTable (table schema .QueryWithArgs )
(*T) addWith (name string , query schema .QueryAppender )
(*T) appendColumns (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendFirstTable (fmter schema .Formatter , b []byte ) ([]byte , error )
(*T) appendFirstTableWithAlias (fmter schema .Formatter , b []byte ) ([]byte , error )
(*T) appendOtherTables (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendTables (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendTablesWithAlias (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendWith (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) checkSoftDelete () error
(*T) excludeColumn (columns []string )
(*T) exec (ctx context .Context , queryApp schema .Query , query string ) (sql .Result , error )
(*T) getDataFields () ([]*schema .Field , error )
(*T) getFields () ([]*schema .Field , error )
(*T) getModel (dest []interface{}) (model , error )
(*T) hasMultiTables () bool
(*T) hasTables () bool
(*T) isSoftDelete () bool
(*T) modelHasTableName () bool
(*T) scan (ctx context .Context , queryApp schema .Query , query string , model model , hasDest bool ) (sql .Result , error )
(*T) setConn (db IConn )
(*T) setErr (err error )
(*T) setTableModel (modeli interface{})
TODO: rename to setModel
(*T) whereAllWithDeleted ()
AllWithDeleted changes query to return all rows including soft deleted ones.
(*T) whereDeleted ()
Deleted adds `WHERE deleted_at IS NOT NULL` clause for soft deleted models.
Implements (at least one exported )
*T : github.com/uptrace/bun/schema.NamedArgAppender
type countQuery (struct)
Fields (total 24, in which 1 are exported )
SelectQuery *SelectQuery
/* 23 unexporteds ... */ /* 23 unexporteds: */
SelectQuery .distinctOn []schema .QueryWithArgs
SelectQuery .group []schema .QueryWithArgs
SelectQuery .having []schema .QueryWithArgs
SelectQuery .joins []joinQuery
SelectQuery .limit int32
SelectQuery .offset int32
SelectQuery .order []schema .QueryWithArgs
SelectQuery .selFor schema .QueryWithArgs
SelectQuery .union []union
SelectQuery .whereBaseQuery whereBaseQuery
SelectQuery .whereBaseQuery .baseQuery baseQuery
SelectQuery .whereBaseQuery .baseQuery .columns []schema .QueryWithArgs
SelectQuery .whereBaseQuery .baseQuery .conn IConn
SelectQuery .whereBaseQuery .baseQuery .db *DB
SelectQuery .whereBaseQuery .baseQuery .err error
SelectQuery .whereBaseQuery .baseQuery .flags internal .Flag
SelectQuery .whereBaseQuery .baseQuery .model model
SelectQuery .whereBaseQuery .baseQuery .modelTable schema .QueryWithArgs
SelectQuery .whereBaseQuery .baseQuery .table *schema .Table
SelectQuery .whereBaseQuery .baseQuery .tableModel tableModel
SelectQuery .whereBaseQuery .baseQuery .tables []schema .QueryWithArgs
SelectQuery .whereBaseQuery .baseQuery .with []withQuery
SelectQuery .whereBaseQuery .where []schema .QueryWithSep
Methods (total 94, in which 47 are exported )
( T) AppendNamedArg (fmter schema .Formatter , b []byte , name string ) ([]byte , bool )
( T) AppendQuery (fmter schema .Formatter , b []byte ) (_ []byte , err error )
( T) Apply (fn func(*SelectQuery ) *SelectQuery ) *SelectQuery
Apply calls the fn passing the SelectQuery as an argument.
( T) Column (columns ...string ) *SelectQuery
( T) ColumnExpr (query string , args ...interface{}) *SelectQuery
( T) Conn (db IConn ) *SelectQuery
( T) Count (ctx context .Context ) (int , error )
( T) DB () *DB
( T) Distinct () *SelectQuery
( T) DistinctOn (query string , args ...interface{}) *SelectQuery
( T) Except (other *SelectQuery ) *SelectQuery
( T) ExceptAll (other *SelectQuery ) *SelectQuery
( T) ExcludeColumn (columns ...string ) *SelectQuery
( T) Exec (ctx context .Context ) (res sql .Result , err error )
( T) Exists (ctx context .Context ) (bool , error )
( T) For (s string , args ...interface{}) *SelectQuery
( T) GetModel () Model
( T) Group (columns ...string ) *SelectQuery
( T) GroupExpr (group string , args ...interface{}) *SelectQuery
( T) Having (having string , args ...interface{}) *SelectQuery
( T) Intersect (other *SelectQuery ) *SelectQuery
( T) IntersectAll (other *SelectQuery ) *SelectQuery
( T) Join (join string , args ...interface{}) *SelectQuery
( T) JoinOn (cond string , args ...interface{}) *SelectQuery
( T) JoinOnOr (cond string , args ...interface{}) *SelectQuery
( T) Limit (n int ) *SelectQuery
( T) Model (model interface{}) *SelectQuery
( T) ModelTableExpr (query string , args ...interface{}) *SelectQuery
( T) Offset (n int ) *SelectQuery
( T) Operation () string
( T) Order (orders ...string ) *SelectQuery
( T) OrderExpr (query string , args ...interface{}) *SelectQuery
( T) Relation (name string , apply ...func(*SelectQuery ) *SelectQuery ) *SelectQuery
Relation adds a relation to the query.
( T) Rows (ctx context .Context ) (*sql .Rows , error )
( T) Scan (ctx context .Context , dest ...interface{}) error
( T) ScanAndCount (ctx context .Context , dest ...interface{}) (int , error )
( T) Table (tables ...string ) *SelectQuery
( T) TableExpr (query string , args ...interface{}) *SelectQuery
( T) Union (other *SelectQuery ) *SelectQuery
( T) UnionAll (other *SelectQuery ) *SelectQuery
( T) Where (query string , args ...interface{}) *SelectQuery
( T) WhereAllWithDeleted () *SelectQuery
( T) WhereDeleted () *SelectQuery
( T) WhereGroup (sep string , fn func(*SelectQuery ) *SelectQuery ) *SelectQuery
( T) WhereOr (query string , args ...interface{}) *SelectQuery
( T) WherePK () *SelectQuery
( T) With (name string , query schema .QueryAppender ) *SelectQuery
/* 47 unexporteds ... */ /* 47 unexporteds: */
( T) _appendFirstTable (fmter schema .Formatter , b []byte , withAlias bool ) ([]byte , error )
( T) _appendTables (fmter schema .Formatter , b []byte , withAlias bool ) (_ []byte , err error )
( T) _excludeColumn (column string ) bool
( T) _forEachHasOneJoin (fn func(*relationJoin ) error , joins []relationJoin ) error
( T) _getFields (omitPK bool ) ([]*schema .Field , error )
( T) addColumn (column schema .QueryWithArgs )
( T) addTable (table schema .QueryWithArgs )
( T) addUnion (expr string , other *SelectQuery ) *SelectQuery
( T) addWhere (where schema .QueryWithSep )
( T) addWhereGroup (sep string , where []schema .QueryWithSep )
( T) addWith (name string , query schema .QueryAppender )
( T) afterSelectHook (ctx context .Context ) error
( T) appendColumns (fmter schema .Formatter , b []byte ) (_ []byte , err error )
( T) appendFirstTable (fmter schema .Formatter , b []byte ) ([]byte , error )
( T) appendFirstTableWithAlias (fmter schema .Formatter , b []byte ) ([]byte , error )
( T) appendHasOneColumns (fmter schema .Formatter , b []byte , join *relationJoin ) (_ []byte , err error )
( T) appendOrder (fmter schema .Formatter , b []byte ) (_ []byte , err error )
( T) appendOtherTables (fmter schema .Formatter , b []byte ) (_ []byte , err error )
( T) appendQuery (fmter schema .Formatter , b []byte , count bool ) (_ []byte , err error )
( T) appendTables (fmter schema .Formatter , b []byte ) (_ []byte , err error )
( T) appendTablesWithAlias (fmter schema .Formatter , b []byte ) (_ []byte , err error )
( T) appendWhere (fmter schema .Formatter , b []byte , withAlias bool ) (_ []byte , err error )
( T) appendWherePK (fmter schema .Formatter , b []byte , withAlias bool ) (_ []byte , err error )
( T) appendWherePKSlice (fmter schema .Formatter , b []byte , model *sliceTableModel , withAlias bool ) (_ []byte , err error )
( T) appendWherePKStruct (fmter schema .Formatter , b []byte , model *structTableModel , withAlias bool ) (_ []byte , err error )
( T) appendWith (fmter schema .Formatter , b []byte ) (_ []byte , err error )
( T) beforeSelectHook (ctx context .Context ) error
( T) checkSoftDelete () error
( T) excludeColumn (columns []string )
( T) exec (ctx context .Context , queryApp schema .Query , query string ) (sql .Result , error )
( T) forEachHasOneJoin (fn func(*relationJoin ) error ) error
( T) getDataFields () ([]*schema .Field , error )
( T) getFields () ([]*schema .Field , error )
( T) getModel (dest []interface{}) (model , error )
( T) hasMultiTables () bool
( T) hasTables () bool
( T) isSoftDelete () bool
( T) joinOn (cond string , args []interface{}, sep string ) *SelectQuery
( T) modelHasTableName () bool
( T) mustAppendWhere (fmter schema .Formatter , b []byte , withAlias bool ) ([]byte , error )
( T) scan (ctx context .Context , queryApp schema .Query , query string , model model , hasDest bool ) (sql .Result , error )
( T) selectJoins (ctx context .Context , joins []relationJoin ) error
( T) setConn (db IConn )
( T) setErr (err error )
( T) setTableModel (modeli interface{})
TODO: rename to setModel
( T) whereAllWithDeleted ()
AllWithDeleted changes query to return all rows including soft deleted ones.
( T) whereDeleted ()
Deleted adds `WHERE deleted_at IS NOT NULL` clause for soft deleted models.
Implements (at least 3, all are exported )
T : github.com/uptrace/bun/schema.NamedArgAppender
T : github.com/uptrace/bun/schema.Query
T : github.com/uptrace/bun/schema.QueryAppender
type existsQuery (struct)
Fields (total 24, in which 1 are exported )
SelectQuery *SelectQuery
/* 23 unexporteds ... */ /* 23 unexporteds: */
SelectQuery .distinctOn []schema .QueryWithArgs
SelectQuery .group []schema .QueryWithArgs
SelectQuery .having []schema .QueryWithArgs
SelectQuery .joins []joinQuery
SelectQuery .limit int32
SelectQuery .offset int32
SelectQuery .order []schema .QueryWithArgs
SelectQuery .selFor schema .QueryWithArgs
SelectQuery .union []union
SelectQuery .whereBaseQuery whereBaseQuery
SelectQuery .whereBaseQuery .baseQuery baseQuery
SelectQuery .whereBaseQuery .baseQuery .columns []schema .QueryWithArgs
SelectQuery .whereBaseQuery .baseQuery .conn IConn
SelectQuery .whereBaseQuery .baseQuery .db *DB
SelectQuery .whereBaseQuery .baseQuery .err error
SelectQuery .whereBaseQuery .baseQuery .flags internal .Flag
SelectQuery .whereBaseQuery .baseQuery .model model
SelectQuery .whereBaseQuery .baseQuery .modelTable schema .QueryWithArgs
SelectQuery .whereBaseQuery .baseQuery .table *schema .Table
SelectQuery .whereBaseQuery .baseQuery .tableModel tableModel
SelectQuery .whereBaseQuery .baseQuery .tables []schema .QueryWithArgs
SelectQuery .whereBaseQuery .baseQuery .with []withQuery
SelectQuery .whereBaseQuery .where []schema .QueryWithSep
Methods (total 94, in which 47 are exported )
( T) AppendNamedArg (fmter schema .Formatter , b []byte , name string ) ([]byte , bool )
( T) AppendQuery (fmter schema .Formatter , b []byte ) (_ []byte , err error )
( T) Apply (fn func(*SelectQuery ) *SelectQuery ) *SelectQuery
Apply calls the fn passing the SelectQuery as an argument.
( T) Column (columns ...string ) *SelectQuery
( T) ColumnExpr (query string , args ...interface{}) *SelectQuery
( T) Conn (db IConn ) *SelectQuery
( T) Count (ctx context .Context ) (int , error )
( T) DB () *DB
( T) Distinct () *SelectQuery
( T) DistinctOn (query string , args ...interface{}) *SelectQuery
( T) Except (other *SelectQuery ) *SelectQuery
( T) ExceptAll (other *SelectQuery ) *SelectQuery
( T) ExcludeColumn (columns ...string ) *SelectQuery
( T) Exec (ctx context .Context ) (res sql .Result , err error )
( T) Exists (ctx context .Context ) (bool , error )
( T) For (s string , args ...interface{}) *SelectQuery
( T) GetModel () Model
( T) Group (columns ...string ) *SelectQuery
( T) GroupExpr (group string , args ...interface{}) *SelectQuery
( T) Having (having string , args ...interface{}) *SelectQuery
( T) Intersect (other *SelectQuery ) *SelectQuery
( T) IntersectAll (other *SelectQuery ) *SelectQuery
( T) Join (join string , args ...interface{}) *SelectQuery
( T) JoinOn (cond string , args ...interface{}) *SelectQuery
( T) JoinOnOr (cond string , args ...interface{}) *SelectQuery
( T) Limit (n int ) *SelectQuery
( T) Model (model interface{}) *SelectQuery
( T) ModelTableExpr (query string , args ...interface{}) *SelectQuery
( T) Offset (n int ) *SelectQuery
( T) Operation () string
( T) Order (orders ...string ) *SelectQuery
( T) OrderExpr (query string , args ...interface{}) *SelectQuery
( T) Relation (name string , apply ...func(*SelectQuery ) *SelectQuery ) *SelectQuery
Relation adds a relation to the query.
( T) Rows (ctx context .Context ) (*sql .Rows , error )
( T) Scan (ctx context .Context , dest ...interface{}) error
( T) ScanAndCount (ctx context .Context , dest ...interface{}) (int , error )
( T) Table (tables ...string ) *SelectQuery
( T) TableExpr (query string , args ...interface{}) *SelectQuery
( T) Union (other *SelectQuery ) *SelectQuery
( T) UnionAll (other *SelectQuery ) *SelectQuery
( T) Where (query string , args ...interface{}) *SelectQuery
( T) WhereAllWithDeleted () *SelectQuery
( T) WhereDeleted () *SelectQuery
( T) WhereGroup (sep string , fn func(*SelectQuery ) *SelectQuery ) *SelectQuery
( T) WhereOr (query string , args ...interface{}) *SelectQuery
( T) WherePK () *SelectQuery
( T) With (name string , query schema .QueryAppender ) *SelectQuery
/* 47 unexporteds ... */ /* 47 unexporteds: */
( T) _appendFirstTable (fmter schema .Formatter , b []byte , withAlias bool ) ([]byte , error )
( T) _appendTables (fmter schema .Formatter , b []byte , withAlias bool ) (_ []byte , err error )
( T) _excludeColumn (column string ) bool
( T) _forEachHasOneJoin (fn func(*relationJoin ) error , joins []relationJoin ) error
( T) _getFields (omitPK bool ) ([]*schema .Field , error )
( T) addColumn (column schema .QueryWithArgs )
( T) addTable (table schema .QueryWithArgs )
( T) addUnion (expr string , other *SelectQuery ) *SelectQuery
( T) addWhere (where schema .QueryWithSep )
( T) addWhereGroup (sep string , where []schema .QueryWithSep )
( T) addWith (name string , query schema .QueryAppender )
( T) afterSelectHook (ctx context .Context ) error
( T) appendColumns (fmter schema .Formatter , b []byte ) (_ []byte , err error )
( T) appendFirstTable (fmter schema .Formatter , b []byte ) ([]byte , error )
( T) appendFirstTableWithAlias (fmter schema .Formatter , b []byte ) ([]byte , error )
( T) appendHasOneColumns (fmter schema .Formatter , b []byte , join *relationJoin ) (_ []byte , err error )
( T) appendOrder (fmter schema .Formatter , b []byte ) (_ []byte , err error )
( T) appendOtherTables (fmter schema .Formatter , b []byte ) (_ []byte , err error )
( T) appendQuery (fmter schema .Formatter , b []byte , count bool ) (_ []byte , err error )
( T) appendTables (fmter schema .Formatter , b []byte ) (_ []byte , err error )
( T) appendTablesWithAlias (fmter schema .Formatter , b []byte ) (_ []byte , err error )
( T) appendWhere (fmter schema .Formatter , b []byte , withAlias bool ) (_ []byte , err error )
( T) appendWherePK (fmter schema .Formatter , b []byte , withAlias bool ) (_ []byte , err error )
( T) appendWherePKSlice (fmter schema .Formatter , b []byte , model *sliceTableModel , withAlias bool ) (_ []byte , err error )
( T) appendWherePKStruct (fmter schema .Formatter , b []byte , model *structTableModel , withAlias bool ) (_ []byte , err error )
( T) appendWith (fmter schema .Formatter , b []byte ) (_ []byte , err error )
( T) beforeSelectHook (ctx context .Context ) error
( T) checkSoftDelete () error
( T) excludeColumn (columns []string )
( T) exec (ctx context .Context , queryApp schema .Query , query string ) (sql .Result , error )
( T) forEachHasOneJoin (fn func(*relationJoin ) error ) error
( T) getDataFields () ([]*schema .Field , error )
( T) getFields () ([]*schema .Field , error )
( T) getModel (dest []interface{}) (model , error )
( T) hasMultiTables () bool
( T) hasTables () bool
( T) isSoftDelete () bool
( T) joinOn (cond string , args []interface{}, sep string ) *SelectQuery
( T) modelHasTableName () bool
( T) mustAppendWhere (fmter schema .Formatter , b []byte , withAlias bool ) ([]byte , error )
( T) scan (ctx context .Context , queryApp schema .Query , query string , model model , hasDest bool ) (sql .Result , error )
( T) selectJoins (ctx context .Context , joins []relationJoin ) error
( T) setConn (db IConn )
( T) setErr (err error )
( T) setTableModel (modeli interface{})
TODO: rename to setModel
( T) whereAllWithDeleted ()
AllWithDeleted changes query to return all rows including soft deleted ones.
( T) whereDeleted ()
Deleted adds `WHERE deleted_at IS NOT NULL` clause for soft deleted models.
Implements (at least 3, all are exported )
T : github.com/uptrace/bun/schema.NamedArgAppender
T : github.com/uptrace/bun/schema.Query
T : github.com/uptrace/bun/schema.QueryAppender
type hasManyModel (struct)
Fields (total 21, none are exported )
/* 21 unexporteds ... */ /* 21 unexporteds: */
baseTable *schema .Table
baseValues map[internal .MapKey ][]reflect .Value
rel *schema .Relation
sliceTableModel *sliceTableModel
sliceTableModel .nextElem func() reflect .Value
sliceTableModel .slice reflect .Value
sliceTableModel .sliceLen int
sliceTableModel .sliceOfPtr bool
sliceTableModel .structTableModel structTableModel
sliceTableModel .structTableModel .columns []string
sliceTableModel .structTableModel .db *DB
sliceTableModel .structTableModel .dest interface{}
sliceTableModel .structTableModel .index []int
sliceTableModel .structTableModel .joins []relationJoin
sliceTableModel .structTableModel .root reflect .Value
sliceTableModel .structTableModel .scanIndex int
sliceTableModel .structTableModel .strct reflect .Value
sliceTableModel .structTableModel .structInitErr error
sliceTableModel .structTableModel .structInited bool
sliceTableModel .structTableModel .table *schema .Table
structKey []interface{}
Methods (total 29, in which 20 are exported )
( T) AddJoin (j relationJoin ) *relationJoin
( T) AfterScan (ctx context .Context ) error
( T) AppendNamedArg (fmter schema .Formatter , b []byte , name string ) ([]byte , bool )
( T) BeforeScan (ctx context .Context ) error
( T) Bind (bind reflect .Value )
( T) GetJoin (name string ) *relationJoin
( T) GetJoins () []relationJoin
( T) Index () []int
( T) Join (name string ) *relationJoin
( T) Mount (host reflect .Value )
( T) ParentIndex () []int
( T) Relation () *schema .Relation
( T) Root () reflect .Value
(*T) Scan (src interface{}) error
( T) ScanColumn (column string , src interface{}) error
( T) ScanRow (ctx context .Context , rows *sql .Rows ) error
(*T) ScanRows (ctx context .Context , rows *sql .Rows ) (int , error )
( T) SetCap (cap int )
( T) Table () *schema .Table
( T) Value () interface{}
/* 9 unexporteds ... */ /* 9 unexporteds: */
( T) init (sliceType reflect .Type )
( T) initStruct () error
( T) isNil () bool
( T) join (bind reflect .Value , name string ) *relationJoin
( T) mountJoins ()
(*T) parkStruct () error
( T) scanColumn (column string , src interface{}) (bool , error )
( T) scanRow (ctx context .Context , rows *sql .Rows , dest []interface{}) error
( T) updateSoftDeleteField (tm time .Time ) error
Implements (at least 8, in which 5 are exported )
*T : Model
T : github.com/uptrace/bun/schema.AfterScanHook
T : github.com/uptrace/bun/schema.BeforeScanHook
T : github.com/uptrace/bun/schema.NamedArgAppender
*T : database/sql.Scanner
/* 3+ unexporteds ... */ /* 3+ unexporteds: */
*T : model
T : rowScanner
*T : tableModel
As Outputs Of (at least one unexported )
/* at least one unexported ... */ /* at least one unexported: */
func newHasManyModel (j *relationJoin ) *hasManyModel
type m2mModel (struct)
Fields (total 21, none are exported )
/* 21 unexporteds ... */ /* 21 unexporteds: */
baseTable *schema .Table
baseValues map[internal .MapKey ][]reflect .Value
rel *schema .Relation
sliceTableModel *sliceTableModel
sliceTableModel .nextElem func() reflect .Value
sliceTableModel .slice reflect .Value
sliceTableModel .sliceLen int
sliceTableModel .sliceOfPtr bool
sliceTableModel .structTableModel structTableModel
sliceTableModel .structTableModel .columns []string
sliceTableModel .structTableModel .db *DB
sliceTableModel .structTableModel .dest interface{}
sliceTableModel .structTableModel .index []int
sliceTableModel .structTableModel .joins []relationJoin
sliceTableModel .structTableModel .root reflect .Value
sliceTableModel .structTableModel .scanIndex int
sliceTableModel .structTableModel .strct reflect .Value
sliceTableModel .structTableModel .structInitErr error
sliceTableModel .structTableModel .structInited bool
sliceTableModel .structTableModel .table *schema .Table
structKey []interface{}
Methods (total 30, in which 20 are exported )
( T) AddJoin (j relationJoin ) *relationJoin
( T) AfterScan (ctx context .Context ) error
( T) AppendNamedArg (fmter schema .Formatter , b []byte , name string ) ([]byte , bool )
( T) BeforeScan (ctx context .Context ) error
( T) Bind (bind reflect .Value )
( T) GetJoin (name string ) *relationJoin
( T) GetJoins () []relationJoin
( T) Index () []int
( T) Join (name string ) *relationJoin
( T) Mount (host reflect .Value )
( T) ParentIndex () []int
( T) Relation () *schema .Relation
( T) Root () reflect .Value
(*T) Scan (src interface{}) error
( T) ScanColumn (column string , src interface{}) error
( T) ScanRow (ctx context .Context , rows *sql .Rows ) error
(*T) ScanRows (ctx context .Context , rows *sql .Rows ) (int , error )
( T) SetCap (cap int )
( T) Table () *schema .Table
( T) Value () interface{}
/* 10 unexporteds ... */ /* 10 unexporteds: */
( T) init (sliceType reflect .Type )
( T) initStruct () error
( T) isNil () bool
( T) join (bind reflect .Value , name string ) *relationJoin
( T) mountJoins ()
(*T) parkStruct () error
( T) scanColumn (column string , src interface{}) (bool , error )
(*T) scanM2MColumn (column string , src interface{}) error
( T) scanRow (ctx context .Context , rows *sql .Rows , dest []interface{}) error
( T) updateSoftDeleteField (tm time .Time ) error
Implements (at least 8, in which 5 are exported )
*T : Model
T : github.com/uptrace/bun/schema.AfterScanHook
T : github.com/uptrace/bun/schema.BeforeScanHook
T : github.com/uptrace/bun/schema.NamedArgAppender
*T : database/sql.Scanner
/* 3+ unexporteds ... */ /* 3+ unexporteds: */
*T : model
T : rowScanner
*T : tableModel
As Outputs Of (at least one unexported )
/* at least one unexported ... */ /* at least one unexported: */
func newM2MModel (j *relationJoin ) *m2mModel
type mapSliceModel (struct)
Fields (total 9, none are exported )
/* 9 unexporteds ... */ /* 9 unexporteds: */
dest *[]map[string ]interface{}
keys []string
mapModel mapModel
mapModel ._columnTypes []*sql .ColumnType
mapModel .columns []string
mapModel .db *DB
mapModel .m map[string ]interface{}
mapModel .rows *sql .Rows
mapModel .scanIndex int
Methods (total 11, in which 4 are exported )
(*T) Scan (src interface{}) error
(*T) ScanRows (ctx context .Context , rows *sql .Rows ) (int , error )
(*T) SetCap (cap int )
(*T) Value () interface{}
/* 7 unexporteds ... */ /* 7 unexporteds: */
(*T) appendColumns (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendColumnsValues (fmter schema .Formatter , b []byte ) []byte
(*T) appendSet (fmter schema .Formatter , b []byte ) []byte
(*T) appendValues (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) columnTypes () ([]*sql .ColumnType , error )
(*T) initKeys () error
(*T) scanRaw (src interface{}) error
Implements (at least 3, in which 2 are exported )
*T : Model
*T : database/sql.Scanner
/* at least one unexported ... */ /* at least one unexported: */
*T : model
As Outputs Of (at least one unexported )
/* at least one unexported ... */ /* at least one unexported: */
func newMapSliceModel (db *DB , dest *[]map[string ]interface{}) *mapSliceModel
type model (interface)
Methods (total 2, both are exported )
( T) ScanRows (ctx context .Context , rows *sql .Rows ) (int , error )
( T) Value () interface{}
Implemented By (at least 10, in which 1 are exported )
Model (interface)
/* 9+ unexporteds ... */ /* 9+ unexporteds: */
*hasManyModel
*m2mModel
*mapModel
*mapSliceModel
*scanModel
*sliceModel
*sliceTableModel
*structTableModel
tableModel (interface)
Implements (at least one exported )
T : Model
As Outputs Of (at least 3, none are exported )
/* 3+ unexporteds ... */ /* 3+ unexporteds: */
func _newModel (db *DB , dest interface{}, scan bool ) (model , error )
func newModel (db *DB , dest []interface{}) (model , error )
func newSingleModel (db *DB , dest interface{}) (model , error )
As Inputs Of (at least one unexported )
/* at least one unexported ... */ /* at least one unexported: */
func isSingleRowModel (m model ) bool
type relationJoin (struct)
Fields (total 6, in which 4 are exported )
BaseModel tableModel
JoinModel tableModel
Parent *relationJoin
Relation *schema .Relation
/* 2 unexporteds ... */ /* 2 unexporteds: */
apply func(*SelectQuery ) *SelectQuery
columns []schema .QueryWithArgs
Methods (total 13, in which 1 are exported )
(*T) Select (ctx context .Context , q *SelectQuery ) error
/* 12 unexporteds ... */ /* 12 unexporteds: */
(*T) appendAlias (fmter schema .Formatter , b []byte ) []byte
(*T) appendAliasColumn (fmter schema .Formatter , b []byte , column string ) []byte
(*T) appendBaseAlias (fmter schema .Formatter , b []byte ) []byte
(*T) appendHasOneJoin (fmter schema .Formatter , b []byte , q *SelectQuery ) (_ []byte , err error )
(*T) appendSoftDelete (b []byte , flags internal .Flag ) []byte
(*T) applyTo (q *SelectQuery )
(*T) hasManyColumns (q *SelectQuery ) *SelectQuery
(*T) hasParent () bool
(*T) m2mQuery (q *SelectQuery ) *SelectQuery
(*T) manyQuery (q *SelectQuery ) *SelectQuery
(*T) selectM2M (ctx context .Context , q *SelectQuery ) error
(*T) selectMany (ctx context .Context , q *SelectQuery ) error
As Inputs Of (at least 6, none are exported )
/* 6+ unexporteds ... */ /* 6+ unexporteds: */
func appendAlias (b []byte , j *relationJoin ) []byte
func newHasManyModel (j *relationJoin ) *hasManyModel
func newM2MModel (j *relationJoin ) *m2mModel
func (*SelectQuery )._forEachHasOneJoin (fn func(*relationJoin ) error , joins []relationJoin ) error
func (*SelectQuery ).appendHasOneColumns (fmter schema .Formatter , b []byte , join *relationJoin ) (_ []byte , err error )
func (*SelectQuery ).selectJoins (ctx context .Context , joins []relationJoin ) error
type sliceTableModel (struct)
Fields (total 17, none are exported )
/* 17 unexporteds ... */ /* 17 unexporteds: */
nextElem func() reflect .Value
slice reflect .Value
sliceLen int
sliceOfPtr bool
structTableModel structTableModel
structTableModel .columns []string
structTableModel .db *DB
structTableModel .dest interface{}
structTableModel .index []int
structTableModel .joins []relationJoin
structTableModel .rel *schema .Relation
structTableModel .root reflect .Value
structTableModel .scanIndex int
structTableModel .strct reflect .Value
structTableModel .structInitErr error
structTableModel .structInited bool
structTableModel .table *schema .Table
Methods (total 28, in which 20 are exported )
(*T) AddJoin (j relationJoin ) *relationJoin
(*T) AfterScan (ctx context .Context ) error
(*T) AppendNamedArg (fmter schema .Formatter , b []byte , name string ) ([]byte , bool )
(*T) BeforeScan (ctx context .Context ) error
(*T) Bind (bind reflect .Value )
(*T) GetJoin (name string ) *relationJoin
(*T) GetJoins () []relationJoin
(*T) Index () []int
(*T) Join (name string ) *relationJoin
(*T) Mount (host reflect .Value )
(*T) ParentIndex () []int
(*T) Relation () *schema .Relation
(*T) Root () reflect .Value
(*T) Scan (src interface{}) error
(*T) ScanColumn (column string , src interface{}) error
(*T) ScanRow (ctx context .Context , rows *sql .Rows ) error
(*T) ScanRows (ctx context .Context , rows *sql .Rows ) (int , error )
(*T) SetCap (cap int )
(*T) Table () *schema .Table
(*T) Value () interface{}
/* 8 unexporteds ... */ /* 8 unexporteds: */
(*T) init (sliceType reflect .Type )
(*T) initStruct () error
(*T) isNil () bool
(*T) join (bind reflect .Value , name string ) *relationJoin
(*T) mountJoins ()
(*T) scanColumn (column string , src interface{}) (bool , error )
(*T) scanRow (ctx context .Context , rows *sql .Rows , dest []interface{}) error
(*T) updateSoftDeleteField (tm time .Time ) error
Implements (at least 8, in which 5 are exported )
*T : Model
*T : github.com/uptrace/bun/schema.AfterScanHook
*T : github.com/uptrace/bun/schema.BeforeScanHook
*T : github.com/uptrace/bun/schema.NamedArgAppender
*T : database/sql.Scanner
/* 3+ unexporteds ... */ /* 3+ unexporteds: */
*T : model
*T : rowScanner
*T : tableModel
As Outputs Of (at least one unexported )
/* at least one unexported ... */ /* at least one unexported: */
func newSliceTableModel (db *DB , dest interface{}, slice reflect .Value , elemType reflect .Type ) *sliceTableModel
As Inputs Of (at least 2, neither is exported )
/* 2+ unexporteds ... */ /* 2+ unexporteds: */
func (*UpdateQuery ).updateSliceSet (fmter schema .Formatter , model *sliceTableModel ) (string , error )
func (*UpdateQuery ).updateSliceWhere (model *sliceTableModel ) string
type structTableModel (struct)
Fields (total 12, none are exported )
/* 12 unexporteds ... */ /* 12 unexporteds: */
columns []string
db *DB
dest interface{}
index []int
joins []relationJoin
rel *schema .Relation
root reflect .Value
scanIndex int
strct reflect .Value
structInitErr error
structInited bool
table *schema .Table
Methods (total 25, in which 18 are exported )
(*T) AddJoin (j relationJoin ) *relationJoin
(*T) AfterScan (ctx context .Context ) error
(*T) AppendNamedArg (fmter schema .Formatter , b []byte , name string ) ([]byte , bool )
(*T) BeforeScan (ctx context .Context ) error
(*T) GetJoin (name string ) *relationJoin
(*T) GetJoins () []relationJoin
(*T) Index () []int
(*T) Join (name string ) *relationJoin
(*T) Mount (host reflect .Value )
(*T) ParentIndex () []int
(*T) Relation () *schema .Relation
(*T) Root () reflect .Value
(*T) Scan (src interface{}) error
(*T) ScanColumn (column string , src interface{}) error
(*T) ScanRow (ctx context .Context , rows *sql .Rows ) error
(*T) ScanRows (ctx context .Context , rows *sql .Rows ) (int , error )
(*T) Table () *schema .Table
(*T) Value () interface{}
/* 7 unexporteds ... */ /* 7 unexporteds: */
(*T) initStruct () error
(*T) isNil () bool
(*T) join (bind reflect .Value , name string ) *relationJoin
(*T) mountJoins ()
(*T) scanColumn (column string , src interface{}) (bool , error )
(*T) scanRow (ctx context .Context , rows *sql .Rows , dest []interface{}) error
(*T) updateSoftDeleteField (tm time .Time ) error
Implements (at least 8, in which 5 are exported )
*T : Model
*T : github.com/uptrace/bun/schema.AfterScanHook
*T : github.com/uptrace/bun/schema.BeforeScanHook
*T : github.com/uptrace/bun/schema.NamedArgAppender
*T : database/sql.Scanner
/* 3+ unexporteds ... */ /* 3+ unexporteds: */
*T : model
*T : rowScanner
*T : tableModel
As Outputs Of (at least 2, neither is exported )
/* 2+ unexporteds ... */ /* 2+ unexporteds: */
func newStructTableModel (db *DB , dest interface{}, table *schema .Table ) *structTableModel
func newStructTableModelValue (db *DB , dest interface{}, v reflect .Value ) *structTableModel
As Inputs Of (at least one unexported )
/* at least one unexported ... */ /* at least one unexported: */
func (*UpdateQuery ).appendSetStruct (fmter schema .Formatter , b []byte , model *structTableModel ) ([]byte , error )
type tableModel (interface)
Methods (total 15, in which 14 are exported )
( T) AddJoin (relationJoin ) *relationJoin
( T) AfterScan (context .Context ) error
( T) BeforeScan (context .Context ) error
( T) GetJoin (string ) *relationJoin
( T) GetJoins () []relationJoin
( T) Join (string ) *relationJoin
( T) Mount (reflect .Value )
( T) ParentIndex () []int
( T) Relation () *schema .Relation
( T) Root () reflect .Value
( T) ScanColumn (column string , src interface{}) error
( T) ScanRows (ctx context .Context , rows *sql .Rows ) (int , error )
( T) Table () *schema .Table
( T) Value () interface{}
/* one unexported ... */ /* one unexported: */
( T) updateSoftDeleteField (time .Time ) error
Implemented By (at least 4, none are exported )
/* 4+ unexporteds ... */ /* 4+ unexporteds: */
*hasManyModel
*m2mModel
*sliceTableModel
*structTableModel
Implements (at least 4, in which 3 are exported )
T : Model
T : github.com/uptrace/bun/schema.AfterScanHook
T : github.com/uptrace/bun/schema.BeforeScanHook
/* at least one unexported ... */ /* at least one unexported: */
T : model
As Outputs Of (at least one unexported )
/* at least one unexported ... */ /* at least one unexported: */
func newTableModelIndex (db *DB , table *schema .Table , root reflect .Value , index []int , rel *schema .Relation ) (tableModel , error )
As Inputs Of (at least one unexported )
/* at least one unexported ... */ /* at least one unexported: */
func baseValues (model tableModel , fields []*schema .Field ) map[internal .MapKey ][]reflect .Value
type whereBaseQuery (struct)
Fields (total 13, none are exported )
/* 13 unexporteds ... */ /* 13 unexporteds: */
baseQuery baseQuery
baseQuery .columns []schema .QueryWithArgs
baseQuery .conn IConn
baseQuery .db *DB
baseQuery .err error
baseQuery .flags internal .Flag
baseQuery .model model
baseQuery .modelTable schema .QueryWithArgs
baseQuery .table *schema .Table
baseQuery .tableModel tableModel
baseQuery .tables []schema .QueryWithArgs
baseQuery .with []withQuery
where []schema .QueryWithSep
Methods (total 40, in which 3 are exported )
(*T) AppendNamedArg (fmter schema .Formatter , b []byte , name string ) ([]byte , bool )
(*T) DB () *DB
(*T) GetModel () Model
/* 37 unexporteds ... */ /* 37 unexporteds: */
(*T) _appendFirstTable (fmter schema .Formatter , b []byte , withAlias bool ) ([]byte , error )
(*T) _appendTables (fmter schema .Formatter , b []byte , withAlias bool ) (_ []byte , err error )
(*T) _excludeColumn (column string ) bool
(*T) _getFields (omitPK bool ) ([]*schema .Field , error )
(*T) addColumn (column schema .QueryWithArgs )
(*T) addTable (table schema .QueryWithArgs )
(*T) addWhere (where schema .QueryWithSep )
(*T) addWhereGroup (sep string , where []schema .QueryWithSep )
(*T) addWith (name string , query schema .QueryAppender )
(*T) appendColumns (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendFirstTable (fmter schema .Formatter , b []byte ) ([]byte , error )
(*T) appendFirstTableWithAlias (fmter schema .Formatter , b []byte ) ([]byte , error )
(*T) appendOtherTables (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendTables (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendTablesWithAlias (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) appendWhere (fmter schema .Formatter , b []byte , withAlias bool ) (_ []byte , err error )
(*T) appendWherePK (fmter schema .Formatter , b []byte , withAlias bool ) (_ []byte , err error )
(*T) appendWherePKSlice (fmter schema .Formatter , b []byte , model *sliceTableModel , withAlias bool ) (_ []byte , err error )
(*T) appendWherePKStruct (fmter schema .Formatter , b []byte , model *structTableModel , withAlias bool ) (_ []byte , err error )
(*T) appendWith (fmter schema .Formatter , b []byte ) (_ []byte , err error )
(*T) checkSoftDelete () error
(*T) excludeColumn (columns []string )
(*T) exec (ctx context .Context , queryApp schema .Query , query string ) (sql .Result , error )
(*T) getDataFields () ([]*schema .Field , error )
(*T) getFields () ([]*schema .Field , error )
(*T) getModel (dest []interface{}) (model , error )
(*T) hasMultiTables () bool
(*T) hasTables () bool
(*T) isSoftDelete () bool
(*T) modelHasTableName () bool
(*T) mustAppendWhere (fmter schema .Formatter , b []byte , withAlias bool ) ([]byte , error )
(*T) scan (ctx context .Context , queryApp schema .Query , query string , model model , hasDest bool ) (sql .Result , error )
(*T) setConn (db IConn )
(*T) setErr (err error )
(*T) setTableModel (modeli interface{})
TODO: rename to setModel
(*T) whereAllWithDeleted ()
AllWithDeleted changes query to return all rows including soft deleted ones.
(*T) whereDeleted ()
Deleted adds `WHERE deleted_at IS NOT NULL` clause for soft deleted models.
Implements (at least one exported )
*T : github.com/uptrace/bun/schema.NamedArgAppender
The pages are generated with Golds v0.3.6 . (GOOS=darwin GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds .