Documentation ¶
Index ¶
- Variables
- func Begin() (*sql.Tx, error)
- func Commit(tx *sql.Tx) error
- func Connect(connStr string) error
- func Delete(TableName string, Cond map[string]string) (sql.Result, error)
- func DeleteTx(TableName string, Cond map[string]string, m Model) (sql.Result, error)
- func GetLastInsertID(result sql.Result) (int64, error)
- func GetRowsAffected(result sql.Result) (int64, error)
- func Insert(TableName string, InsertArr map[string]string) (sql.Result, error)
- func InsertBatch(TableName string, InsertArr []map[string]string) (sql.Result, error)
- func InsertBatchTx(TableName string, InsertArr []map[string]string, m Model) (sql.Result, error)
- func InsertTx(TableName string, InsertArr map[string]string, m Model) (sql.Result, error)
- func Replace(TableName string, InsertArr map[string]string) (sql.Result, error)
- func ReplaceBatch(TableName string, InsertArr []map[string]string) (sql.Result, error)
- func ReplaceBatchTx(TableName string, InsertArr []map[string]string, m Model) (sql.Result, error)
- func ReplaceTx(TableName string, InsertArr map[string]string, m Model) (sql.Result, error)
- func Rollback(tx *sql.Tx) error
- func Select(TableName string, Cond map[string]string) ([]map[string]string, error)
- func SelectOne(TableName string, Cond map[string]string) (map[string]string, error)
- func SelectOneTx(TableName string, Cond map[string]string, m Model) (map[string]string, error)
- func SelectTx(TableName string, Cond map[string]string, m Model) ([]map[string]string, error)
- func Update(TableName string, UpdateArr map[string]string, Cond map[string]string) (sql.Result, error)
- func UpdateTx(TableName string, UpdateArr map[string]string, Cond map[string]string, m Model) (sql.Result, error)
- type Model
- func (m *Model) Clean()
- func (m *Model) Debug(sql string)
- func (m *Model) Exec(sqlStr string) (sql.Result, error)
- func (m *Model) ExecDelete() (sql.Result, error)
- func (m *Model) ExecInsert() (sql.Result, error)
- func (m *Model) ExecInsertBatch() (sql.Result, error)
- func (m *Model) ExecReplace() (sql.Result, error)
- func (m *Model) ExecReplaceBatch() (sql.Result, error)
- func (m *Model) ExecSelect() ([]map[string]string, error)
- func (m *Model) ExecSelectIndex() (map[string]map[string]string, error)
- func (m *Model) ExecSelectOne() (map[string]string, error)
- func (m *Model) ExecUpdate() (sql.Result, error)
- func (m *Model) Query(sqlStr string) ([]map[string]string, error)
- func (m *Model) SetDebug(Debug int) *Model
- func (m *Model) SetField(Field string) *Model
- func (m *Model) SetGroupBy(GroupBy string) *Model
- func (m *Model) SetIndex(Index string) *Model
- func (m *Model) SetInsert(InsertMap map[string]string) *Model
- func (m *Model) SetInsertArr(InsertMapArr []map[string]string) *Model
- func (m *Model) SetLimit(Limit interface{}) *Model
- func (m *Model) SetSort(Sort string) *Model
- func (m *Model) SetTable(Str string) *Model
- func (m *Model) SetUpdate(UpdateMap map[string]string) *Model
- func (m *Model) SetWhere(Cond interface{}) *Model
Constants ¶
This section is empty.
Variables ¶
View Source
var ( OpenLog int = 0 MaxOpenConns int = 600 MaxIdleConns int = 600 ConnMaxLifetime time.Duration = time.Minute * 3 )
OpenLog 是否记录日志
View Source
var Db *sql.DB
Db 指针
Functions ¶
func GetLastInsertID ¶
GetLastInsertID 获取最后插入的ID
func GetRowsAffected ¶
GetRowsAffected 获取受影响行数
func InsertBatch ¶
InsertBatch 批量插入
func InsertBatchTx ¶
InsertBatchTx 批量插入
func ReplaceBatch ¶
Replace 批量替换
func ReplaceBatchTx ¶
Replace 批量替换
func SelectOneTx ¶
SelectOneTx 查询一条
Types ¶
type Model ¶
type Model struct { Cond interface{} Insert map[string]string InsertArr []map[string]string Update map[string]string Field string Table string Index string Limit interface{} Sort string GroupBy string IsDeug int Tx *sql.Tx Scan []interface{} }
Model 结构
func (*Model) ExecInsertBatch ¶
ExecInsertBatch 批量添加 (预计要删除)
func (*Model) ExecReplaceBatch ¶
ExecReplace 替换
func (*Model) ExecSelect ¶
ExecSelect 执行查询 返回一个 切片MAP
func (*Model) ExecSelectIndex ¶
ExecSelectIndex 返回一个MAP
func (*Model) ExecSelectOne ¶
ExecSelectOne 只查询一条
func (*Model) SetInsertArr ¶
SetInsertArr 设置批量插入字段
Click to show internal directories.
Click to hide internal directories.