mysql

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package mysql wraps mysql driver as an adapter for REL.

Deprecated: Please use github.com/go-rel/mysql instead.

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)

Index

Constants

This section is empty.

Variables

View Source
var (

	// Config for mysql adapter.
	Config = sql.Config{
		DropIndexOnTable: true,
		Placeholder:      "?",
		EscapeChar:       "`",
		IncrementFunc:    incrementFunc,
		ErrorFunc:        errorFunc,
		MapColumnFunc:    sql.MapColumn,
	}
)

Functions

This section is empty.

Types

type Adapter

type Adapter struct {
	*sql.Adapter
}

Adapter definition for mysql database.

func New deprecated

func New(database *db.DB) *Adapter

New mysql adapter using existing connection. Existing connection nneds to be created with `clientFoundRows=true` options for update and delete to works correctly.

Deprecated: Please use github.com/go-rel/mysql instead.

func Open

func Open(dsn string) (*Adapter, error)

Open mysql connection using dsn.

Jump to

Keyboard shortcuts

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