db

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2023 License: Apache-2.0 Imports: 2 Imported by: 11

README

db

定义数据库执行器基础方法接口

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseExecutor

type BaseExecutor interface {
	PrepareContext(ctx context.Context, query string) (Stmt, error)

	ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)

	QueryContext(ctx context.Context, query string, args ...any) (Rows, error)

	QueryRowContext(ctx context.Context, query string, args ...any) Row
}

type Executor

type Executor interface {
	BaseExecutor

	BeginTx(ctx context.Context, opts *sql.TxOptions) (Tx, error)
}

type Row

type Row interface {
	Scan(dest ...any) error
}

type Rows

type Rows interface {
	ColumnTypes() ([]*sql.ColumnType, error)
	Columns() ([]string, error)
	Err() error
	Next() bool
	NextResultSet() bool
	Close() error
	Scan(dest ...any) error
}

type Stmt

type Stmt interface {
	Close() error
	ExecContext(ctx context.Context, args ...any) (sql.Result, error)
	QueryContext(ctx context.Context, args ...any) (Rows, error)
	QueryRowContext(ctx context.Context, args ...any) Row
}

type Tx

type Tx interface {
	BaseExecutor

	Commit() error
	Rollback() error
	StmtContext(ctx context.Context, stmt Stmt) Stmt
}

Jump to

Keyboard shortcuts

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