repository

package
v0.0.0-...-03b02e1 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FmtParamList

func FmtParamList(length int, or ...string) string

func ParseEntities

func ParseEntities[T any](scan func(Scanner) (T, error), rows *sql.Rows, err error) ([]T, error)

Types

type Connector

type Connector interface {
	ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
	QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row
	QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
}

type DataManager

type DataManager interface {
	Connector
	Begin() (TransactionManager, error)
	Close() error
	PingContext(ctx context.Context) error
}

func NewDataSql

func NewDataSql(db *sql.DB) DataManager

func NewDataSqlWithConfig

func NewDataSqlWithConfig(config configs.ConfigDatabase) DataManager

func ProviderSet

func ProviderSet(
	config configs.Config,
) DataManager

type DataSql

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

func (*DataSql) Begin

func (d *DataSql) Begin() (TransactionManager, error)

func (*DataSql) Close

func (d *DataSql) Close() (err error)

func (*DataSql) ExecContext

func (d *DataSql) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)

func (*DataSql) PingContext

func (d *DataSql) PingContext(ctx context.Context) error

func (*DataSql) QueryContext

func (d *DataSql) QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)

func (*DataSql) QueryRowContext

func (d *DataSql) QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row

type Scanner

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

type TransactionManager

type TransactionManager interface {
	Connector
	Rollback() error
	Commit() error
}

type TransactionSql

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

func (*TransactionSql) Commit

func (t *TransactionSql) Commit() error

func (*TransactionSql) ExecContext

func (t *TransactionSql) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)

func (*TransactionSql) QueryContext

func (t *TransactionSql) QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)

func (*TransactionSql) QueryRowContext

func (t *TransactionSql) QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row

func (*TransactionSql) Rollback

func (t *TransactionSql) Rollback() error

Jump to

Keyboard shortcuts

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