Documentation
¶
Index ¶
- Constants
- Variables
- func Append(arr interface{}, elem interface{}) error
- func BindTables(ctx context.Context, db *DB, tt map[string]TableDesc, parallel bool) map[string]error
- func FieldAddrs(model interface{}, excludeTag string) []interface{}
- func FieldNames(model interface{}, tagRules string) string
- func HasAutoincrementFieldID(model interface{}) bool
- func MaskPostgreSQLConnectionString(src string) string
- func ToSnakeCase(str string) string
- func WithCols(cv map[string]interface{}) func(*Option)
- func WithCtx(ctx context.Context) func(*Option)
- func WithID(val interface{}) func(*Option)
- func WithIgnoreConflict(text string) func(*Option)
- func WithIgnoreConflictColumn(column ...string) func(*Option)
- func WithReturnAll(dst interface{}) func(*Option)
- func WithReturnDeletedAt(dst interface{}) func(*Option)
- func WithReturnID(dst interface{}) func(*Option)
- func WithReturnVersion(dst interface{}) func(*Option)
- func WithRow(row interface{}) func(*Option)
- func WithTag(tag string, rule TagExclusionRule) func(*Option)
- func WithTx(tx *Tx) func(*Option)
- func WithWhere(cond string, val ...interface{}) func(*Option)
- func WithoutReturnAll() func(*Option)
- func WrapError(t interface{}, err error, params ...interface{}) error
- func WrapErrorOld(t interface{}, err error, params ...interface{}) error
- type DB
- func (db *DB) Begin() *Tx
- func (db *DB) BeginTx(ctx context.Context, opts *sql.TxOptions) *Tx
- func (db *DB) CleanUnusedStatement(d time.Duration)
- func (db *DB) Close() error
- func (db *DB) Exec(qry string, args ...interface{}) (sql.Result, error)
- func (db *DB) ExecContext(ctx context.Context, qry string, args ...interface{}) (sql.Result, error)
- func (db *DB) ExecContextTx(ctx context.Context, tx *Tx, qry string, args ...interface{}) (sql.Result, error)
- func (db *DB) ExecTx(tx *Tx, qry string, args ...interface{}) (sql.Result, error)
- func (db *DB) InTx(f func(*Tx) error) error
- func (db *DB) Logger() *zerolog.Logger
- func (db *DB) Ping() error
- func (db *DB) PingContext(ctx context.Context) error
- func (db *DB) PlaceHolderType() ParamPlaceHolderType
- func (db *DB) Prepare(qry string) *Stmt
- func (db *DB) PrepareContext(ctx context.Context, qry string) *Stmt
- func (db *DB) PrepareContextN(ctx context.Context, qry, uid string) *Stmt
- func (db *DB) PrepareN(qry, uid string) *Stmt
- func (db *DB) PreparedStatementCount() int
- func (db *DB) Query(qry string, args ...interface{}) *StmtInstance
- func (db *DB) QueryContext(ctx context.Context, qry string, args ...interface{}) *StmtInstance
- func (db *DB) QueryContextTx(ctx context.Context, tx *Tx, qry string, args ...interface{}) *StmtInstance
- func (db *DB) QueryRow(qry string, args ...interface{}) *StmtInstance
- func (db *DB) QueryRowContext(ctx context.Context, qry string, args ...interface{}) *StmtInstance
- func (db *DB) QueryRowContextTx(ctx context.Context, tx *Tx, qry string, args ...interface{}) *StmtInstance
- func (db *DB) QueryRowTx(tx *Tx, qry string, args ...interface{}) *StmtInstance
- func (db *DB) QueryTx(tx *Tx, qry string, args ...interface{}) *StmtInstance
- func (db *DB) SQLDB() *sql.DB
- func (db *DB) SetLogger(l *zerolog.Logger)
- func (db *DB) SetPlaceHolderType(ph ParamPlaceHolderType)
- func (db *DB) Stmt(uid string) (*Stmt, bool)
- type DefaultStmtLogger
- type Error
- type NullString
- func (ns NullString) MarshalJSON() ([]byte, error)
- func (ns NullString) MarshalText(b []byte) ([]byte, error)
- func (ns *NullString) Scan(value interface{}) error
- func (ns NullString) String() string
- func (ns *NullString) UnmarshalJSON(b []byte) error
- func (ns *NullString) UnmarshalText(b []byte) error
- func (ns NullString) Valid() bool
- func (ns NullString) Value() (driver.Value, error)
- type NullTime
- func (ns NullTime) MarshalJSON() ([]byte, error)
- func (ns NullTime) MarshalText(b []byte) ([]byte, error)
- func (ns *NullTime) Scan(value interface{}) error
- func (ns *NullTime) SetNow()
- func (ns *NullTime) SetNull()
- func (ns NullTime) String() string
- func (ns *NullTime) UnmarshalJSON(b []byte) error
- func (ns *NullTime) UnmarshalText(b []byte) error
- func (ns NullTime) Valid() bool
- func (ns NullTime) Value() (driver.Value, error)
- type Option
- type ParamPlaceHolderType
- type RowValidationResult
- type Sequence
- type Stmt
- type StmtInstance
- func (si *StmtInstance) Close() error
- func (si *StmtInstance) Debug() *StmtInstance
- func (si *StmtInstance) Err() error
- func (si *StmtInstance) Exec(args ...interface{}) (sql.Result, error)
- func (si *StmtInstance) ExecContext(ctx context.Context, args ...interface{}) (sql.Result, error)
- func (si *StmtInstance) Fetch(f func() error, dest ...interface{}) *StmtInstance
- func (si *StmtInstance) FetchAll(arr interface{}, row interface{}, dest ...interface{}) *StmtInstance
- func (si *StmtInstance) Query(args ...interface{}) *StmtInstance
- func (si *StmtInstance) QueryContext(ctx context.Context, args ...interface{}) *StmtInstance
- func (si *StmtInstance) QueryRow(args ...interface{}) *StmtInstance
- func (si *StmtInstance) QueryRowContext(ctx context.Context, args ...interface{}) *StmtInstance
- func (si *StmtInstance) QueryRowTx(tx *Tx, ctx context.Context, args ...interface{}) *StmtInstance
- func (si *StmtInstance) Scan(dest ...interface{}) error
- func (si *StmtInstance) Tx() *Tx
- func (si *StmtInstance) ViaTx(tx *Tx) *StmtInstance
- type StmtLogger
- type Table
- func (t *Table) CheckColumns() error
- func (t *Table) CheckTableExistance() error
- func (t *Table) ColTags() string
- func (t *Table) Columns() string
- func (t *Table) Count(where string, params ...interface{}) (int, error)
- func (t *Table) DB() *DB
- func (t *Table) Delete(optFunc ...func(*Option)) error
- func (t *Table) DoHardDel(where string, args ...interface{}) (sql.Result, error)
- func (t *Table) DoHardDelTx(tx *Tx, where string, args ...interface{}) (sql.Result, error)
- func (t *Table) DoHardDelete(id interface{}) error
- func (t *Table) DoHardDeleteCtx(ctx context.Context, id interface{}) error
- func (t *Table) DoHardDeleteTx(tx *Tx, id interface{}) error
- func (t *Table) DoHardDeleteTxCtx(ctx context.Context, tx *Tx, id interface{}) error
- func (t *Table) DoInsert(row interface{}, returning ...interface{}) error
- func (t *Table) DoInsertCtx(ctx context.Context, row interface{}, returning ...interface{}) error
- func (t *Table) DoInsertTx(tx *Tx, row interface{}, returning ...interface{}) error
- func (t *Table) DoInsertTxCtx(ctx context.Context, tx *Tx, row interface{}, returning ...interface{}) error
- func (t *Table) DoSelect(where, order string, offset, limit int, f func() error, row interface{}, ...) error
- func (t *Table) DoSelectByID(id interface{}, row interface{}) error
- func (t *Table) DoSelectCache(f func() error, row interface{}) error
- func (t *Table) DoSelectCacheCtx(ctx context.Context, f func() error, row interface{}) error
- func (t *Table) DoSelectCtx(ctx context.Context, where, order string, offset, limit int, f func() error, ...) error
- func (t *Table) DoSelectCtxTx(tx *Tx, where, order string, offset, limit int, f func() error, ...) error
- func (t *Table) DoSelectRow(where string, row interface{}, args ...interface{}) error
- func (t *Table) DoSelectTx(tx *Tx, where, order string, offset, limit int, f func() error, ...) error
- func (t *Table) DoSoftDelete(id interface{}, deletedAt *NullTime, rowVersion *int) error
- func (t *Table) DoSoftDeleteCtx(ctx context.Context, id interface{}, deletedAt *NullTime, rowVersion *int) error
- func (t *Table) DoSoftDeleteTx(tx *Tx, id interface{}, deletedAt *NullTime, rowVersion *int) error
- func (t *Table) DoSoftDeleteTxCtx(ctx context.Context, tx *Tx, id interface{}, deletedAt *NullTime, ...) error
- func (t *Table) DoUpdate(row interface{}, tags string, rule TagExclusionRule, userID int) error
- func (t *Table) DoUpdateCtx(ctx context.Context, row interface{}, tags string, rule TagExclusionRule, ...) error
- func (t *Table) DoUpdateRowVersionCtx(ctx context.Context, id interface{}, updatedAt *NullTime, rowVersion *int) error
- func (t *Table) DoUpdateRowVersionTx(tx *Tx, id interface{}, updatedAt *NullTime, rowVersion *int) error
- func (t *Table) DoUpdateRowVersionTxCtx(ctx context.Context, tx *Tx, id interface{}, updatedAt *NullTime, ...) error
- func (t *Table) DoUpdateTx(tx *Tx, row interface{}, tags string, rule TagExclusionRule, userID int) error
- func (t *Table) DoUpdateTxCtx(ctx context.Context, tx *Tx, row interface{}, tags string, ...) error
- func (t *Table) FieldAddrs(model interface{}, tags string, rule TagExclusionRule) []interface{}
- func (t *Table) FieldAddrsSelect(model interface{}, tags string, rule TagExclusionRule) []interface{}
- func (t *Table) FieldAddrsUpdate(model interface{}, tags string, rule TagExclusionRule) ([]interface{}, *NullTime, *int)
- func (t *Table) FieldNames(model interface{}, tags string, rule TagExclusionRule) string
- func (t *Table) Insert(row interface{}, optFunc ...func(*Option)) error
- func (t *Table) Name() string
- func (t *Table) SetAudit(b bool)
- func (t *Table) SetLogger(l *zerolog.Logger)
- func (t *Table) SnakeIt(fieldName string) string
- func (t *Table) Update(row interface{}, optFunc ...func(*Option)) error
- func (t *Table) ValidateRow(row interface{}, mask int) RowValidationResult
- type TableDesc
- type TagExclusionRule
- type Tx
Constants ¶
const ( // TagNoSeq запрещает генерацию значения для поля ID, если поле типа int // используя последовательность tablename_SEQ. TagNoSeq = "noseq" // TagNoIns исключает поле при вставке. TagNoIns = "noins" // TagNoUpd исключает поле при Update TagNoUpd = "noupd" // TagNoCache исключает поле при чтении записей функцией DoSelectCache(). TagNoCache = "nocache" )
const ( ValidateLen int = iota << 1 ValidateNotNull ValidateIntRange )
Variables ¶
var ( ErrUniqueViolation = errors.New("unique violation").StatusCode(409) ErrCheckConstaintViolation = errors.New("check constraint violation").StatusCode(400) ErrConnectionDone = errors.New("database connection lost").StatusCode(503).Critical() ErrQueryExecFailed = errors.New("query execution failed").StatusCode(500).Critical() ErrNotFound = errors.New("not found").StatusCode(404) )
var AutoCheckTableExistance bool = true
AutoCheckTableExistance checks existance of table in NewTable() call.
var ErrUnknownPreparedStatement = errors.New("unknown prepared statement")
var FieldTagLabel = "dbw"
FieldTagLabel содержит наименование тэга используемого в аннотациях к атрибутам структуры.
var PrimaryKeyFieldName = "ID"
Functions ¶
func Append ¶
func Append(arr interface{}, elem interface{}) error
Append appends elem into arr array.
func BindTables ¶
func BindTables(ctx context.Context, db *DB, tt map[string]TableDesc, parallel bool) map[string]error
BindTables
func FieldAddrs ¶
func FieldAddrs(model interface{}, excludeTag string) []interface{}
fieldAddrs returns slice of pointers to struct's fields excluding fields having tag value specified in excludeTag
func FieldNames ¶
FieldNames returns names of struct fields separated by comma. Includes anonymous structs as well.
func HasAutoincrementFieldID ¶
func HasAutoincrementFieldID(model interface{}) bool
HasAutoincrementFieldID returns true if struct has field ID with one of type: int8, int16, int32, int64 and has no tag "noseq".
func MaskPostgreSQLConnectionString ¶ added in v0.4.0
MaskPostgreSQLConnectionString replaces password=12345 by password=*****.
func ToSnakeCase ¶
ToSnakeCase converts string like RobertEgorov to robert_egorov.
func WithIgnoreConflict ¶ added in v0.2.0
func WithIgnoreConflictColumn ¶ added in v0.2.3
func WithReturnAll ¶ added in v0.2.3
func WithReturnAll(dst interface{}) func(*Option)
func WithReturnDeletedAt ¶ added in v0.2.3
func WithReturnDeletedAt(dst interface{}) func(*Option)
func WithReturnID ¶ added in v0.2.3
func WithReturnID(dst interface{}) func(*Option)
func WithReturnVersion ¶ added in v0.2.3
func WithReturnVersion(dst interface{}) func(*Option)
func WithTag ¶ added in v0.2.3
func WithTag(tag string, rule TagExclusionRule) func(*Option)
func WithoutReturnAll ¶ added in v0.2.3
func WithoutReturnAll() func(*Option)
func WrapErrorOld ¶
WrapError .
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB wraps database/sql for better performance and logging. PostgreSQL RDBMS is supported only.
func RepetableOpen ¶
func RepetableOpen(ctx context.Context, driverName, dataSourceName string, l *zerolog.Logger, aff func(string, int, error) time.Duration) (*DB, error)
RepetableOpen tries to establish connection to database till ctx.Done() or success. It calls func aff() after every failed attempt.
func (*DB) CleanUnusedStatement ¶
CleanUnusedStatement deletes prepared statements not used last d.
func (*DB) ExecContext ¶
func (*DB) ExecContextTx ¶
func (*DB) PlaceHolderType ¶
func (db *DB) PlaceHolderType() ParamPlaceHolderType
func (*DB) PrepareContext ¶
PrepareContext prepares SQL statement. Unique statement name is hash generated.
func (*DB) PrepareContextN ¶
PrepareNamed prepared statement referenced by unique name. Later, prepared statement can be taken from cache by uid. It's expected that SQL parameters are always used for performance reasons.
func (*DB) PrepareN ¶
PrepareN prepares SQL statement. Parameter uid holds user defined unique statement name.
func (*DB) PreparedStatementCount ¶
func (*DB) Query ¶
func (db *DB) Query(qry string, args ...interface{}) *StmtInstance
func (*DB) QueryContext ¶
func (db *DB) QueryContext(ctx context.Context, qry string, args ...interface{}) *StmtInstance
func (*DB) QueryContextTx ¶
func (*DB) QueryRow ¶
func (db *DB) QueryRow(qry string, args ...interface{}) *StmtInstance
func (*DB) QueryRowContext ¶
func (db *DB) QueryRowContext(ctx context.Context, qry string, args ...interface{}) *StmtInstance
func (*DB) QueryRowContextTx ¶
func (*DB) QueryRowTx ¶
func (db *DB) QueryRowTx(tx *Tx, qry string, args ...interface{}) *StmtInstance
func (*DB) SetPlaceHolderType ¶
func (db *DB) SetPlaceHolderType(ph ParamPlaceHolderType)
type DefaultStmtLogger ¶
type DefaultStmtLogger struct { }
func NewDefaultStmtLogger ¶
func NewDefaultStmtLogger() *DefaultStmtLogger
func (*DefaultStmtLogger) After ¶
func (dsl *DefaultStmtLogger) After(sli *StmtInstance)
func (*DefaultStmtLogger) ArgsFormat ¶
func (dsl *DefaultStmtLogger) ArgsFormat(args ...interface{}) string
func (*DefaultStmtLogger) Before ¶
func (dsl *DefaultStmtLogger) Before(sli *StmtInstance)
func (*DefaultStmtLogger) ContextFormat ¶
func (dsl *DefaultStmtLogger) ContextFormat(ctx context.Context) string
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error describes error raising by SQL queries related to a single table represented by *Table or by arbitrary SQL query.
func (Error) MarshalZerologObject ¶
func (*Error) SQLErrCode ¶
type NullString ¶
type NullString string
NullString defines types for nullable varchar column without additional "Valid bool" attributes.
func (NullString) MarshalJSON ¶
func (ns NullString) MarshalJSON() ([]byte, error)
MarshalJSON implements encoding/json Marshaller interface.
func (NullString) MarshalText ¶
func (ns NullString) MarshalText(b []byte) ([]byte, error)
MarshalText implements encoding/text TextMarshaller interface.
func (*NullString) Scan ¶
func (ns *NullString) Scan(value interface{}) error
Scan implements database/sql Scanner interface.
func (NullString) String ¶
func (ns NullString) String() string
String returns string representation of value.
func (*NullString) UnmarshalJSON ¶
func (ns *NullString) UnmarshalJSON(b []byte) error
UnmarshalJSON implements encoding/json Unmarshaller interface.
func (*NullString) UnmarshalText ¶
func (ns *NullString) UnmarshalText(b []byte) error
UnmarshalText implements encoding/text TextUnmarshaller interface.
func (NullString) Valid ¶
func (ns NullString) Valid() bool
Valid return true if value is not empty or false, if len==0.
type NullTime ¶
NullTime defines types for nullable varchar column without additional "Valid bool" attributes.
func FieldAddrsUpdate ¶
func (NullTime) MarshalJSON ¶ added in v0.2.1
MarshalJSON implements encoding/json Marshaller interface.
func (NullTime) MarshalText ¶ added in v0.2.1
MarshalText implements encoding/text TextMarshaller interface.
func (*NullTime) SetNull ¶ added in v0.6.0
func (ns *NullTime) SetNull()
SetNull sets value to null.
func (*NullTime) UnmarshalJSON ¶ added in v0.2.1
UnmarshalJSON implements encoding/json Unmarshaller interface.
func (*NullTime) UnmarshalText ¶ added in v0.2.1
UnmarshalText implements encoding/text TextUnmarshaller interface.
type ParamPlaceHolderType ¶
type ParamPlaceHolderType int
ParamPlaceHolderType определяет тип плейсхолдера для переменных запроса.
const ( // QuestionMark - вопросительный знак. QuestionMark ParamPlaceHolderType = iota // DollarPlusPosition - знак доллара и номер позиции. DollarPlusPosition )
type RowValidationResult ¶
type Sequence ¶
type Sequence struct {
// contains filtered or unexported fields
}
Sequence describes database object sequence and provides method to generate next value.
Important: An object must not be used with tables column ID (int?) with no tag "noseq". Because for this table value generates automatically.
func NewSequence ¶
NewSequence creates Sequence object.
func (*Sequence) CheckExistance ¶
CheckExistance checks sequence existance.
type Stmt ¶
type Stmt struct {
// contains filtered or unexported fields
}
func (*Stmt) Instance ¶
func (s *Stmt) Instance() *StmtInstance
func (*Stmt) InstanceTx ¶
func (s *Stmt) InstanceTx(tx *Tx) *StmtInstance
func (*Stmt) LastInstanceUnixTime ¶
type StmtInstance ¶
type StmtInstance struct { // At holds time when instance created (sent to database). At time.Time // RespondedIn holds duration between At and moment when 1st row retrived. RespondedIn time.Duration // RowsFetched holds numner or rows fetched by SELECT. RowsFetched int // RowsFetchedIn holds duration between getting 1st and last rows. RowsFetchedIn time.Duration // QueryParams holds SQL query parameters. QueryParams string // CtxParams holds context/session related parameters. CtxParams string // Num holds SQL statement sequential number since application start. Num uint64 // contains filtered or unexported fields }
StmtInstance
func (*StmtInstance) Close ¶
func (si *StmtInstance) Close() error
Close closes statement instance with preserving error if was exist.
func (*StmtInstance) Debug ¶
func (si *StmtInstance) Debug() *StmtInstance
func (*StmtInstance) Err ¶
func (si *StmtInstance) Err() error
func (*StmtInstance) Exec ¶
func (si *StmtInstance) Exec(args ...interface{}) (sql.Result, error)
Exec executes SQL command represented by StmtInstance. A SQL command does not return any values.
func (*StmtInstance) ExecContext ¶
ExecContext executes SQL command what not returns data back.
func (*StmtInstance) Fetch ¶
func (si *StmtInstance) Fetch(f func() error, dest ...interface{}) *StmtInstance
ScanAll
func (*StmtInstance) FetchAll ¶
func (si *StmtInstance) FetchAll(arr interface{}, row interface{}, dest ...interface{}) *StmtInstance
FetchAll automatically stores fetched rows into the slice arr.
func (*StmtInstance) Query ¶
func (si *StmtInstance) Query(args ...interface{}) *StmtInstance
func (*StmtInstance) QueryContext ¶
func (si *StmtInstance) QueryContext(ctx context.Context, args ...interface{}) *StmtInstance
func (*StmtInstance) QueryRow ¶
func (si *StmtInstance) QueryRow(args ...interface{}) *StmtInstance
func (*StmtInstance) QueryRowContext ¶
func (si *StmtInstance) QueryRowContext(ctx context.Context, args ...interface{}) *StmtInstance
func (*StmtInstance) QueryRowTx ¶
func (si *StmtInstance) QueryRowTx(tx *Tx, ctx context.Context, args ...interface{}) *StmtInstance
func (*StmtInstance) Scan ¶
func (si *StmtInstance) Scan(dest ...interface{}) error
Scan read values from database driver to dest.
func (*StmtInstance) Tx ¶
func (si *StmtInstance) Tx() *Tx
func (*StmtInstance) ViaTx ¶
func (si *StmtInstance) ViaTx(tx *Tx) *StmtInstance
type StmtLogger ¶
type StmtLogger interface { // New(s Statementer, ctx context.Context, qparams string) *StmtInstance // NewTx(tx *Tx, s Statementer, ctx context.Context, qparams string) *StmtInstance Before(*StmtInstance) After(*StmtInstance) ContextFormat(ctx context.Context) string ArgsFormat(args ...interface{}) string }
type Table ¶
type Table struct { SQL struct { SelectCache string SelectCacheWithoutDeleted string Select string BasicInsert string Insert string BasicUpdate string HardDeleteByID string SoftDeleteByID string SoftDelete string ExistByID string ExistByUID string UpdateRowVersion string SelectByID string HardFlexDelete string SelectCount string } // contains filtered or unexported fields }
func New ¶
New automatically recognises autoincrement using sequecne by existance of field ID with type int? If there is no autoicrement requrements set tag "noseq". It extected, that sequence used for autoincrement has "tablename_seq".
func (*Table) CheckColumns ¶
func (*Table) CheckTableExistance ¶
func (*Table) DoHardDelTx ¶
DoHardDelTx deletes row completely using condition described in where in a transaction.
func (*Table) DoHardDelete ¶
DoHardDelete deletes row completely.
func (*Table) DoHardDeleteCtx ¶
DoHardDelete deletes row completely.
func (*Table) DoHardDeleteTx ¶
func (*Table) DoHardDeleteTxCtx ¶
func (*Table) DoInsertCtx ¶
func (*Table) DoInsertTx ¶
func (*Table) DoInsertTxCtx ¶
func (*Table) DoSelectByID ¶
func (*Table) DoSelectCache ¶
func (*Table) DoSelectCacheCtx ¶
func (*Table) DoSelectCtx ¶
func (*Table) DoSelectCtxTx ¶ added in v0.1.1
func (*Table) DoSelectRow ¶ added in v0.5.0
func (*Table) DoSelectTx ¶ added in v0.1.1
func (*Table) DoSoftDelete ¶
DoSoftDelete marks rows as deleted. Works only if table has column deleted_at, panics if not.
func (*Table) DoSoftDeleteCtx ¶
func (*Table) DoSoftDeleteTx ¶
func (*Table) DoSoftDeleteTxCtx ¶
func (*Table) DoUpdate ¶
func (t *Table) DoUpdate(row interface{}, tags string, rule TagExclusionRule, userID int) error
func (*Table) DoUpdateCtx ¶
func (*Table) DoUpdateRowVersionCtx ¶
func (*Table) DoUpdateRowVersionTx ¶
func (*Table) DoUpdateRowVersionTxCtx ¶
func (*Table) DoUpdateTx ¶
func (*Table) DoUpdateTxCtx ¶
func (*Table) FieldAddrs ¶
func (t *Table) FieldAddrs(model interface{}, tags string, rule TagExclusionRule) []interface{}
func (*Table) FieldAddrsSelect ¶
func (t *Table) FieldAddrsSelect(model interface{}, tags string, rule TagExclusionRule) []interface{}
func (*Table) FieldAddrsUpdate ¶
func (t *Table) FieldAddrsUpdate(model interface{}, tags string, rule TagExclusionRule) ([]interface{}, *NullTime, *int)
func (*Table) FieldNames ¶
func (t *Table) FieldNames(model interface{}, tags string, rule TagExclusionRule) string
func (*Table) ValidateRow ¶
func (t *Table) ValidateRow(row interface{}, mask int) RowValidationResult
ValidateRow
type TagExclusionRule ¶
type TagExclusionRule int
TagExclusionRule описывает тип исключения или включения атрибутов структур в SQL запрос.
const ( Exclude TagExclusionRule = 1 Include TagExclusionRule = 2 All TagExclusionRule = 3 )
func (TagExclusionRule) String ¶
func (ter TagExclusionRule) String() string
type Tx ¶
type Tx struct {
// contains filtered or unexported fields
}
Tx describes transaction.
func (*Tx) Duration ¶
Duration returns transaction duration. If transaction finished, returns transaction duration. If transaction is still open, returns duration from transaction start time.