internal

package
v0.12.3 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	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"`
	GTMCleanUpSecond int      `json:"gtmCleanUpSecond"`
	Isolation        int      `json:"isolation"`
}

type Database

type Database interface {
	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)
	Close()
}

func New

func New(options Options) (v Database, err error)

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)
}

type Tuple

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

func NewTuple

func NewTuple() *Tuple

func (*Tuple) Append

func (t *Tuple) Append(values ...interface{}) *Tuple

func (*Tuple) MapToSQLArgs

func (t *Tuple) MapToSQLArgs() (args []interface{})

func (Tuple) MarshalJSON

func (t Tuple) MarshalJSON() (p []byte, err error)

func (*Tuple) Merge

func (t *Tuple) Merge(v *Tuple) *Tuple

func (*Tuple) Size

func (t *Tuple) Size() (n int)

func (Tuple) String

func (t Tuple) String() (s string)

func (*Tuple) UnmarshalJSON

func (t *Tuple) UnmarshalJSON(p []byte) (err error)

Jump to

Keyboard shortcuts

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