sqlx

package
v0.0.0-...-dec35dd Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2024 License: Apache-2.0 Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Deleter

type Deleter interface {
	Flusher
	Delete(tableName string, data interface{}) error
}

type Executor

type Executor interface {
	Flusher
	Execute(DML string, options ...ExecutorOption) error
}

type ExecutorOption

type ExecutorOption func(o *ExecutorOptions)

func WithExecutorArgs

func WithExecutorArgs(args ...interface{}) ExecutorOption

type ExecutorOptions

type ExecutorOptions struct {
	Args []interface{}
}

type Flusher

type Flusher interface {
	Flush(ctx context.Context, tableName string) error
}

type Inserter

type Inserter interface {
	Flusher
	Insert(tableName string, data interface{}) error
}

type Loader

type Loader interface {
	Flusher
	Load(ctx context.Context, tableName string, data interface{}) error
}

type Option

type Option func(o *Options)

func WithConnector

func WithConnector(name string) Option

func WithSqlDB

func WithSqlDB(db *sql.DB) Option

func WithSqlTx

func WithSqlTx(tx *sql.Tx) Option

type Options

type Options struct {
	WithConnector string
	WithDb        *sql.DB
	WithTx        *sql.Tx
}

type ReadOptions

type ReadOptions struct {
	Args []interface{}
}

type Reader

type Reader interface {
	Read(ctx context.Context, dest interface{}, SQL string, params ...interface{}) error
}

type ReaderOption

type ReaderOption func(o *ReadOptions)

type Sequencer

type Sequencer interface {
	Allocate(ctx context.Context, tableName string, dest interface{}, selector string) error
}

type Service

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

func New

func New(sqlx Sqlx) *Service

func (Service) Allocate

func (s Service) Allocate(ctx context.Context, tableName string, dest interface{}, selector string) error

func (Service) Db

func (s Service) Db(ctx context.Context) (*sql.DB, error)

func (Service) Delete

func (s Service) Delete(tableName string, data interface{}) error

func (Service) Execute

func (s Service) Execute(DML string, options ...ExecutorOption) error

func (Service) Flush

func (s Service) Flush(ctx context.Context, tableName string) error

func (Service) Insert

func (s Service) Insert(tableName string, data interface{}) error

func (Service) Load

func (s Service) Load(ctx context.Context, tableName string, data interface{}) error

func (Service) Read

func (s Service) Read(ctx context.Context, dest interface{}, SQL string, params ...interface{}) error

func (Service) Tx

func (s Service) Tx(ctx context.Context) (*sql.Tx, error)

func (Service) Update

func (s Service) Update(tableName string, data interface{}) error

func (Service) Validator

func (s Service) Validator() *validator.Service

type Sqlx

type Sqlx interface {
	Sequencer
	Inserter
	Loader
	Updater
	Deleter
	Executor
	Reader
	Db(ctx context.Context) (*sql.DB, error)
	Tx(ctx context.Context) (*sql.Tx, error)
	Validator() *validator.Service
}

type Updater

type Updater interface {
	Flusher
	Update(tableName string, data interface{}) error
}

Jump to

Keyboard shortcuts

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