sql

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close() error

func Exec

func Exec(query string, args ...interface{}) (data sql.Result, err error)

func ExecContext

func ExecContext(query string, args ...interface{}) (data sql.Result, err error)

func GetContext

func GetContext(dest interface{}, query string, args ...interface{}) error

func OnInit

func OnInit(config map[string]interface{}, option ...Option) (err error)

func Query

func Query(query string, args ...interface{}) (data *sql.Rows, err error)

func QueryContext

func QueryContext(query string, args ...interface{}) (data *sql.Rows, err error)

func QueryRowxContext

func QueryRowxContext(query string, args ...interface{}) (data *sqlx.Row)

func QueryxContext

func QueryxContext(query string, args ...interface{}) (data *sqlx.Rows, err error)

func SelectContext

func SelectContext(dest interface{}, query string, args ...interface{}) error

Types

type ISys

type ISys interface {
	Close() error
	Exec(query string, args ...interface{}) (data sql.Result, err error)
	Query(query string, args ...interface{}) (data *sql.Rows, err error)
	ExecContext(query string, args ...interface{}) (data sql.Result, err error)
	QueryContext(query string, args ...interface{}) (data *sql.Rows, err error)
	QueryxContext(query string, args ...interface{}) (data *sqlx.Rows, err error)
	QueryRowxContext(query string, args ...interface{}) (data *sqlx.Row)
	GetContext(dest interface{}, query string, args ...interface{}) error
	SelectContext(dest interface{}, query string, args ...interface{}) error
}

func NewSys

func NewSys(option ...Option) (sys ISys, err error)

type Option

type Option func(*Options)

func SetSqlType

func SetSqlType(v SqlType) Option

func SetSqlUrl

func SetSqlUrl(v string) Option

func SetTimeOut

func SetTimeOut(v time.Duration) Option

type Options

type Options struct {
	SqlType SqlType
	SqlUrl  string
	TimeOut time.Duration
}

type Sql

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

func (*Sql) Close

func (this *Sql) Close() error

func (*Sql) Exec

func (this *Sql) Exec(query string, args ...interface{}) (data sql.Result, err error)

func (*Sql) ExecContext

func (this *Sql) ExecContext(query string, args ...interface{}) (data sql.Result, err error)

func (*Sql) GetContext

func (this *Sql) GetContext(dest interface{}, query string, args ...interface{}) error

func (*Sql) Query

func (this *Sql) Query(query string, args ...interface{}) (data *sql.Rows, err error)

func (*Sql) QueryContext

func (this *Sql) QueryContext(query string, args ...interface{}) (data *sql.Rows, err error)

func (*Sql) QueryRowxContext

func (this *Sql) QueryRowxContext(query string, args ...interface{}) (data *sqlx.Row)

func (*Sql) QueryxContext

func (this *Sql) QueryxContext(query string, args ...interface{}) (data *sqlx.Rows, err error)

func (*Sql) SelectContext

func (this *Sql) SelectContext(dest interface{}, query string, args ...interface{}) error

type SqlType

type SqlType string
const (
	SqlServer SqlType = "sqlserver"
	MySql     SqlType = "mysql"
	Oracle    SqlType = "godror"
	DM        SqlType = "dm"
)

Jump to

Keyboard shortcuts

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