Documentation ¶
Index ¶
- type Connection
- func (c *Connection) Begin() (*Tx, error)
- func (c *Connection) Close() error
- func (c *Connection) Exec(query string, params ...interface{}) (*Result, error)
- func (c *Connection) Get(query string, params ...interface{}) (Resultset, error)
- func (c *Connection) GetEnumValues(field string) ([]string, error)
- func (c *Connection) GetStruct(dest interface{}, query string, params ...interface{}) error
- func (c *Connection) Insert(tableName string, dataMap map[string]interface{}) (*Result, error)
- func (c *Connection) MustBegin() *Tx
- func (c *Connection) MustExec(query string, params ...interface{}) *Result
- func (c *Connection) MustGet(query string, params ...interface{}) Resultset
- func (c *Connection) MustInsert(tableName string, dataMap map[string]interface{}) *Result
- func (c *Connection) MustSelect(query string, params ...interface{}) []Resultset
- func (c *Connection) Ping() error
- func (c *Connection) Select(query string, params ...interface{}) ([]Resultset, error)
- func (c *Connection) SelectStruct(dest interface{}, query string, params ...interface{}) error
- func (c *Connection) SetConnMaxLifetime(duration time.Duration)
- func (c *Connection) SetMaxIdleConns(max int)
- func (c *Connection) SetMaxOpenConns(max int)
- func (c *Connection) Tx(tx *Tx) *Tx
- type Model
- type QueryBuilder
- func (q *QueryBuilder) GetField(name string) string
- func (q *QueryBuilder) Limit(start int, length int)
- func (q *QueryBuilder) LimitLength() int
- func (q *QueryBuilder) LimitStart() int
- func (q *QueryBuilder) Order(field string, order string)
- func (q *QueryBuilder) ToConditionSQL() string
- func (q *QueryBuilder) ToFromSQL() string
- func (q *QueryBuilder) ToSQL() string
- func (q *QueryBuilder) Where(name string)
- func (q *QueryBuilder) WhereOp(name string, operator string)
- type Result
- type Resultset
- func (r Resultset) Bytes(name string) []byte
- func (r Resultset) Float(name string) float64
- func (r Resultset) FloatNil(name string) *float64
- func (r Resultset) FloatOr(name string, defValue float64) float64
- func (r Resultset) Int(name string) int
- func (r Resultset) IntNil(name string) *int
- func (r Resultset) IntOr(name string, defValue int) int
- func (r Resultset) Interface(name string) interface{}
- func (r Resultset) String(name string) string
- func (r Resultset) StringNil(name string) *string
- func (r Resultset) StringOr(name string, defValue string) string
- func (r Resultset) Time(name string) time.Time
- func (r Resultset) TimeNil(name string) *time.Time
- type Tx
- func (t *Tx) Commit() error
- func (t *Tx) Exec(query string, params ...interface{}) (*Result, error)
- func (t *Tx) Get(query string, params ...interface{}) (Resultset, error)
- func (t *Tx) GetStruct(dest interface{}, query string, params ...interface{}) error
- func (t *Tx) Insert(tableName string, dataMap map[string]interface{}) (*Result, error)
- func (t *Tx) MustExec(query string, params ...interface{}) *Result
- func (t *Tx) MustGet(query string, params ...interface{}) Resultset
- func (t *Tx) MustInsert(tableName string, dataMap map[string]interface{}) *Result
- func (t *Tx) MustRecover()
- func (t *Tx) MustSelect(query string, params ...interface{}) []Resultset
- func (t *Tx) Recover()
- func (t *Tx) Rollback() error
- func (t *Tx) Select(query string, params ...interface{}) ([]Resultset, error)
- func (t *Tx) SelectStruct(dest interface{}, query string, params ...interface{}) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connection ¶
type Connection struct { Hostname string Port int Username string Password string Name string // contains filtered or unexported fields }
Connection ...
func NewConnection ¶
func NewConnection(host string, port int, username, password, name string) (*Connection, error)
NewConnection ...
func (*Connection) Exec ¶
func (c *Connection) Exec(query string, params ...interface{}) (*Result, error)
Exec ...
func (*Connection) Get ¶
func (c *Connection) Get(query string, params ...interface{}) (Resultset, error)
Get ...
func (*Connection) GetEnumValues ¶
func (c *Connection) GetEnumValues(field string) ([]string, error)
GetEnumValues ...
func (*Connection) GetStruct ¶
func (c *Connection) GetStruct(dest interface{}, query string, params ...interface{}) error
GetStruct ...
func (*Connection) Insert ¶
func (c *Connection) Insert(tableName string, dataMap map[string]interface{}) (*Result, error)
Insert ...
func (*Connection) MustExec ¶
func (c *Connection) MustExec(query string, params ...interface{}) *Result
MustExec ...
func (*Connection) MustGet ¶
func (c *Connection) MustGet(query string, params ...interface{}) Resultset
MustGet ...
func (*Connection) MustInsert ¶
func (c *Connection) MustInsert(tableName string, dataMap map[string]interface{}) *Result
MustInsert ...
func (*Connection) MustSelect ¶
func (c *Connection) MustSelect(query string, params ...interface{}) []Resultset
MustSelect ...
func (*Connection) Select ¶
func (c *Connection) Select(query string, params ...interface{}) ([]Resultset, error)
Select ...
func (*Connection) SelectStruct ¶
func (c *Connection) SelectStruct(dest interface{}, query string, params ...interface{}) error
SelectStruct ...
func (*Connection) SetConnMaxLifetime ¶
func (c *Connection) SetConnMaxLifetime(duration time.Duration)
SetConnMaxLifetime ...
func (*Connection) SetMaxIdleConns ¶
func (c *Connection) SetMaxIdleConns(max int)
SetMaxIdleConns ...
func (*Connection) SetMaxOpenConns ¶
func (c *Connection) SetMaxOpenConns(max int)
SetMaxOpenConns ...
func (*Connection) Tx ¶
func (c *Connection) Tx(tx *Tx) *Tx
Tx create new Tx when parameter tx is nil and the new Tx will have autocommit enabled. If parameter tx is not null then return tx from parameter
type QueryBuilder ¶
type QueryBuilder struct {
// contains filtered or unexported fields
}
QueryBuilder ...
func (*QueryBuilder) ToConditionSQL ¶
func (q *QueryBuilder) ToConditionSQL() string
ToConditionSQL ...
func (*QueryBuilder) WhereOp ¶
func (q *QueryBuilder) WhereOp(name string, operator string)
WhereOp ...
type Resultset ¶
type Resultset map[string]interface{}
Resultset ...
type Tx ¶
type Tx struct {
// contains filtered or unexported fields
}
Tx ...
func (*Tx) MustInsert ¶
MustInsert ...
func (*Tx) MustSelect ¶
MustSelect ...
func (*Tx) SelectStruct ¶
SelectStruct ...
Click to show internal directories.
Click to hide internal directories.