simple

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2022 License: MIT Imports: 4 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterDriver

func RegisterDriver(driver string, newDriver func(string) (Driver, error))

func RegisterMysqlDriver added in v1.0.2

func RegisterMysqlDriver()

Types

type Driver

type Driver interface {
	DriverName() string
	Connection() error
	Ping() error
	Close()
	InsertFromSlice(tableName string, fields []string, unSavedRow []interface{}) (sql.Result, error)
	InsertFromMap(tableName string, unSavedRow map[string]interface{}) (sql.Result, error)
	BulkInsertFromSliceSlice(tableName string, fields []string, unSavedRow [][]interface{}) (sql.Result, error)
	BulkInsertFromSliceMap(tableName string, unSavedRows []map[string]interface{}) (sql.Result, error)
	UpdateFromMapById(tableName string, keyName string, unSavedRow map[string]interface{}) error
	BulkUpdateFromSliceMapById(tableName string, keyName string, unSavedRows []map[string]interface{}) error
	Exec(query string, args ...interface{}) (sql.Result, error)
	Truncate(tableName string) error
	Drop(tableName string) error
	Copy(sourceTableName string, targetTableName string) error
	GetTableColumns(tableName string) ([]string, error)
	QueryInterfaceRow(query string, args ...interface{}) (map[string]interface{}, error)
	QueryInterface(query string, args ...interface{}) ([]map[string]interface{}, error)
	QueryStringRow(query string, args ...interface{}) (map[string]string, error)
	QueryString(query string, args ...interface{}) ([]map[string]string, error)
	QueryFieldInterface(field string, query string, args ...interface{}) (interface{}, error)
	QueryFieldInterfaceSlice(field string, query string, args ...interface{}) ([]interface{}, error)
}

func NewDriver

func NewDriver(driver string, dsn string) (Driver, error)

func NewMysqlDriver added in v1.0.2

func NewMysqlDriver(dsn string) (Driver, error)

Jump to

Keyboard shortcuts

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