Versions in this module Expand all Collapse all v0 v0.1.0 May 24, 2024 Changes in this version + const MySQL + const PostgreSQL + func CantPerformQuery(err error, q string) error + func SplitOnDupId[T IDer]() com.BulkChunkSplitPolicy[T] + func TableName(t interface{}) string + type ColumnMap interface + Columns func(any) []string + func NewColumnMap(mapper *reflectx.Mapper) ColumnMap + type Config struct + Database string + Host string + Options Options + Password string + Port int + TlsOptions config.TLS + Type string + User string + func (c *Config) Validate() error + type DB struct + Options *Options + func NewDbFromConfig(c *Config, logger *logging.Logger, connectorCallbacks RetryConnectorCallbacks) (*DB, error) + func (db *DB) BatchSizeByPlaceholders(n int) int + func (db *DB) BuildDeleteStmt(from interface{}) string + func (db *DB) BuildInsertIgnoreStmt(into interface{}) (string, int) + func (db *DB) BuildInsertStmt(into interface{}) (string, int) + func (db *DB) BuildSelectStmt(table interface{}, columns interface{}) string + func (db *DB) BuildUpdateStmt(update interface{}) (string, int) + func (db *DB) BuildUpsertStmt(subject interface{}) (stmt string, placeholders int) + func (db *DB) BuildWhere(subject interface{}) (string, int) + func (db *DB) BulkExec(ctx context.Context, query string, count int, sem *semaphore.Weighted, ...) error + func (db *DB) CreateIgnoreStreamed(ctx context.Context, entities <-chan Entity, onSuccess ...OnSuccess[Entity]) error + func (db *DB) CreateStreamed(ctx context.Context, entities <-chan Entity, onSuccess ...OnSuccess[Entity]) error + func (db *DB) Delete(ctx context.Context, entityType Entity, ids []interface{}, ...) error + func (db *DB) DeleteStreamed(ctx context.Context, entityType Entity, ids <-chan interface{}, ...) error + func (db *DB) GetAddr() string + func (db *DB) GetDefaultRetrySettings() retry.Settings + func (db *DB) GetSemaphoreForTable(table string) *semaphore.Weighted + func (db *DB) Log(ctx context.Context, query string, counter *com.Counter) periodic.Stopper + func (db *DB) NamedBulkExec(ctx context.Context, query string, count int, sem *semaphore.Weighted, ...) error + func (db *DB) NamedBulkExecTx(ctx context.Context, query string, count int, sem *semaphore.Weighted, ...) error + func (db *DB) UpdateStreamed(ctx context.Context, entities <-chan Entity) error + func (db *DB) UpsertStreamed(ctx context.Context, entities <-chan Entity, onSuccess ...OnSuccess[Entity]) error + func (db *DB) YieldAll(ctx context.Context, factoryFunc EntityFactoryFunc, query string, ...) (<-chan Entity, <-chan error) + type Entity interface + type EntityFactoryFunc func() Entity + type Fingerprinter interface + Fingerprint func() Fingerprinter + type ID interface + String func() string + type IDer interface + ID func() ID + SetID func(ID) + type MysqlFuncLogger func(v ...interface{}) + func (log MysqlFuncLogger) Print(v ...interface{}) + type OnInitConnFunc func(context.Context, driver.Conn) error + type OnSuccess func(ctx context.Context, affectedRows []T) (err error) + func OnSuccessIncrement[T any](counter *com.Counter) OnSuccess[T] + func OnSuccessSendTo[T any](ch chan<- T) OnSuccess[T] + type Options struct + MaxConnections int + MaxConnectionsPerTable int + MaxPlaceholdersPerStatement int + MaxRowsPerTransaction int + WsrepSyncWait int + func (o *Options) Validate() error + type PgsqlOnConflictConstrainter interface + PgsqlOnConflictConstraint func() string + type RetryConnector struct + func NewConnector(c driver.Connector, logger *logging.Logger, callbacks RetryConnectorCallbacks) *RetryConnector + func (c RetryConnector) Connect(ctx context.Context) (driver.Conn, error) + func (c RetryConnector) Driver() driver.Driver + type RetryConnectorCallbacks struct + OnInitConn OnInitConnFunc + OnRetryableError retry.OnRetryableErrorFunc + OnSuccess retry.OnSuccessFunc + type Scoper interface + Scope func() any + type TableNamer interface + TableName func() string + type Upserter interface + Upsert func() any