drivers

package
v0.0.0-...-7ba985f Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDriverNotFound = errors.New("driver not found")

ErrDriverNotFound is an error when the driver is not found.

View Source
var RegisteredDriver = map[string]func() specs.Driver{
	"mysql": func() specs.Driver {
		return new(Mysql)
	},
}

RegisteredDriver is a map of registered driver, in test mode, this map will be replaced.

Functions

func Get

func Get(driver string) (specs.Driver, error)

Get is a helper function to get the driver.

func NewField

func NewField() specs.DriverField

NewField returns a new field

func NewJoin

func NewJoin() specs.DriverJoin

func NewLimit

func NewLimit() specs.DriverLimit

func NewRequiredFieldJoinErr

func NewRequiredFieldJoinErr(fields []string) specs.ErrRequiredFieldJoin

func NewUnknownFieldsErr

func NewUnknownFieldsErr(fields []string) specs.ErrUnknownFields

func NewUnknownOperatorErr

func NewUnknownOperatorErr(operator string) specs.ErrUnknownOperator

func NewWhere

func NewWhere() specs.DriverWhere

Types

type Mysql

type Mysql struct {
	specs.Config
	// contains filtered or unexported fields
}

func (*Mysql) Db

func (m *Mysql) Db() *sql.DB

Db is a helper function to get the database connection.

func (*Mysql) Get

func (m *Mysql) Get() *sql.DB

func (*Mysql) New

func (m *Mysql) New(config specs.Config) (err error)

New is a function to create a new mysql driver.

func (*Mysql) Select

func (m *Mysql) Select(ctx context.Context, payload specs.Payload) (err error)

Select TODO: add options for passing tx Select is a helper function to select data from database.

type Value

type Value driver.Value

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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