connections

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2018 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SqlPool = sync.Pool{
	New: func() interface{} {
		return &Sql{
			fields:    make([]string, 0),
			table:     "",
			args:      make([]interface{}, 0),
			wheres:    make([]Where, 0),
			leftjoins: make([]Join, 0),
			updateRaw: make([]RawUpdate, 0),
			whereRaw:  "",
		}
	},
}

Functions

func RecycleSql

func RecycleSql(sql *Sql)

Types

type Connection

type Connection interface {
	Query(query string, args ...interface{}) ([]map[string]interface{}, *sql.Rows)
	Exec(query string, args ...interface{}) sql.Result
	InitDB(cfg map[string]config.Database)
}

func GetConnection

func GetConnection() Connection

func GetConnectionByDriver

func GetConnectionByDriver(driver string) Connection

type H

type H map[string]interface{}

type Join

type Join struct {
	// contains filtered or unexported fields
}

type RawUpdate

type RawUpdate struct {
	// contains filtered or unexported fields
}

type Sql

type Sql struct {
	// contains filtered or unexported fields
}

func Table

func Table(table string) *Sql

func (*Sql) All

func (sql *Sql) All() ([]map[string]interface{}, error)

func (*Sql) Count

func (sql *Sql) Count() (int64, error)

func (*Sql) Exec

func (sql *Sql) Exec() (int64, error)

func (*Sql) Find

func (sql *Sql) Find(arg interface{}) (map[string]interface{}, error)

func (*Sql) First

func (sql *Sql) First() (map[string]interface{}, error)

func (*Sql) Insert

func (sql *Sql) Insert(values H) (int64, error)

func (*Sql) LeftJoin

func (sql *Sql) LeftJoin(table string, fieldA string, operation string, fieldB string) *Sql

func (*Sql) OrderBy

func (sql *Sql) OrderBy(filed string, order string) *Sql

func (*Sql) Select

func (sql *Sql) Select(fields ...string) *Sql

func (*Sql) Skip

func (sql *Sql) Skip(offset int) *Sql

func (*Sql) Take

func (sql *Sql) Take(take int) *Sql

func (*Sql) Update

func (sql *Sql) Update(values H) (int64, error)

func (*Sql) UpdateRaw

func (sql *Sql) UpdateRaw(raw string, args ...interface{}) *Sql

func (*Sql) Where

func (sql *Sql) Where(field string, operation string, arg interface{}) *Sql

func (*Sql) WhereIn

func (sql *Sql) WhereIn(field string, arg []interface{}) *Sql

func (*Sql) WhereNotIn

func (sql *Sql) WhereNotIn(field string, arg []interface{}) *Sql

func (*Sql) WhereRaw

func (sql *Sql) WhereRaw(raw string) *Sql

type Where

type Where struct {
	// contains filtered or unexported fields
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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