Documentation ¶
Index ¶
- type ConnAdapter
- func (c *ConnAdapter) Cli() *pgxpool.Pool
- func (c *ConnAdapter) Close() error
- func (c *ConnAdapter) Connect(ctx context.Context, opts Options) error
- func (c *ConnAdapter) Exec(ctx context.Context, sql string, args ...any) error
- func (c *ConnAdapter) Ping(ctx context.Context) error
- func (c *ConnAdapter) Query(ctx context.Context, sql string, args ...any) (mrstorage.DBQueryRows, error)
- func (c *ConnAdapter) QueryRow(ctx context.Context, sql string, args ...any) mrstorage.DBQueryRow
- type ConnManager
- type Options
- type SQLBuilderCondition
- type SQLBuilderLimit
- type SQLBuilderOrderBy
- type SQLBuilderSelect
- func (b *SQLBuilderSelect) Limit(f func(p mrstorage.SQLBuilderLimit) mrstorage.SQLBuilderPartFunc) mrstorage.SQLBuilderPart
- func (b *SQLBuilderSelect) OrderBy(f func(o mrstorage.SQLBuilderOrderBy) mrstorage.SQLBuilderPartFunc) mrstorage.SQLBuilderPart
- func (b *SQLBuilderSelect) Where(f func(w mrstorage.SQLBuilderWhere) mrstorage.SQLBuilderPartFunc) mrstorage.SQLBuilderPart
- type SQLBuilderSet
- type SQLBuilderUpdate
- func (b *SQLBuilderUpdate) Set(f func(s mrstorage.SQLBuilderSet) mrstorage.SQLBuilderPartFunc) mrstorage.SQLBuilderPart
- func (b *SQLBuilderUpdate) SetFromEntity(entity any) (mrstorage.SQLBuilderPart, error)
- func (b *SQLBuilderUpdate) SetFromEntityWith(entity any, ...) (mrstorage.SQLBuilderPart, error)
- func (b *SQLBuilderUpdate) Where(f func(w mrstorage.SQLBuilderWhere) mrstorage.SQLBuilderPartFunc) mrstorage.SQLBuilderPart
- type SQLBuilderWhere
- func (b *SQLBuilderWhere) Equal(name string, value any) mrstorage.SQLBuilderPartFunc
- func (b *SQLBuilderWhere) Expr(expr string) mrstorage.SQLBuilderPartFunc
- func (b *SQLBuilderWhere) ExprWithValue(expr string, value any) mrstorage.SQLBuilderPartFunc
- func (b *SQLBuilderWhere) FilterAnyOf(name string, values any) mrstorage.SQLBuilderPartFunc
- func (b *SQLBuilderWhere) FilterEqualBool(name string, value *bool) mrstorage.SQLBuilderPartFunc
- func (b *SQLBuilderWhere) FilterEqualInt64(name string, value, empty int64) mrstorage.SQLBuilderPartFunc
- func (b *SQLBuilderWhere) FilterEqualString(name, value string) mrstorage.SQLBuilderPartFunc
- func (b *SQLBuilderWhere) FilterEqualUUID(name string, value uuid.UUID) mrstorage.SQLBuilderPartFunc
- func (b *SQLBuilderWhere) FilterLike(name, value string) mrstorage.SQLBuilderPartFunc
- func (b *SQLBuilderWhere) FilterLikeFields(names []string, value string) mrstorage.SQLBuilderPartFunc
- func (b *SQLBuilderWhere) FilterRangeFloat64(name string, value mrtype.RangeFloat64, empty, qualityThreshold float64) mrstorage.SQLBuilderPartFunc
- func (b *SQLBuilderWhere) FilterRangeInt64(name string, value mrtype.RangeInt64, empty int64) mrstorage.SQLBuilderPartFunc
- func (b *SQLBuilderWhere) Greater(name string, value any) mrstorage.SQLBuilderPartFunc
- func (b *SQLBuilderWhere) GreaterOrEqual(name string, value any) mrstorage.SQLBuilderPartFunc
- func (b *SQLBuilderWhere) JoinAnd(conds ...mrstorage.SQLBuilderPartFunc) mrstorage.SQLBuilderPartFunc
- func (b *SQLBuilderWhere) JoinOr(conds ...mrstorage.SQLBuilderPartFunc) mrstorage.SQLBuilderPartFunc
- func (b *SQLBuilderWhere) Less(name string, value any) mrstorage.SQLBuilderPartFunc
- func (b *SQLBuilderWhere) LessOrEqual(name string, value any) mrstorage.SQLBuilderPartFunc
- func (b *SQLBuilderWhere) NotEqual(name string, value any) mrstorage.SQLBuilderPartFunc
- type TxManagerStub
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConnAdapter ¶ added in v0.3.1
type ConnAdapter struct {
// contains filtered or unexported fields
}
ConnAdapter - адаптер для работы с Postgres клиентом.
func (*ConnAdapter) Cli ¶ added in v0.3.1
func (c *ConnAdapter) Cli() *pgxpool.Pool
Cli - comment method.
func (*ConnAdapter) Close ¶ added in v0.3.1
func (c *ConnAdapter) Close() error
Close - comment method.
func (*ConnAdapter) Connect ¶ added in v0.3.1
func (c *ConnAdapter) Connect(ctx context.Context, opts Options) error
Connect - comment method.
func (*ConnAdapter) Ping ¶ added in v0.3.1
func (c *ConnAdapter) Ping(ctx context.Context) error
Ping - comment method.
func (*ConnAdapter) Query ¶ added in v0.3.1
func (c *ConnAdapter) Query(ctx context.Context, sql string, args ...any) (mrstorage.DBQueryRows, error)
Query - comment method.
func (*ConnAdapter) QueryRow ¶ added in v0.3.1
func (c *ConnAdapter) QueryRow(ctx context.Context, sql string, args ...any) mrstorage.DBQueryRow
QueryRow - comment method.
type ConnManager ¶ added in v0.11.0
type ConnManager struct {
// contains filtered or unexported fields
}
ConnManager - Менеджер транзакций.
func NewConnManager ¶ added in v0.11.0
func NewConnManager(conn *ConnAdapter) *ConnManager
NewConnManager - создаёт объект ConnManager.
type Options ¶
type Options struct { DSN string // если указано, то Host, Port, Database, Username, Password не используются Host string Port string Database string Username string Password string MaxPoolSize int MaxConnLifetime time.Duration MaxConnIdleTime time.Duration ConnAttempts int ConnTimeout time.Duration QueryTracer pgx.QueryTracer AfterConnect func(ctx context.Context, conn *pgx.Conn) error }
Options - опции для создания соединения для ConnAdapter.
type SQLBuilderCondition ¶ added in v0.11.0
type SQLBuilderCondition struct {
// contains filtered or unexported fields
}
SQLBuilderCondition - comment struct.
func NewSQLBuilderCondition ¶ added in v0.11.0
func NewSQLBuilderCondition(where *SQLBuilderWhere) *SQLBuilderCondition
NewSQLBuilderCondition - создаёт объект SQLBuilderCondition.
func (*SQLBuilderCondition) Where ¶ added in v0.11.0
func (b *SQLBuilderCondition) Where(f func(w mrstorage.SQLBuilderWhere) mrstorage.SQLBuilderPartFunc) mrstorage.SQLBuilderPart
Where - comment method.
type SQLBuilderLimit ¶ added in v0.11.0
type SQLBuilderLimit struct {
// contains filtered or unexported fields
}
SQLBuilderLimit - comment struct.
func NewSQLBuilderLimit ¶ added in v0.11.0
func NewSQLBuilderLimit(maxSize uint64) *SQLBuilderLimit
NewSQLBuilderLimit - создаёт объект SQLBuilderLimit.
func (*SQLBuilderLimit) OffsetLimit ¶ added in v0.11.0
func (b *SQLBuilderLimit) OffsetLimit(index, size uint64) mrstorage.SQLBuilderPartFunc
OffsetLimit - comment method.
type SQLBuilderOrderBy ¶ added in v0.11.0
type SQLBuilderOrderBy struct {
// contains filtered or unexported fields
}
SQLBuilderOrderBy - comment struct.
func NewSQLBuilderOrderBy ¶ added in v0.11.0
func NewSQLBuilderOrderBy(ctx context.Context, defaultSort mrtype.SortParams) *SQLBuilderOrderBy
NewSQLBuilderOrderBy - создаёт объект SQLBuilderOrderBy.
func (*SQLBuilderOrderBy) DefaultField ¶ added in v0.11.0
func (b *SQLBuilderOrderBy) DefaultField() mrstorage.SQLBuilderPartFunc
DefaultField - comment method.
func (*SQLBuilderOrderBy) Field ¶ added in v0.11.0
func (b *SQLBuilderOrderBy) Field(name string, direction mrenum.SortDirection) mrstorage.SQLBuilderPartFunc
Field - comment method.
func (*SQLBuilderOrderBy) Join ¶ added in v0.11.0
func (b *SQLBuilderOrderBy) Join(fields ...mrstorage.SQLBuilderPartFunc) mrstorage.SQLBuilderPartFunc
Join - comment method.
type SQLBuilderSelect ¶ added in v0.11.0
type SQLBuilderSelect struct {
// contains filtered or unexported fields
}
SQLBuilderSelect - comment struct.
func NewSQLBuilderSelect ¶ added in v0.11.0
func NewSQLBuilderSelect(where *SQLBuilderWhere, orderBy *SQLBuilderOrderBy, limit *SQLBuilderLimit) *SQLBuilderSelect
NewSQLBuilderSelect - создаёт объект SQLBuilderSelect.
func (*SQLBuilderSelect) Limit ¶ added in v0.11.0
func (b *SQLBuilderSelect) Limit(f func(p mrstorage.SQLBuilderLimit) mrstorage.SQLBuilderPartFunc) mrstorage.SQLBuilderPart
Limit - comment method.
func (*SQLBuilderSelect) OrderBy ¶ added in v0.11.0
func (b *SQLBuilderSelect) OrderBy(f func(o mrstorage.SQLBuilderOrderBy) mrstorage.SQLBuilderPartFunc) mrstorage.SQLBuilderPart
OrderBy - comment method.
func (*SQLBuilderSelect) Where ¶ added in v0.11.0
func (b *SQLBuilderSelect) Where(f func(w mrstorage.SQLBuilderWhere) mrstorage.SQLBuilderPartFunc) mrstorage.SQLBuilderPart
Where - comment method.
type SQLBuilderSet ¶ added in v0.11.0
type SQLBuilderSet struct{}
SQLBuilderSet - comment struct.
func NewSQLBuilderSet ¶ added in v0.11.0
func NewSQLBuilderSet() *SQLBuilderSet
NewSQLBuilderSet - создаёт объект SQLBuilderSet.
func (*SQLBuilderSet) Field ¶ added in v0.11.0
func (b *SQLBuilderSet) Field(name string, value any) mrstorage.SQLBuilderPartFunc
Field - comment method.
func (*SQLBuilderSet) Fields ¶ added in v0.11.0
func (b *SQLBuilderSet) Fields(names []string, args []any) mrstorage.SQLBuilderPartFunc
Fields - comment method.
func (*SQLBuilderSet) Join ¶ added in v0.11.0
func (b *SQLBuilderSet) Join(fields ...mrstorage.SQLBuilderPartFunc) mrstorage.SQLBuilderPartFunc
Join - comment method.
type SQLBuilderUpdate ¶ added in v0.11.0
type SQLBuilderUpdate struct {
// contains filtered or unexported fields
}
SQLBuilderUpdate - comment struct.
func NewSQLBuilderUpdate ¶ added in v0.11.0
func NewSQLBuilderUpdate(set *SQLBuilderSet, where *SQLBuilderWhere) *SQLBuilderUpdate
NewSQLBuilderUpdate - создаёт объект SQLBuilderUpdate.
func NewSQLBuilderUpdateWithMeta ¶ added in v0.11.0
func NewSQLBuilderUpdateWithMeta(meta *mrsql.EntityMetaUpdate, set *SQLBuilderSet, where *SQLBuilderWhere) *SQLBuilderUpdate
NewSQLBuilderUpdateWithMeta - создаёт объект SQLBuilderUpdate с метаинформацией.
func (*SQLBuilderUpdate) Set ¶ added in v0.11.0
func (b *SQLBuilderUpdate) Set(f func(s mrstorage.SQLBuilderSet) mrstorage.SQLBuilderPartFunc) mrstorage.SQLBuilderPart
Set - comment method.
func (*SQLBuilderUpdate) SetFromEntity ¶ added in v0.11.0
func (b *SQLBuilderUpdate) SetFromEntity(entity any) (mrstorage.SQLBuilderPart, error)
SetFromEntity - comment method.
func (*SQLBuilderUpdate) SetFromEntityWith ¶ added in v0.11.0
func (b *SQLBuilderUpdate) SetFromEntityWith( entity any, extFields func(s mrstorage.SQLBuilderSet) mrstorage.SQLBuilderPartFunc, ) (mrstorage.SQLBuilderPart, error)
SetFromEntityWith - comment method.
func (*SQLBuilderUpdate) Where ¶ added in v0.11.0
func (b *SQLBuilderUpdate) Where(f func(w mrstorage.SQLBuilderWhere) mrstorage.SQLBuilderPartFunc) mrstorage.SQLBuilderPart
Where - comment method.
type SQLBuilderWhere ¶ added in v0.11.0
type SQLBuilderWhere struct{}
SQLBuilderWhere - объект для создания SQL условий.
func NewSQLBuilderWhere ¶ added in v0.11.0
func NewSQLBuilderWhere() *SQLBuilderWhere
NewSQLBuilderWhere - создаёт объект SQLBuilderWhere.
func (*SQLBuilderWhere) Equal ¶ added in v0.11.0
func (b *SQLBuilderWhere) Equal(name string, value any) mrstorage.SQLBuilderPartFunc
Equal - возвращает строгое условие равенства.
func (*SQLBuilderWhere) Expr ¶ added in v0.11.0
func (b *SQLBuilderWhere) Expr(expr string) mrstorage.SQLBuilderPartFunc
Expr - возвращает простое условие, например: "field_name BETWEEN 1000 AND 2000". Но если выражение пустое, то возвращается nil.
func (*SQLBuilderWhere) ExprWithValue ¶ added in v0.11.0
func (b *SQLBuilderWhere) ExprWithValue(expr string, value any) mrstorage.SQLBuilderPartFunc
ExprWithValue - возвращает условие с параметром, например: "UPPER(field_name) = %s". Но если выражение пустое, то возвращается nil.
func (*SQLBuilderWhere) FilterAnyOf ¶ added in v0.11.0
func (b *SQLBuilderWhere) FilterAnyOf(name string, values any) mrstorage.SQLBuilderPartFunc
FilterAnyOf - 'values' support only slices else the func returns nil.
func (*SQLBuilderWhere) FilterEqualBool ¶ added in v0.11.0
func (b *SQLBuilderWhere) FilterEqualBool(name string, value *bool) mrstorage.SQLBuilderPartFunc
FilterEqualBool - возвращает условие равенства bool если значение не nil, иначе возвращается nil.
func (*SQLBuilderWhere) FilterEqualInt64 ¶ added in v0.11.0
func (b *SQLBuilderWhere) FilterEqualInt64(name string, value, empty int64) mrstorage.SQLBuilderPartFunc
FilterEqualInt64 - возвращает условие равенства целого числа если значение не пустое, иначе возвращается nil.
func (*SQLBuilderWhere) FilterEqualString ¶ added in v0.11.0
func (b *SQLBuilderWhere) FilterEqualString(name, value string) mrstorage.SQLBuilderPartFunc
FilterEqualString - возвращает условие равенства строки если значение не пустое, иначе возвращается nil.
func (*SQLBuilderWhere) FilterEqualUUID ¶ added in v0.11.0
func (b *SQLBuilderWhere) FilterEqualUUID(name string, value uuid.UUID) mrstorage.SQLBuilderPartFunc
FilterEqualUUID - возвращает условие равенства UUID если значение не пустое, иначе возвращается nil.
func (*SQLBuilderWhere) FilterLike ¶ added in v0.11.0
func (b *SQLBuilderWhere) FilterLike(name, value string) mrstorage.SQLBuilderPartFunc
FilterLike - возвращает условие LIKE если значение не пустое, иначе возвращается nil.
func (*SQLBuilderWhere) FilterLikeFields ¶ added in v0.11.0
func (b *SQLBuilderWhere) FilterLikeFields(names []string, value string) mrstorage.SQLBuilderPartFunc
FilterLikeFields - возвращает условие LIKE для нескольких полей если значение не пустое, иначе возвращается nil.
func (*SQLBuilderWhere) FilterRangeFloat64 ¶ added in v0.11.10
func (b *SQLBuilderWhere) FilterRangeFloat64(name string, value mrtype.RangeFloat64, empty, qualityThreshold float64) mrstorage.SQLBuilderPartFunc
FilterRangeFloat64 - возвращает интервальное условие для вещественных чисел если значения Min, Max не пустые, иначе возвращается nil.
func (*SQLBuilderWhere) FilterRangeInt64 ¶ added in v0.11.0
func (b *SQLBuilderWhere) FilterRangeInt64(name string, value mrtype.RangeInt64, empty int64) mrstorage.SQLBuilderPartFunc
FilterRangeInt64 - возвращает интервальное условие для целых чисел если значения Min, Max не пустые, иначе возвращается nil.
func (*SQLBuilderWhere) Greater ¶ added in v0.11.0
func (b *SQLBuilderWhere) Greater(name string, value any) mrstorage.SQLBuilderPartFunc
Greater - возвращает строгое условие больше.
func (*SQLBuilderWhere) GreaterOrEqual ¶ added in v0.11.0
func (b *SQLBuilderWhere) GreaterOrEqual(name string, value any) mrstorage.SQLBuilderPartFunc
GreaterOrEqual - возвращает строгое условие больше или равно.
func (*SQLBuilderWhere) JoinAnd ¶ added in v0.11.0
func (b *SQLBuilderWhere) JoinAnd(conds ...mrstorage.SQLBuilderPartFunc) mrstorage.SQLBuilderPartFunc
JoinAnd - возвращает SQL условия соединённые методом AND.
func (*SQLBuilderWhere) JoinOr ¶ added in v0.11.0
func (b *SQLBuilderWhere) JoinOr(conds ...mrstorage.SQLBuilderPartFunc) mrstorage.SQLBuilderPartFunc
JoinOr - возвращает SQL условия соединённые методом OR.
func (*SQLBuilderWhere) Less ¶ added in v0.11.0
func (b *SQLBuilderWhere) Less(name string, value any) mrstorage.SQLBuilderPartFunc
Less - возвращает строгое условие меньше.
func (*SQLBuilderWhere) LessOrEqual ¶ added in v0.11.0
func (b *SQLBuilderWhere) LessOrEqual(name string, value any) mrstorage.SQLBuilderPartFunc
LessOrEqual - возвращает строгое условие меньше равно.
func (*SQLBuilderWhere) NotEqual ¶ added in v0.11.0
func (b *SQLBuilderWhere) NotEqual(name string, value any) mrstorage.SQLBuilderPartFunc
NotEqual - возвращает строгое условие неравенства.
type TxManagerStub ¶ added in v0.11.0
type TxManagerStub struct{}
TxManagerStub - фиктивный менеджер транзакций, который запускает только переданную работу без открытия транзакции.
func NewTxManagerStub ¶ added in v0.11.0
func NewTxManagerStub() *TxManagerStub
NewTxManagerStub - создаёт объект TxManagerStub.
Source Files ¶
- conn_adapter.go
- conn_manager.go
- conn_queries.go
- conn_transaction.go
- exec_helper.go
- query_row.go
- query_rows.go
- sql_builder_condition.go
- sql_builder_limit.go
- sql_builder_orderby.go
- sql_builder_select.go
- sql_builder_set.go
- sql_builder_update.go
- sql_builder_where.go
- transaction.go
- transaction_ctx.go
- tx_manager_stub.go
- wrapper_errors.go