db

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

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

Go to latest
Published: Oct 28, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect

func Connect(dbType, name string, cfg Config) error

func ConnectMysql

func ConnectMysql(conn Config) (*sql.DB, error)

func Register

func Register(name string, cf ConnectFunc)

Types

type Config

type Config struct {
	Addr string

	User     string
	Password string

	Database string
}

type ConnectFunc

type ConnectFunc func(cfg Config) (Session, error)

type Field

type Field struct {
	Name      string
	Comment   string
	GoType    string
	IsPrimary bool
}

type Session

type Session interface {
	Desc(table string) (*Table, error)
	Check(sql string, params ...interface{}) error
	GetDB() *sql.DB
}

func Default

func Default() (Session, error)

func Get

func Get(name string) (Session, error)

type Table

type Table struct {
	Name    string
	Comment string
	Fields  []Field
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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