orm

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2023 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

type Database interface {
	Pool(name string) Stmt
	Dialect() string
}

func New

func New(c schema.Connector, opts ...PluginSetup) Database

New init database connections

type Executor

type Executor interface {
	SQL(query string, args ...interface{})
	Params(args ...interface{})
	Bind(call func(result Result) error)
}

Executor interface for generate execute query

type PluginSetup

type PluginSetup func(o *options)

func UsePluginLogger

func UsePluginLogger(l log.Logger) PluginSetup

func UsePluginMetric

func UsePluginMetric(m plugins.MetricExecutor) PluginSetup

type Querier

type Querier interface {
	SQL(query string, args ...interface{})
	Bind(call func(bind Scanner) error)
}

Querier interface for generate query

type Result

type Result struct {
	RowsAffected int64
	LastInsertId int64
}

Result exec result model

type Scanner

type Scanner interface {
	Scan(args ...interface{}) error
}

Scanner interface for bind data

type Stmt

type Stmt interface {
	Ping() error
	CallContext(name string, ctx context.Context, callFunc func(context.Context, *sql.DB) error) error
	TxContext(name string, ctx context.Context, callFunc func(context.Context, *sql.Tx) error) error

	ExecContext(name string, ctx context.Context, call func(q Executor)) error
	QueryContext(name string, ctx context.Context, call func(q Querier)) error
	TransactionContext(name string, ctx context.Context, call func(v Tx)) error
}

Stmt statement model

type Tx

type Tx interface {
	Exec(vv ...func(e Executor))
	Query(vv ...func(q Querier))
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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