Documentation ¶
Index ¶
- Variables
- func InToSql(cmd string, args ...interface{}) string
- func ToPGSql(cmd string, args ...interface{}) string
- func ToSql(cmd string, args ...interface{}) string
- type Actuator
- type Counter
- type Curder
- type Db
- func (d *Db) CreateDatabase(dbname string, overWrite bool) error
- func (d *Db) Delete(cmd string, args ...interface{}) Result
- func (d *Db) DeleteIn(cmd string, args ...interface{}) Result
- func (d *Db) Flush()
- func (d *Db) GetConnections() int
- func (d *Db) GetOne(cmd string, args ...interface{}) *sql.Row
- func (d *Db) GetOneIn(cmd string, args ...interface{}) *sql.Row
- func (d *Db) GetRows(cmd string, args ...interface{}) (*sql.Rows, error)
- func (d *Db) GetRowsIn(cmd string, args ...interface{}) (*sql.Rows, error)
- func (d *Db) Insert(cmd string, args ...interface{}) Result
- func (d *Db) InsertIn(cmd string, args ...interface{}) Result
- func (d *Db) InsertInterfaceWithID(dest interface{}, cmd string, args ...interface{}) Result
- func (d *Db) InsertInterfaceWithIDIn(dest interface{}, cmd string, args ...interface{}) Result
- func (d *Db) InsertInterfaceWithoutID(dest interface{}, cmd string, args ...interface{}) Result
- func (d *Db) InsertInterfaceWithoutIDIn(dest interface{}, cmd string, args ...interface{}) Result
- func (d *Db) InsertMany(cmd string, args ...interface{}) Result
- func (db *Db) NewCurder(table string) Curder
- func (d *Db) NewTx() (*Tx, error)
- func (d *Db) Select(dest interface{}, cmd string, args ...interface{}) Result
- func (d *Db) SelectIn(dest interface{}, cmd string, args ...interface{}) Result
- func (d *Db) Update(cmd string, args ...interface{}) Result
- func (d *Db) UpdateIn(cmd string, args ...interface{}) Result
- func (d *Db) UpdateInterface(dest interface{}, cmd string, args ...interface{}) Result
- func (d *Db) UpdateInterfaceIn(dest interface{}, cmd string, args ...interface{}) Result
- func (d *Db) Use(dbname string, overWrite ...bool) (*Db, error)
- type PGConn
- func (d *PGConn) Delete(cmd string, args ...interface{}) Result
- func (d *PGConn) Insert(cmd string, args ...interface{}) Result
- func (d *PGConn) InsertInterfaceWithID(dest interface{}, cmd string, args ...interface{}) Result
- func (d *PGConn) InsertInterfaceWithoutID(dest interface{}, cmd string, args ...interface{}) Result
- func (d *PGConn) InsertMany(cmd string, args ...interface{}) Result
- func (d *PGConn) InsertWithoutId(cmd string, args ...interface{}) Result
- func (d *PGConn) Select(dest interface{}, cmd string, args ...interface{}) Result
- func (d *PGConn) Update(cmd string, args ...interface{}) Result
- func (d *PGConn) UpdateInterface(dest interface{}, cmd string, args ...interface{}) Result
- type Result
- type Sqlconfig
- type Tx
- func (t *Tx) Close() error
- func (t *Tx) Commit() error
- func (t *Tx) Delete(cmd string, args ...interface{}) Result
- func (t *Tx) DeleteIn(cmd string, args ...interface{}) Result
- func (t *Tx) GetOne(cmd string, args ...interface{}) *sql.Row
- func (t *Tx) GetOneIn(cmd string, args ...interface{}) *sql.Row
- func (t *Tx) GetRows(cmd string, args ...interface{}) (*sql.Rows, error)
- func (t *Tx) GetRowsIn(cmd string, args ...interface{}) (*sql.Rows, error)
- func (t *Tx) Insert(cmd string, args ...interface{}) Result
- func (t *Tx) InsertIn(cmd string, args ...interface{}) Result
- func (t *Tx) InsertInterfaceWithID(dest interface{}, cmd string, args ...interface{}) Result
- func (t *Tx) InsertInterfaceWithIDIn(dest interface{}, cmd string, args ...interface{}) Result
- func (t *Tx) InsertInterfaceWithoutID(dest interface{}, cmd string, args ...interface{}) Result
- func (t *Tx) InsertInterfaceWithoutIDIn(dest interface{}, cmd string, args ...interface{}) Result
- func (t *Tx) InsertMany(cmd string, args ...interface{}) Result
- func (t *Tx) Rollback() error
- func (t *Tx) Select(dest interface{}, cmd string, args ...interface{}) Result
- func (t *Tx) SelectIn(dest interface{}, cmd string, args ...interface{}) Result
- func (t *Tx) Update(cmd string, args ...interface{}) Result
- func (t *Tx) UpdateIn(cmd string, args ...interface{}) Result
- func (t *Tx) UpdateInterface(dest interface{}, cmd string, args ...interface{}) Result
- func (t *Tx) UpdateInterfaceIn(dest interface{}, cmd string, args ...interface{}) Result
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotSupport = errors.New("dest type not support")
View Source
var ErrRangeOut = errors.New("索引值超出范围")
RangeOutErr 错误信息
View Source
var IgnoreCondition = []string{"where", "on"}
如果后面有or 或者 and,只用删除or 或者and 那么删除前面的where, on 关键字
View Source
var IgnoreWords = []string{"or", "and"}
IgnoreWords 如果删除in的字段, 前面如果出现下面的关键字, 也删除
Functions ¶
Types ¶
type Db ¶
func (*Db) GetConnections ¶
func (*Db) InsertInterfaceWithID ¶
func (*Db) InsertInterfaceWithIDIn ¶
func (*Db) InsertInterfaceWithoutID ¶
插入字段的占位符 $key, $value
func (*Db) InsertInterfaceWithoutIDIn ¶
func (*Db) InsertMany ¶
func (*Db) UpdateInterface ¶
func (*Db) UpdateInterfaceIn ¶
type PGConn ¶
func (*PGConn) InsertInterfaceWithID ¶
func (*PGConn) InsertInterfaceWithoutID ¶
func (*PGConn) InsertMany ¶
func (*PGConn) InsertWithoutId ¶
func (*PGConn) UpdateInterface ¶
type Result ¶
type Result struct { Err error Sql string // sql并不是真实的执行的sql, 仅供参考 LastInsertId int64 LastInsertIds []int64 // RowsAffected returns the number of rows affected by an // update, insert, or delete. Not every database or database // driver may support this. RowsAffected int64 }
返回的结果
type Sqlconfig ¶
type Sqlconfig struct { UserName string Password string Host string Port int DbName string ClientFoundRows bool AllowCleartextPasswords bool InterpolateParams bool ColumnsWithAlias bool MultiStatements bool ParseTime bool TLS bool ReadTimeout time.Duration Timeout time.Duration WriteTimeout time.Duration AllowOldPasswords bool Charset string Loc string MaxAllowedPacket uint64 // insert 插入大量数据的时候会用到 或者用insertmany Collation string MaxOpenConns int // 请设置小于等于mysql 的max_connections值, 建议等于max_connections MaxIdleConns int // 如果设置了 MaxOpenConns, 那么此直将等于 MaxOpenConns ConnMaxLifetime time.Duration // 连接池设置 WriteLogWhenFailed bool LogFile string Debug bool // 打印sql }
func (*Sqlconfig) GetMysqlDataSource ¶
func (*Sqlconfig) GetPostgreDNS ¶
func (*Sqlconfig) GetPostgreDataSource ¶
type Tx ¶
func (*Tx) InsertInterfaceWithID ¶
func (*Tx) InsertInterfaceWithIDIn ¶
func (*Tx) InsertInterfaceWithoutID ¶
插入字段的占位符 $key, $value
func (*Tx) InsertInterfaceWithoutIDIn ¶
func (*Tx) InsertMany ¶
func (*Tx) UpdateInterface ¶
func (*Tx) UpdateInterfaceIn ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.