db

package
v0.2.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 10, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PkName added in v0.2.7

func PkName(model any) (name string, err error)

Types

type Db

type Db struct {
	// contains filtered or unexported fields
}

func NewDb

func NewDb(opt Options) *Db

func (*Db) Close

func (o *Db) Close()

func (*Db) Count

func (o *Db) Count(model any) (int, error)

func (*Db) Delete

func (o *Db) Delete(model any, fn func(*bun.DeleteQuery)) error

func (*Db) DeleteAll

func (o *Db) DeleteAll(model any) error

func (*Db) Exec

func (o *Db) Exec(query string, arg ...any) error

func (*Db) Exists

func (o *Db) Exists(model any, fn func(*bun.SelectQuery)) (bool, error)

func (*Db) ExistsPk

func (o *Db) ExistsPk(model any) (bool, error)

func (*Db) Format

func (o *Db) Format(query string, arg ...any) string

func (*Db) GetIfExists

func (o *Db) GetIfExists(model any, fn func(*bun.SelectQuery)) (bool, error)

func (*Db) GetIfExistsPk

func (o *Db) GetIfExistsPk(model any) (bool, error)

func (*Db) Insert

func (o *Db) Insert(model any) error

func (*Db) Ok

func (o *Db) Ok() bool

func (*Db) Ping

func (o *Db) Ping() bool

func (*Db) Select

func (o *Db) Select(model any, fn func(*bun.SelectQuery)) error

func (*Db) SelectAll

func (o *Db) SelectAll(model any) error

func (*Db) Truncate

func (o *Db) Truncate(model any) error

func (*Db) Update

func (o *Db) Update(model any, fn func(*bun.UpdateQuery)) error

func (*Db) UpdateAll

func (o *Db) UpdateAll(model any) error

func (*Db) UpdateIn

func (o *Db) UpdateIn(model any, ids any) error

func (*Db) Upsert

func (o *Db) Upsert(model any) error

func (*Db) Wait

func (o *Db) Wait(timeout time.Duration) bool

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
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL