Documentation
¶
Index ¶
- Constants
- Variables
- func ClearValue(v interface{})
- type QData
- type QInterface
- type QResult
- type QStat
- func (stat *QStat) AppendBatchValue(val map[string]interface{}) *QStat
- func (stat *QStat) BatchInsert() *QResult
- func (stat *QStat) BatchUpdate() *QResult
- func (stat *QStat) ClearWhere() *QStat
- func (stat *QStat) Count() *QResult
- func (stat *QStat) CreateTable() *QResult
- func (stat *QStat) Delete() *QResult
- func (stat *QStat) Exec() *QResult
- func (stat *QStat) FreeLength(it bool) *QStat
- func (stat *QStat) GroupBy(keys string) *QStat
- func (stat *QStat) Having(having string) *QStat
- func (stat *QStat) IgnoreNullAt(i int) *QStat
- func (stat *QStat) IndexWith(i int) *QStat
- func (stat *QStat) Insert() *QResult
- func (stat *QStat) Join(joins ...string) *QStat
- func (stat *QStat) Limit(limit int) *QStat
- func (stat *QStat) Model(model interface{}) *QStat
- func (stat *QStat) Offset(offset int) *QStat
- func (stat *QStat) OrderBy(order string) *QStat
- func (stat *QStat) PrepareNext(it bool) *QStat
- func (stat *QStat) Query() *QResult
- func (stat *QStat) Scope(fn func(*QStat) *QStat) *QStat
- func (stat *QStat) Self(n int, param string) *QStat
- func (stat *QStat) Set(template string, vals ...interface{}) *QStat
- func (stat *QStat) SetBatchMode(val bool) *QStat
- func (stat *QStat) SetModel(model interface{}) *QStat
- func (stat *QStat) SetOnDuplicateKeyUpdateNCol(val bool, colDefine map[string]interface{}) *QStat
- func (stat *QStat) String() string
- func (stat *QStat) Table(table string) *QStat
- func (stat *QStat) TableOfFields(table string) *QStat
- func (stat *QStat) TableSchema(defs ...string) *QStat
- func (stat *QStat) Update() *QResult
- func (stat *QStat) Variable(key, value string) *QStat
- func (stat *QStat) Where(operator, template string, vals ...interface{}) *QStat
Constants ¶
const ConfigAsNullDateTimeFormat = "0001-01-01 00:00:00.000"
const ConfigMySQLDateTimeFormat = "2006-01-02 15:04:05.000"
Variables ¶
var ConfigParseDateTimeFormat = "2006-01-02 15:04:05.000"
Functions ¶
func ClearValue ¶
func ClearValue(v interface{})
Types ¶
type QData ¶
type QData struct {
// contains filtered or unexported fields
}
QData Database Connection
type QInterface ¶
type QInterface interface { Exec(query string, args ...interface{}) (sql.Result, error) Prepare(query string) (*sql.Stmt, error) Query(query string, args ...interface{}) (*sql.Rows, error) QueryRow(query string, args ...interface{}) *sql.Row Stats() sql.DBStats Begin() (*sql.Tx, error) SetMaxOpenConns(n int) SetMaxIdleConns(n int) SetConnMaxLifetime(d time.Duration) }
QInterface Interface
type QResult ¶
type QResult struct { AffectedRows int64 LastInsertId int64 ReturnedRows int64 Warning uint Error error }
QResult encapsulates the result of the SQL query
type QStat ¶
type QStat struct { Variables map[string]string Method qMethod Filters []qClause GroupS string HavingS string OrderS string RowLimit int BeginOffset int BatchMode bool // contains filtered or unexported fields }
QStat ... Support multiple value states
func (*QStat) AppendBatchValue ¶
AppendBatchValue append the maps-type value when batch mode enabled
func (*QStat) BatchInsert ¶
BatchInsert executes the multiply value insert `AffectedRows` returns the number of rows inserted `LastInsertId` returns the PK of first inserted row
func (*QStat) BatchUpdate ¶
BatchUpdate executes the CASE-WHEN-THEN update Fieldname case sensitive
func (*QStat) CreateTable ¶
CreateTable creates a table defined by qStruct each field must have `SCHEMA` tag
func (*QStat) FreeLength ¶
func (*QStat) IgnoreNullAt ¶ added in v0.0.2
IgnoreNullAt sets the i-th (start from 0)
func (*QStat) PrepareNext ¶
PrepareNext will prepare the next sql query
func (*QStat) SetBatchMode ¶
SetBatchMode is the Setter of the BatchMode
func (*QStat) SetOnDuplicateKeyUpdateNCol ¶
SetOnDuplicateKeyUpdateNCol is the Setter of the OnDuplicateKeyUpdate and DuplicateKeyUpdateCol colDefin := "<col>": "<col_define>" will be handled as RAW
func (*QStat) TableOfFields ¶
TableOfFields changes all the `Table` of EACH FIELD when its original `Table` is equal to $T0