Documentation
¶
Overview ¶
Package xsql provides wrappers around the standard database/sql package to allow the generated code to interact with a statically-typed API.
Index ¶
- Constants
- func As(ident string, as string) string
- func Asc(column string) string
- func Avg(ident string) string
- func Count(ident string) string
- func Desc(column string) string
- func Distinct(idents ...string) string
- func Int64(ctx context.Context, query Querier, eq ExecQuerier) (int64, error)
- func Int64s(ctx context.Context, query Querier, eq ExecQuerier) ([]int64, error)
- func Lower(ident string) string
- func Max(ident string) string
- func Min(ident string) string
- func ScanInt(rows ColumnScanner) (int, error)
- func ScanInt64(rows ColumnScanner) (int64, error)
- func ScanOne(rows ColumnScanner, v interface{}) error
- func ScanSlice(rows ColumnScanner, v interface{}) error
- func ScanString(rows ColumnScanner) (string, error)
- func ScanValue(rows ColumnScanner) (driver.Value, error)
- func Shrink(ctx context.Context, duration time.Duration) (time.Duration, context.Context, context.CancelFunc)
- func String(ctx context.Context, query Querier, eq ExecQuerier) (string, error)
- func Strings(ctx context.Context, query Querier, eq ExecQuerier) ([]string, error)
- func Sum(ident string) string
- type Builder
- func (b *Builder) AddError(err error) *Builder
- func (b *Builder) Arg(a interface{}) *Builder
- func (b *Builder) Args(a ...interface{}) *Builder
- func (b *Builder) Comma() *Builder
- func (b Builder) Dialect() string
- func (b *Builder) Err() error
- func (b *Builder) Ident(s string) *Builder
- func (b *Builder) IdentComma(s ...string) *Builder
- func (b *Builder) Join(qs ...Querier) *Builder
- func (b *Builder) JoinComma(qs ...Querier) *Builder
- func (b *Builder) Len() int
- func (b *Builder) Nested(f func(*Builder)) *Builder
- func (b *Builder) Pad() *Builder
- func (b Builder) Query() (string, []interface{})
- func (b *Builder) Quote(ident string) string
- func (b *Builder) Reset() *Builder
- func (b *Builder) SetDialect(dialect string)
- func (b *Builder) SetTotal(total int)
- func (b *Builder) String() string
- func (b Builder) Total() int
- func (b *Builder) WriteByte(c byte) *Builder
- func (b *Builder) WriteOp(op Op) *Builder
- func (b *Builder) WriteString(s string) *Builder
- type ColumnScanner
- type Config
- type DB
- func (db *DB) BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error)
- func (db *DB) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
- func (db *DB) Master() *sql.DB
- func (db *DB) PingContext(ctx context.Context) error
- func (db *DB) QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
- type DBI
- type DebugDB
- func (d *DebugDB) Begin() (*DebugTx, error)
- func (d *DebugDB) BeginTx(ctx context.Context, opts *sql.TxOptions) (*DebugTx, error)
- func (d *DebugDB) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
- func (d *DebugDB) QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
- type DebugTx
- type DeleteBuilder
- type ExecQuerier
- type ForWhat
- type Func
- type IndexAction
- type IndexOptions
- type InsertBuilder
- func (i *InsertBuilder) Columns(columns ...string) *InsertBuilder
- func (i *InsertBuilder) OnDuplicateKeyUpdate(columns ...string) *InsertBuilder
- func (i *InsertBuilder) OnDuplicateKeyUpdateExpr(q ...Querier) *InsertBuilder
- func (i *InsertBuilder) Query() (string, []interface{})
- func (i *InsertBuilder) Schema(name string) *InsertBuilder
- func (i *InsertBuilder) Set(column string, v interface{}) *InsertBuilder
- func (i *InsertBuilder) Table(name string) *InsertBuilder
- func (i *InsertBuilder) Values(values ...interface{}) *InsertBuilder
- type LockAction
- type LockOption
- type LockOptions
- type LockStrength
- type Logger
- type Op
- type ParamFormatter
- type Predicate
- func And(preds ...*Predicate) *Predicate
- func CompositeGT(columns []string, args ...interface{}) *Predicate
- func CompositeLT(columns []string, args ...interface{}) *Predicate
- func Contains(col, sub string) *Predicate
- func EQ(col string, value interface{}) *Predicate
- func EqualFold(col, sub string) *Predicate
- func ExprP(exr string, args ...interface{}) *Predicate
- func False() *Predicate
- func GT(col string, value interface{}) *Predicate
- func GTE(col string, value interface{}) *Predicate
- func GenP(field, op, value string) (*Predicate, error)
- func HasPrefix(col, prefix string) *Predicate
- func HasSuffix(col, suffix string) *Predicate
- func In(col string, args ...interface{}) *Predicate
- func InInts(col string, args ...int) *Predicate
- func InValues(col string, args ...driver.Value) *Predicate
- func IsNull(col string) *Predicate
- func LT(col string, value interface{}) *Predicate
- func LTE(col string, value interface{}) *Predicate
- func Like(col, pattern string) *Predicate
- func NEQ(col string, value interface{}) *Predicate
- func Not(pred *Predicate) *Predicate
- func NotIn(col string, args ...interface{}) *Predicate
- func NotNull(col string) *Predicate
- func Or(preds ...*Predicate) *Predicate
- func P(fns ...func(*Builder)) *Predicate
- func (p *Predicate) Append(f func(*Builder)) *Predicate
- func (p *Predicate) CompositeGT(columns []string, args ...interface{}) *Predicate
- func (p *Predicate) CompositeLT(columns []string, args ...interface{}) *Predicate
- func (p *Predicate) Contains(col, sub string) *Predicate
- func (p *Predicate) EQ(col string, arg interface{}) *Predicate
- func (p *Predicate) EqualFold(col, sub string) *Predicate
- func (p *Predicate) False() *Predicate
- func (p *Predicate) GT(col string, arg interface{}) *Predicate
- func (p *Predicate) GTE(col string, arg interface{}) *Predicate
- func (p *Predicate) HasPrefix(col, prefix string) *Predicate
- func (p *Predicate) HasSuffix(col, suffix string) *Predicate
- func (p *Predicate) In(col string, args ...interface{}) *Predicate
- func (p *Predicate) InInts(col string, args ...int) *Predicate
- func (p *Predicate) InValues(col string, args ...driver.Value) *Predicate
- func (p *Predicate) IsNull(col string) *Predicate
- func (p *Predicate) LT(col string, arg interface{}) *Predicate
- func (p *Predicate) LTE(col string, arg interface{}) *Predicate
- func (p *Predicate) Like(col, pattern string) *Predicate
- func (p *Predicate) NEQ(col string, arg interface{}) *Predicate
- func (p *Predicate) Not() *Predicate
- func (p *Predicate) NotIn(col string, args ...interface{}) *Predicate
- func (p *Predicate) NotNull(col string) *Predicate
- func (p *Predicate) Query() (string, []interface{})
- type Querier
- type Queries
- type SelectTable
- type Selector
- func (s *Selector) As(alias string) *Selector
- func (s *Selector) C(column string) string
- func (s *Selector) Clone() *Selector
- func (s *Selector) Columns(columns ...string) []string
- func (s *Selector) Context() context.Context
- func (s *Selector) Count(columns ...string) *Selector
- func (s *Selector) Distinct() *Selector
- func (s *Selector) For(l LockStrength, opts ...LockOption) *Selector
- func (s *Selector) ForShare(opts ...LockOption) *Selector
- func (s *Selector) ForUpdate(opts ...LockOption) *Selector
- func (s *Selector) ForceIndex(indexName ...string) *Selector
- func (s *Selector) ForceIndexFor(forwhat ForWhat, indexName ...string) *Selector
- func (s *Selector) From(t TableView) *Selector
- func (s *Selector) FromSelect(s2 *Selector) *Selector
- func (s *Selector) GroupBy(columns ...string) *Selector
- func (s *Selector) Having(p *Predicate) *Selector
- func (s *Selector) IgnoreIndex(indexName ...string) *Selector
- func (s *Selector) IgnoreIndexFor(forwhat ForWhat, indexName ...string) *Selector
- func (s *Selector) Join(t TableView) *Selector
- func (s *Selector) LeftJoin(t TableView) *Selector
- func (s *Selector) Limit(limit int) *Selector
- func (s *Selector) Not() *Selector
- func (s *Selector) Offset(offset int) *Selector
- func (s *Selector) On(c1, c2 string) *Selector
- func (s *Selector) OnP(p *Predicate) *Selector
- func (s *Selector) Or() *Selector
- func (s *Selector) OrderBy(columns ...string) *Selector
- func (s *Selector) OrderExpr(exprs ...Querier) *Selector
- func (s *Selector) P() *Predicate
- func (s *Selector) Query() (string, []interface{})
- func (s *Selector) RightJoin(t TableView) *Selector
- func (s *Selector) Select(columns ...string) *Selector
- func (s *Selector) SelectColumnsLen() int
- func (s *Selector) SelectedColumns() []string
- func (s *Selector) SetDistinct(v bool) *Selector
- func (s *Selector) SetP(p *Predicate) *Selector
- func (s *Selector) Table() *SelectTable
- func (s *Selector) UseIndex(indexName ...string) *Selector
- func (s *Selector) UseIndexFor(forwhat ForWhat, indexName ...string) *Selector
- func (s *Selector) Where(p *Predicate) *Selector
- func (s *Selector) WithContext(ctx context.Context) *Selector
- type StmtInfo
- type TableView
- type UpdateBuilder
- func (u *UpdateBuilder) Add(column string, v interface{}) *UpdateBuilder
- func (u *UpdateBuilder) Empty() bool
- func (u *UpdateBuilder) FromSelect(s *Selector) *UpdateBuilder
- func (u *UpdateBuilder) Query() (string, []interface{})
- func (u *UpdateBuilder) Schema(name string) *UpdateBuilder
- func (u *UpdateBuilder) Set(column string, v interface{}) *UpdateBuilder
- func (u *UpdateBuilder) SetNull(column string) *UpdateBuilder
- func (u *UpdateBuilder) Table(name string) *UpdateBuilder
- func (u *UpdateBuilder) Where(p *Predicate) *UpdateBuilder
Constants ¶
const ( ForGroupBy ForWhat = "FOR GROUP BY" ForOrderBy ForWhat = "FOR ORDER BY" ForJoin ForWhat = "FOR JOIN" ForDefault ForWhat = "" USE IndexAction = "USE INDEX" IGNORE IndexAction = "IGNORE INDEX" FORCE IndexAction = "FORCE INDEX" )
Variables ¶
This section is empty.
Functions ¶
func ScanInt ¶
func ScanInt(rows ColumnScanner) (int, error)
ScanInt scans and returns an int from the rows columns.
func ScanInt64 ¶
func ScanInt64(rows ColumnScanner) (int64, error)
ScanInt64 scans and returns an int64 from the rows columns.
func ScanOne ¶
func ScanOne(rows ColumnScanner, v interface{}) error
ScanOne scans one row to the given value. It fails if the rows holds more than 1 row.
func ScanSlice ¶
func ScanSlice(rows ColumnScanner, v interface{}) error
ScanSlice scans the given ColumnScanner (basically, sql.Row or sql.Rows) into the given slice.
func ScanString ¶
func ScanString(rows ColumnScanner) (string, error)
ScanString scans and returns a string from the rows columns.
func ScanValue ¶
func ScanValue(rows ColumnScanner) (driver.Value, error)
ScanValue scans and returns a driver.Value from the rows columns.
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder is the base query builder for the sql dsl.
func (*Builder) Err ¶
Err returns a concatenated error of all errors encountered during the query-building, or were added manually by calling AddError.
func (*Builder) IdentComma ¶
IdentComma calls Ident on all arguments and adds a comma between them.
func (*Builder) Quote ¶
Quote quotes the given identifier with the characters based on the configured dialect. It defaults to "`".
func (*Builder) SetDialect ¶
SetDialect sets the builder dialect. It's used for garnering dialect specific queries.
func (*Builder) SetTotal ¶
SetTotal sets the value of the total arguments. Used to pass this information between sub queries/expressions.
func (*Builder) WriteByte ¶
WriteByte wraps the Buffer.WriteByte to make it chainable with other methods.
func (*Builder) WriteString ¶
WriteString wraps the Buffer.WriteString to make it chainable with other methods.
type ColumnScanner ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
func (*DB) ExecContext ¶
type DebugDB ¶
type DebugDB struct {
// contains filtered or unexported fields
}
func (*DebugDB) ExecContext ¶
type DebugTx ¶
type DebugTx struct {
// contains filtered or unexported fields
}
func (*DebugTx) ExecContext ¶
type DeleteBuilder ¶
type DeleteBuilder struct { Builder // contains filtered or unexported fields }
DeleteBuilder is a builder for `DELETE` statement.
func Delete ¶
func Delete(table string) *DeleteBuilder
Delete creates a builder for the `DELETE` statement.
Delete("users"). Where( Or( EQ("name", "foo").And().EQ("age", 10), EQ("name", "bar").And().EQ("age", 20), And( EQ("name", "qux"), EQ("age", 1).Or().EQ("age", 2), ), ), )
func (*DeleteBuilder) FromSelect ¶
func (d *DeleteBuilder) FromSelect(s *Selector) *DeleteBuilder
FromSelect makes it possible to delete a sub query.
func (*DeleteBuilder) Query ¶
func (d *DeleteBuilder) Query() (string, []interface{})
Query returns query representation of a `DELETE` statement.
func (*DeleteBuilder) Schema ¶
func (d *DeleteBuilder) Schema(name string) *DeleteBuilder
Schema sets the database name for the table whose row will be deleted.
func (*DeleteBuilder) Table ¶
func (d *DeleteBuilder) Table(name string) *DeleteBuilder
Table sets the table name for the table whose row will be deleted.
func (*DeleteBuilder) Where ¶
func (d *DeleteBuilder) Where(p *Predicate) *DeleteBuilder
Where appends a where predicate to the `DELETE` statement.
type ExecQuerier ¶
type Func ¶
type Func struct { Builder // contains filtered or unexported fields }
Func represents an SQL function.
func (*Func) Append ¶
Append appends a new function to the function callbacks. The callback list are executed on call to String.
type IndexAction ¶
type IndexAction string
type IndexOptions ¶
type IndexOptions struct {
// contains filtered or unexported fields
}
type InsertBuilder ¶
type InsertBuilder struct { Builder // contains filtered or unexported fields }
InsertBuilder is a builder for `INSERT INTO` statement.
func Insert ¶
func Insert(table string) *InsertBuilder
Insert creates a builder for the `INSERT INTO` statement.
Insert("users"). Columns("name", "age"). Values("a8m", 10). Values("foo", 20)
Note: Insert inserts all values in one batch.
func (*InsertBuilder) Columns ¶
func (i *InsertBuilder) Columns(columns ...string) *InsertBuilder
Columns sets the columns of the insert statement.
func (*InsertBuilder) OnDuplicateKeyUpdate ¶
func (i *InsertBuilder) OnDuplicateKeyUpdate(columns ...string) *InsertBuilder
OnDuplicateKeyUpdate UpdateColumns generate like "ON DUPLICATE KEY UPDATE `id` = VALUES (`id`) " sql statement
func (*InsertBuilder) OnDuplicateKeyUpdateExpr ¶
func (i *InsertBuilder) OnDuplicateKeyUpdateExpr(q ...Querier) *InsertBuilder
OnDuplicateKeyUpdateExpr OnDuplicateKeyUpdateExpr generate like "ON DUPLICATE KEY UPDATE `c` = VALUES(`a`) + Values(`b`)"
func (*InsertBuilder) Query ¶
func (i *InsertBuilder) Query() (string, []interface{})
Query returns query representation of an `INSERT INTO` statement.
func (*InsertBuilder) Schema ¶
func (i *InsertBuilder) Schema(name string) *InsertBuilder
Schema sets the database name for the insert table.
func (*InsertBuilder) Set ¶
func (i *InsertBuilder) Set(column string, v interface{}) *InsertBuilder
Set is a syntactic sugar API for inserting only one row.
func (*InsertBuilder) Table ¶
func (i *InsertBuilder) Table(name string) *InsertBuilder
Table sets the table name for the insert table.
func (*InsertBuilder) Values ¶
func (i *InsertBuilder) Values(values ...interface{}) *InsertBuilder
Values append a value tuple for the insert statement.
type LockAction ¶
type LockAction string
LockAction tells the transaction what to do in case of requesting a row that is locked by other transaction.
const ( // NoWait means never wait and returns an error. NoWait LockAction = "NOWAIT" // SkipLocked means never wait and skip. SkipLocked LockAction = "SKIP LOCKED" )
type LockOption ¶
type LockOption func(*LockOptions)
LockOption allows configuring the LockConfig using functional options.
func WithLockAction ¶
func WithLockAction(action LockAction) LockOption
WithLockAction sets the Action of the lock.
type LockOptions ¶
type LockOptions struct { // Strength of the lock. Strength LockStrength // Action of the lock. Action LockAction }
LockOptions defines a SELECT statement lock for protecting concurrent updates.
type LockStrength ¶
type LockStrength string
LockStrength defines the strength of the lock (see the list below).
const ( LockUpdate LockStrength = "UPDATE" )
A list of all locking clauses.
type Op ¶
type Op int
An Op represents a predicate operator.
type ParamFormatter ¶
type ParamFormatter interface { // The FormatParam function lets users to define // custom placeholder formatting for their types. // For example, formatting the default placeholder // from '?' to 'ST_GeomFromWKB(?)' for MySQL dialect. FormatParam(placeholder string, info *StmtInfo) string }
ParamFormatter wraps the FormatPram function.
type Predicate ¶
type Predicate struct { Builder // contains filtered or unexported fields }
Predicate is a where predicate.
func CompositeGT ¶
CompositeGT returns a comiposite ">" predicate
func CompositeLT ¶
CompositeLT returns a comiposite "<" predicate
func ExprP ¶
ExprP creates a new predicate from the given expression.
ExprP("A = ? AND B > ?", args...)
func False ¶
func False() *Predicate
False appends the FALSE keyword to the predicate.
Delete().From("users").Where(False())
func Not ¶
Not wraps the given predicate with the not predicate.
Not(Or(EQ("name", "foo"), EQ("name", "bar")))
func Or ¶
Or combines all given predicates with OR between them.
Or(EQ("name", "foo"), EQ("name", "bar"))
func (*Predicate) Append ¶
Append appends a new function to the predicate callbacks. The callback list are executed on call to ry.
func (*Predicate) CompositeGT ¶
CompositeGT returns a composite ">" predicate.
func (*Predicate) CompositeLT ¶
CompositeLT appends a composite "<" predicate.
func (*Predicate) Contains ¶
Contains is a helper predicate that checks substring using the LIKE predicate.
func (*Predicate) EqualFold ¶
EqualFold is a helper predicate that applies the "=" predicate with case-folding.
func (*Predicate) HasPrefix ¶
HasPrefix is a helper predicate that checks prefix using the LIKE predicate.
func (*Predicate) HasSuffix ¶
HasSuffix is a helper predicate that checks suffix using the LIKE predicate.
type Querier ¶
type Querier interface { // Query returns the query representation of the element // and its arguments (if any). Query() (string, []interface{}) }
Querier wraps the basic Query method that is implemented by the different builders in this file.
type SelectTable ¶
type SelectTable struct { Builder // contains filtered or unexported fields }
SelectTable is a table selector.
func Table ¶
func Table(name string) *SelectTable
Table returns a new table selector.
t1 := Table("users").As("u") return Select(t1.C("name"))
func (*SelectTable) As ¶
func (s *SelectTable) As(alias string) *SelectTable
As adds the AS clause to the table selector.
func (*SelectTable) C ¶
func (s *SelectTable) C(column string) string
C returns a formatted string for the table column.
func (*SelectTable) Columns ¶
func (s *SelectTable) Columns(columns ...string) []string
Columns returns a list of formatted strings for the table columns.
func (*SelectTable) Schema ¶
func (s *SelectTable) Schema(name string) *SelectTable
Schema sets the schema name of the table.
func (*SelectTable) Unquote ¶
func (s *SelectTable) Unquote() *SelectTable
Unquote makes the table name to be formatted as raw string (unquoted). It is useful whe you don't want to query tables under the current database. For example: "INFORMATION_SCHEMA.TABLE_CONSTRAINTS" in MySQL.
type Selector ¶
type Selector struct { Builder // contains filtered or unexported fields }
Selector is a builder for the `SELECT` statement.
func Select ¶
Select returns a new selector for the `SELECT` statement.
t1 := Table("users").As("u") t2 := Select().From(Table("groups")).Where(EQ("user_id", 10)).As("g") return Select(t1.C("id"), t2.C("name")). From(t1). Join(t2). On(t1.C("id"), t2.C("user_id"))
func (*Selector) Clone ¶
Clone returns a duplicate of the selector, including all associated steps. It can be used to prepare common SELECT statements and use them differently after the clone is made.
func (*Selector) Columns ¶
Columns returns a list of formatted strings for a selected columns from this statement.
func (*Selector) For ¶
func (s *Selector) For(l LockStrength, opts ...LockOption) *Selector
For sets the lock configuration for suffixing the `SELECT` statement with the `FOR [SHARE | UPDATE] ...` clause.
func (*Selector) ForShare ¶
func (s *Selector) ForShare(opts ...LockOption) *Selector
ForShare sets the lock configuration for suffixing the `SELECT` statement with the `FOR SHARE` clause.
func (*Selector) ForUpdate ¶
func (s *Selector) ForUpdate(opts ...LockOption) *Selector
ForUpdate sets the lock configuration for suffixing the `SELECT` statement with the `FOR UPDATE` clause.
func (*Selector) ForceIndex ¶
ForceIndex generate FORCE INDEX (`indexName`)
func (*Selector) ForceIndexFor ¶
ForceIndexFor generate FORCE INDEX FOR xxx (`indexName`)
func (*Selector) FromSelect ¶
FromSelect copies the predicate from a selector.
func (*Selector) IgnoreIndex ¶
IgnoreIndex generate IGNORE INDEX (`indexName`)
func (*Selector) IgnoreIndexFor ¶
IgnoreIndexFor generate IGNORE INDEX FOR xxx (`indexName`)
func (*Selector) OnP ¶
OnP sets or appends the given predicate for the `ON` clause of the statement.
func (*Selector) OrderExpr ¶
OrderExpr appends the `ORDER BY` clause to the `SELECT` statement with custom list of expressions.
func (*Selector) Select ¶
Select changes the columns selection of the SELECT statement. Empty selection means all columns *.
func (*Selector) SelectColumnsLen ¶
SelectColumnsLen returns len of select columns
func (*Selector) SelectedColumns ¶
func (*Selector) SetDistinct ¶
SetDistinct sets explicitly if the returned rows are distinct or indistinct.
func (*Selector) SetP ¶
SetP sets explicitly the predicate function for the selector and clear its previous state.
func (*Selector) UseIndexFor ¶
UseIndexFor generate USE INDEX FOR xxx (`indexName`)
type StmtInfo ¶
type StmtInfo struct { // The Dialect of the SQL driver. Dialect string }
StmtInfo holds an information regarding the statement
type TableView ¶
type TableView interface {
// contains filtered or unexported methods
}
TableView is a view that returns a table view. Can ne a Table, Selector or a View (WITH statement).
type UpdateBuilder ¶
type UpdateBuilder struct { Builder // contains filtered or unexported fields }
UpdateBuilder is a builder for `UPDATE` statement.
func Update ¶
func Update(table string) *UpdateBuilder
Update creates a builder for the `UPDATE` statement.
Update("users").Set("name", "foo").Set("age", 10)
func (*UpdateBuilder) Add ¶
func (u *UpdateBuilder) Add(column string, v interface{}) *UpdateBuilder
Add adds a numeric value to the given column.
func (*UpdateBuilder) Empty ¶
func (u *UpdateBuilder) Empty() bool
Empty reports whether this builder does not contain update changes.
func (*UpdateBuilder) FromSelect ¶
func (u *UpdateBuilder) FromSelect(s *Selector) *UpdateBuilder
FromSelect makes it possible to update entities that match the sub-query.
func (*UpdateBuilder) Query ¶
func (u *UpdateBuilder) Query() (string, []interface{})
Query returns query representation of an `UPDATE` statement.
func (*UpdateBuilder) Schema ¶
func (u *UpdateBuilder) Schema(name string) *UpdateBuilder
Schema sets the database name for the updated table.
func (*UpdateBuilder) Set ¶
func (u *UpdateBuilder) Set(column string, v interface{}) *UpdateBuilder
Set sets a column and a its value.
func (*UpdateBuilder) SetNull ¶
func (u *UpdateBuilder) SetNull(column string) *UpdateBuilder
SetNull sets a column as null value.
func (*UpdateBuilder) Table ¶
func (u *UpdateBuilder) Table(name string) *UpdateBuilder
Table sets the table name for the updated table.
func (*UpdateBuilder) Where ¶
func (u *UpdateBuilder) Where(p *Predicate) *UpdateBuilder
Where adds a where predicate for update statement.