xdb

package
v0.1.36 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2023 License: MIT Imports: 7 Imported by: 2

Documentation

Index

Constants

View Source
const DbTypeNode = "dbs"

Variables

View Source
var (
	DateFormat = "2006-01-02 15:04:05"
)

Functions

func Deregister

func Deregister(name string)

Deregister 清理配置适配器

func NewBuilder

func NewBuilder() container.StandardBuilder

func NewError added in v0.1.30

func NewError(err error, sql string, args []interface{}) error

func Register

func Register(resolver Resover)

Register 注册配置文件适配器

func RegistryLogger added in v0.1.31

func RegistryLogger(logger Logger)

Types

type DbError added in v0.1.30

type DbError interface {
	Error() string
	Inner() error
	SQL() string
	Args() []interface{}
}

type Executer

type Executer interface {
	Query(ctx context.Context, sql string, input map[string]interface{}) (data Rows, err error)
	Multi(ctx context.Context, sql string, input map[string]interface{}) (data []Rows, err error)
	First(ctx context.Context, sql string, input map[string]interface{}) (data Row, err error)
	Scalar(ctx context.Context, sql string, input map[string]interface{}) (data interface{}, err error)
	Exec(ctx context.Context, sql string, input map[string]interface{}) (r Result, err error)
}

Executer 数据库操作对象集合

type IDB

type IDB interface {
	Executer
	Begin() (ITrans, error)
	Close() error
	GetImpl() interface{}
}

IDB 数据库操作接口

type ITrans

type ITrans interface {
	Executer
	Rollback() error
	Commit() error
}

ITrans 数据库事务接口

type Logger added in v0.1.31

type Logger interface {
	Name() string
	Log(args ...interface{})
}

func GetLogger added in v0.1.31

func GetLogger(loggerName string) (Logger, bool)

type Resover added in v0.1.2

type Resover interface {
	Name() string
	Resolve(setting config.Config) (interface{}, error)
}

dbResover 定义配置文件转换方法

type Result

type Result = sql.Result

type Row

type Row = xtypes.XMap

Row 单行数据

func NewRow

func NewRow() Row

NewRow 构建Row对象

type Rows

type Rows = xtypes.XMaps

Rows 多行数据

func NewRows

func NewRows() Rows

NewRows 构建Rows

type StandardDB

type StandardDB interface {
	GetDB(name ...string) (q IDB)
	GetImpl(name ...string) interface{}
}

StandardDB

func NewStandardDB

func NewStandardDB(container container.Container) StandardDB

NewStandardDBs 创建DB

Jump to

Keyboard shortcuts

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