internal

package
v1.0.30 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyInterface added in v1.0.0

func CopyInterface(dst interface{}, src interface{}) (err error)

func RegisteredDrivers added in v1.0.0

func RegisteredDrivers() (drivers []string)

Types

type Client

type Client interface {
	SchemaOfDSN() (schema string)
	Reader() (v *sql.DB)
	Writer() (v *sql.DB)
	Close() (err error)
}

type Config

type Config struct {
	Driver                      string   `json:"driver"`
	MasterSlaverMode            bool     `json:"masterSlaverMode"`
	DSN                         []string `json:"dsn"`
	MaxIdles                    int      `json:"maxIdles"`
	MaxOpens                    int      `json:"maxOpens"`
	EnableDebugLog              bool     `json:"enableDebugLog"`
	TransactionMaxAliveDuration string   `json:"transactionMaxAliveDuration"`
	GTMCleanUpSecond            int      `json:"gtmCleanUpSecond"`
	Isolation                   int      `json:"isolation"`
	Dialect                     string   `json:"dialect"`
}

type Database

type Database interface {
	service.Component
	Dialect() (name string)
	BeginTransaction(ctx context.Context) (err errors.CodeError)
	CommitTransaction(ctx context.Context) (finished bool, err errors.CodeError)
	RollbackTransaction(ctx context.Context) (err errors.CodeError)
	Query(ctx context.Context, query string, args []interface{}) (rows *sql.Rows, err errors.CodeError)
	Execute(ctx context.Context, query string, args []interface{}) (result sql.Result, err errors.CodeError)
}

func New

func New(name string) (v Database)

type Executor

type Executor interface {
	ExecContext(ctx context.Context, query string, args ...interface{}) (result sql.Result, err error)
}

type GlobalTransaction

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

type Options

type Options struct {
	Log    logs.Logger
	Config *Config
}

type QueryAble

type QueryAble interface {
	QueryContext(ctx context.Context, query string, args ...interface{}) (rows *sql.Rows, err error)
}

Jump to

Keyboard shortcuts

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