dbx

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clear

func Clear(name string)

func Delete

func Delete(name string)

func EmptyResultError added in v0.0.8

func EmptyResultError(err error) bool

func Name

func Name(data interface{}) string

Types

type Config

type Config struct {
	Port     int
	Host     string
	Type     string
	Name     string
	User     string
	Charset  string
	Password string
}

type DBConnect

type DBConnect struct {
	logx.Logger
	// contains filtered or unexported fields
}

func Get

func Get(logger logx.Logger, name ...interface{}) *DBConnect

func NewConnect

func NewConnect(db *sql.DB) *DBConnect

func Open

func Open(cfg *Config) (*DBConnect, error)

func Set

func Set(name string, pool *DBConnect, logger logx.Logger) *DBConnect

func (*DBConnect) Close

func (db *DBConnect) Close()

func (DBConnect) DB

func (db DBConnect) DB() *sql.DB

func (DBConnect) Exec

func (db DBConnect) Exec(sqlcmd string, args ...interface{}) (sql.Result, error)

func (DBConnect) ExecBatch

func (db DBConnect) ExecBatch(callback func(*DBConnect) error) error

func (DBConnect) Insert

func (db DBConnect) Insert(data interface{}, exclude ...Exclude) (sql.Result, error)

func (DBConnect) Query

func (db DBConnect) Query(sqlcmd string, args ...interface{}) (map[string]string, error)

func (DBConnect) QueryList

func (db DBConnect) QueryList(sqlcmd string, args ...interface{}) ([]map[string]string, error)

func (DBConnect) Select

func (db DBConnect) Select(result interface{}, sqlcmd string, args ...interface{}) error

func (DBConnect) SelectFrom

func (db DBConnect) SelectFrom(result interface{}, table string, cond string, args ...interface{}) error

func (DBConnect) SelectWhere

func (db DBConnect) SelectWhere(result interface{}, cond string, args ...interface{}) error

func (DBConnect) Update

func (db DBConnect) Update(data interface{}, keys Keys, exclude ...Exclude) (sql.Result, error)

type Exclude

type Exclude = []string

func ExcludeTimeFields

func ExcludeTimeFields(args ...string) Exclude

type Keys

type Keys = []string

Jump to

Keyboard shortcuts

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