orm

package
v0.0.0-...-6dbf283 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2015 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(path string)

Types

type Configuration

type Configuration struct {
	Driver   string                 `toml:"driver"`
	Host     string                 `toml:"host"`
	Port     int                    `toml:"port"`
	User     string                 `toml:"user"`
	Password string                 `toml:"password"`
	Name     string                 `toml:"name"`
	MaxOpen  int                    `toml:"max_open"`
	MaxIdle  int                    `toml:"max_idle"`
	Extra    map[string]interface{} `toml:"extra"`
}

func (*Configuration) Backup

func (p *Configuration) Backup() (string, []string)

func (*Configuration) Connect

func (p *Configuration) Connect() (string, []string)

func (*Configuration) Create

func (p *Configuration) Create() (string, []string)

func (*Configuration) Drop

func (p *Configuration) Drop() (string, []string)

func (*Configuration) Load

func (p *Configuration) Load(env string) error

func (*Configuration) Source

func (p *Configuration) Source() string

type Db

type Db struct {
	Logger logging.Logger `inject:""`
	// contains filtered or unexported fields
}

func Open

func Open(env string) (*Db, error)

func (*Db) Commit

func (p *Db) Commit(fn func(_ *sql.Tx) error) (err error)

func (*Db) Exec

func (p *Db) Exec(query string, args ...interface{}) (sql.Result, error)

func (*Db) ExecT

func (p *Db) ExecT(tx *sql.Tx, query string, args ...interface{}) (sql.Result, error)

func (*Db) Get

func (p *Db) Get(query string, args ...interface{}) *sql.Row

func (*Db) GetT

func (p *Db) GetT(tx *sql.Tx, query string, args ...interface{}) *sql.Row

func (*Db) Migrate

func (p *Db) Migrate() error

func (*Db) Query

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

func (*Db) Rollback

func (p *Db) Rollback() error

func (*Db) Status

func (p *Db) Status(w io.Writer)

type Migration

type Migration struct {
	Id   string   `toml:"-"`
	Up   []string `toml:"up"`
	Down []string `toml:"down"`
}

Jump to

Keyboard shortcuts

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