mysql¶
import "github.com/go-rel/mysql"
Overview¶
Package mysql wraps mysql driver as an adapter for REL.
Usage:
// open mysql connection.
// note: `clientFoundRows=true` is required for update and delete to works correctly.
adapter, err := mysql.Open("root@(127.0.0.1:3306)/rel_test?clientFoundRows=true&charset=utf8&parseTime=True&loc=Local")
if err != nil {
panic(err)
}
defer adapter.Close()
// initialize REL's repo.
repo := rel.New(adapter)
Constants¶
const Name string = "mysql"
func MustOpen¶
func MustOpen(dsn string) rel.Adapter
func New¶
func New(database *db.DB) rel.Adapter
clientFoundRows=true
options for update and delete to works correctly. func Open¶
func Open(dsn string) (rel.Adapter, error)
type MySQL¶
type MySQL struct {
sql.SQL
}
func (MySQL) Name¶
func (MySQL) Name() string
type Quote¶
type Quote struct{}
func (Quote) ID¶
func (q Quote) ID(name string) string
func (Quote) Value¶
func (q Quote) Value(v interface{}) string
type ValueConvert¶
type ValueConvert struct{}
func (ValueConvert) ConvertValue¶
func (c ValueConvert) ConvertValue(v interface{}) (driver.Value, error)
Last update: 2024-12-19