Documentation
¶
Index ¶
- func Count[T any](o *Db) (int, error)
- func Delete[T any](o *Db, fn func(*bun.DeleteQuery)) (int64, error)
- func DeleteAll[T any](o *Db) (int64, error)
- func Diff[T any](a, b T) []string
- func Equal[T any](a, b T) bool
- func PkName(model any) (name string, err error)
- func UpdateDiff[T any](db *Db, prev, curr T) (columns []string, err error)
- type Db
- func (o *Db) Close()
- func (o *Db) ConnStat() sql.DBStats
- func (o *Db) Count(model any) (int, error)
- func (o *Db) Delete(model any, fn func(*bun.DeleteQuery)) (int64, error)
- func (o *Db) DeleteAll(model any) (int64, error)
- func (o *Db) Exec(query string, arg ...any) error
- func (o *Db) Exists(model any, fn func(*bun.SelectQuery)) (bool, error)
- func (o *Db) ExistsPk(model any) (bool, error)
- func (o *Db) Format(query string, arg ...any) string
- func (o *Db) GetIfExists(model any, fn func(*bun.SelectQuery)) (bool, error)
- func (o *Db) GetIfExistsPk(model any) (bool, error)
- func (o *Db) Insert(model any) error
- func (o *Db) Migrator() *Migrator
- func (o *Db) NewSelect(model any) *bun.SelectQuery
- func (o *Db) Ok() bool
- func (o *Db) OnReady(f func())
- func (o *Db) OnReadyFor(f func(), timeout time.Duration)
- func (o *Db) Ping() bool
- func (o *Db) Scan(model any, query string, arg ...any) error
- func (o *Db) Select(model any, fn func(*bun.SelectQuery)) error
- func (o *Db) SelectAll(model any) error
- func (o *Db) SelectIn(model any, ids any) error
- func (o *Db) SelectPk(model any) error
- func (o *Db) SetOnStatus(f func(bool))
- func (o *Db) Stat() bun.DBStats
- func (o *Db) Transaction(f func(ctx context.Context, tx bun.Tx) error) error
- func (o *Db) Truncate(model any) error
- func (o *Db) Update(model any, fn func(*bun.UpdateQuery)) error
- func (o *Db) UpdateAll(model any) error
- func (o *Db) UpdateIn(model any, ids any) error
- func (o *Db) UpdatePk(model any) error
- func (o *Db) UpdatePkOmitZero(model any) error
- func (o *Db) Upsert(model any) error
- func (o *Db) Wait(timeout time.Duration) bool
- func (o *Db) WaitForReady(timeout time.Duration) time.Duration
- type Hosts
- type Migrator
- func (o *Migrator) Exec(fs fs.FS) bool
- func (o *Migrator) ExecOpt(fs fs.FS, opt MigratorOptions) (ok bool)
- func (o *Migrator) WithAutoDownSql(v bool) *Migrator
- func (o *Migrator) WithMarkAppliedOnSuccess(v bool) *Migrator
- func (o *Migrator) WithRollbackLost(v bool) *Migrator
- func (o *Migrator) WithSaveDownSql(v bool) *Migrator
- type MigratorAction
- type MigratorOptions
- type Options
- type Updater
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Db ¶
type Db struct {
// contains filtered or unexported fields
}
func (*Db) GetIfExists ¶
func (*Db) OnReadyFor ¶ added in v0.7.8
func (*Db) SetOnStatus ¶ added in v0.7.76
func (*Db) Transaction ¶ added in v0.7.36
func (*Db) UpdatePkOmitZero ¶ added in v0.7.52
type Migrator ¶ added in v0.4.2
type Migrator struct {
// contains filtered or unexported fields
}
func NewMigrator ¶ added in v0.4.2
func (*Migrator) ExecOpt ¶ added in v0.7.38
func (o *Migrator) ExecOpt(fs fs.FS, opt MigratorOptions) (ok bool)
func (*Migrator) WithAutoDownSql ¶ added in v0.4.2
func (*Migrator) WithMarkAppliedOnSuccess ¶ added in v0.4.2
func (*Migrator) WithRollbackLost ¶ added in v0.4.2
func (*Migrator) WithSaveDownSql ¶ added in v0.4.2
type MigratorAction ¶ added in v0.7.38
type MigratorAction string
const ( Migrate MigratorAction = "" Rollback MigratorAction = "rollback" PreviewDown MigratorAction = "preview-down" RepairDown MigratorAction = "repair-down" ViewSchema MigratorAction = "view-schema" )
type MigratorOptions ¶ added in v0.7.38
type Options ¶ added in v0.2.7
type Options struct {
User string
Pass string
Host string
Name string
Timeout time.Duration
MaxConnFactor float32
MinOpenConns int
Strict bool
Insecure bool
LogErrors bool
LogQueries bool
LogLongQueries bool
WarnLongQueries bool
LongQueriesTime time.Duration
ReadOnly bool
}
func (Options) MaxOpenConnections ¶ added in v0.7.8
type Updater ¶ added in v0.2.8
type Updater[T any] struct { // contains filtered or unexported fields }
func NewUpdater ¶ added in v0.2.8
Source Files
¶
Click to show internal directories.
Click to hide internal directories.