Documentation
¶
Index ¶
- Constants
- func Bootstrap(db *sqlx.DB) *initiator
- func BootstrapDual(write *sqlx.DB, read *sqlx.DB) *initiator
- func NewDefaultQueryClient(identifier string, queryMap *entity.QueryMap, ...) *defaultQueryClient
- type ApplicationContext
- type QueryClient
- type ReadOnlyQueryClient
- type TxBlock
- type TxBlockAuto
- type TxManager
Constants ¶
View Source
const DBManager dBManager = 1
DBManager Developers get raw DB struct
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ApplicationContext ¶
type ApplicationContext interface {
GetQueryClient(identifier string) (QueryClient, errors.Error)
GetReadOnlyQueryClient(identifier string) (ReadOnlyQueryClient, errors.Error)
RegisterQueryClient(client QueryClient) errors.Error
GetDBs() *entity.DbSet
GetDB(readDB bool) *sqlx.DB
GetTxManager() TxManager
}
func GetApplicationContext ¶
func GetApplicationContext() ApplicationContext
type QueryClient ¶
type QueryClient interface {
ReadOnlyQueryClient
InsertOne(ctx context.Context, tagName string, args map[string]any, conditions ...entity.PredicateConditions) errors.Error
InsertOneTx(ctx context.Context, tx *sqlx.Tx, tagName string, args map[string]any, conditions ...entity.PredicateConditions) errors.Error
Delete(ctx context.Context, tagName string, args map[string]any, conditions ...entity.PredicateConditions) (int64, errors.Error)
DeleteTx(ctx context.Context, tx *sqlx.Tx, tagName string, args map[string]any, conditions ...entity.PredicateConditions) (int64, errors.Error)
Update(ctx context.Context, tagName string, args map[string]any, conditions ...entity.PredicateConditions) (int64, errors.Error)
UpdateTx(ctx context.Context, tx *sqlx.Tx, tagName string, args map[string]any, conditions ...entity.PredicateConditions) (int64, errors.Error)
}
func NewQueryClient ¶
func NewQueryClient(identifier string, filePath string) (QueryClient, errors.Error)
type ReadOnlyQueryClient ¶
type ReadOnlyQueryClient interface {
BeginTx(ctx context.Context) (*sqlx.Tx, errors.Error)
RollbackTx(ctx context.Context, tx *sqlx.Tx) errors.Error
CommitTx(ctx context.Context, tx *sqlx.Tx) errors.Error
GetOne(ctx context.Context, tagName string, dest any, args map[string]any, conditions ...entity.PredicateConditions) errors.Error
GetOneTx(ctx context.Context, tx *sqlx.Tx, tagName string, dest any, args map[string]any, conditions ...entity.PredicateConditions) errors.Error
Get(ctx context.Context, tagName string, dest any, args map[string]any, conditions ...entity.PredicateConditions) errors.Error
GetTx(ctx context.Context, tx *sqlx.Tx, tagName string, dest any, args map[string]any, conditions ...entity.PredicateConditions) errors.Error
Id() string
ReadOnly() bool
}
func NewReadOnlyQueryClient ¶
func NewReadOnlyQueryClient(identifier string, filePath string) (ReadOnlyQueryClient, errors.Error)
type TxBlockAuto ¶ added in v1.1.1
type TxManager ¶ added in v1.1.0
type TxManager interface {
Txx(ctx context.Context, txBlock TxBlockAuto) errors.Error
TxxWithOpt(ctx context.Context, opts *sql.TxOptions, txBlock TxBlockAuto) errors.Error
Tx(ctx context.Context, txBlock TxBlock) errors.Error
TxWithOpt(ctx context.Context, opts *sql.TxOptions, txBlock TxBlock) errors.Error
}
func NewTxManager ¶ added in v1.1.0
Source Files
¶
Click to show internal directories.
Click to hide internal directories.