Versions in this module Expand all Collapse all v0 v0.0.6 Aug 17, 2021 v0.0.5 Aug 4, 2021 Changes in this version + type Database struct + func New(ctx context.Context, replica ...*Replica) (*Database, error) + func NewFromDSN(ctx context.Context, dsn ...string) (*Database, error) + func (d *Database) Begin(ctx context.Context, t ReplicaType) (pgx.Tx, error) + func (d *Database) BeginFunc(ctx context.Context, t ReplicaType, f func(pgx.Tx) error) error + func (d *Database) BeginTx(ctx context.Context, t ReplicaType, txOptions pgx.TxOptions) (pgx.Tx, error) + func (d *Database) BeginTxFunc(ctx context.Context, t ReplicaType, txOptions pgx.TxOptions, ...) error + func (d *Database) Exec(ctx context.Context, sql string, args ...interface{}) (pgconn.CommandTag, error) + func (d *Database) GetReplica(t ReplicaType) *Replica + func (d *Database) Migrate(source migration.Source, direction migration.Direction, max int) (int, error) + func (d *Database) Query(ctx context.Context, sql string, args ...interface{}) (pgx.Rows, error) + func (d *Database) QueryFunc(ctx context.Context, sql string, args []interface{}, scans []interface{}, ...) (pgconn.CommandTag, error) + func (d *Database) QueryRow(ctx context.Context, sql string, args ...interface{}) pgx.Row + func (d *Database) SelectAll(ctx context.Context, dest interface{}, sql string, args ...interface{}) error + func (d *Database) SelectOne(ctx context.Context, dest interface{}, sql string, args ...interface{}) error + func (d *Database) SendBatch(ctx context.Context, t ReplicaType, b *pgx.Batch) pgx.BatchResults + type Entity struct + CreatedAt pgtype.Timestamp + DeletedAt pgtype.Timestamp + ID uint + UUID pgtype.UUID + UpdatedAt pgtype.Timestamp + func (e *Entity) GetCreatedAt() time.Time + func (e *Entity) GetDeletedAt() time.Time + func (e *Entity) GetID() uint + func (e *Entity) GetUUID() string + func (e *Entity) GetUpdatedAt() time.Time + type Replica struct + DSN string + Type ReplicaType + func ROReplica(dsn string) *Replica + func RWReplica(dsn string) *Replica + func (r *Replica) Ping(ctx context.Context) error + type ReplicaType uint8 + const ReplicaTypeRO + const ReplicaTypeRW