implement

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetError

func GetError(err error, query string, args ...interface{}) error

func ResolveFirstDataResult

func ResolveFirstDataResult(rows *sql.Rows, result any) (err error)

解析数据结果

func ResolveFirstRow

func ResolveFirstRow(rows *sql.Rows) (dataRows xdb.Row, err error)

func ResolveMultiRows

func ResolveMultiRows(rows *sql.Rows) (datasetRows []xdb.Rows, err error)

func ResolveParams

func ResolveParams(input any) (params xtypes.XMap, err error)

func ResolveRows

func ResolveRows(rows *sql.Rows) (dataRows xdb.Rows, err error)

func ResolveRowsDataResult

func ResolveRowsDataResult(rows *sql.Rows, result any) (err error)

解析数据结果

func ResolveScalar

func ResolveScalar(rows *sql.Rows) (val any, err error)

func Unwrap

func Unwrap(args ...interface{}) []interface{}

Types

type DbResolveMapValCallback

type DbResolveMapValCallback func(*sql.Rows) (result any, err error)

type DbResolveResultCallback

type DbResolveResultCallback func(*sql.Rows, any) error

type ISysDB

type ISysDB interface {
	Query(string, ...interface{}) (*sql.Rows, error)
	Exec(string, ...interface{}) (sql.Result, error)
	Begin() (ISysTrans, error)
	Close() error
}

func NewSysDB

func NewSysDB(proto string, conn string, opts ...Option) (ISysDB, error)

NewSysDB 创建DB实例

type ISysTrans

type ISysTrans interface {
	Query(string, ...interface{}) (*sql.Rows, error)
	Execute(string, ...interface{}) (sql.Result, error)
	Rollback() error
	Commit() error
}

ISysTrans 数据库事务接口

type Option added in v0.5.23

type Option func(*sysDB)

func WithConnName added in v0.5.23

func WithConnName(connName string) Option

func WithMaxIdle added in v0.5.23

func WithMaxIdle(maxIdle int) Option

func WithMaxLifeTime added in v0.5.23

func WithMaxLifeTime(maxLifeTime int) Option

func WithMaxOpen added in v0.5.23

func WithMaxOpen(maxOpen int) Option

type WrapArgs

type WrapArgs struct {
	Name  string
	Value any
	Out   bool
}

func (WrapArgs) MarshalJSON

func (a WrapArgs) MarshalJSON() (result []byte, err error)

func (WrapArgs) String

func (a WrapArgs) String() string

Jump to

Keyboard shortcuts

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