Documentation ¶
Index ¶
- Variables
- type Curd
- func (p *Curd) Close() (err error)
- func (p *Curd) Closed() bool
- func (p *Curd) Delete(query string, args ...interface{}) (ret sql.Result)
- func (p *Curd) Err() (err error)
- func (p *Curd) Exec(args ...interface{}) (ret sql.Result)
- func (p *Curd) Get(query string, args ...interface{}) (ret Rowser)
- func (p *Curd) Post(query string, args ...interface{}) (ret sql.Result)
- func (p *Curd) Prepare(query string) (err error)
- func (p *Curd) Put(query string, args ...interface{}) (ret sql.Result)
- type Curder
- type DB
- type DBer
- type Rows
- func (p *Rows) Close() (err error)
- func (p *Rows) Closed() bool
- func (p *Rows) Dst(dst interface{}) Rowser
- func (p *Rows) Err() (err error)
- func (p *Rows) Row(dest ...interface{}) (ret map[string]reflect.Value)
- func (p *Rows) Rowi(dest ...interface{}) (ret map[string]interface{})
- func (p *Rows) Scan(dest ...interface{}) error
- type Rowser
Constants ¶
This section is empty.
Variables ¶
View Source
var DebugBits = 0
调试位标志, 有高位到低位分别表示 有待确定,阻断执行相关数据,怀疑参数问题,重要步骤,一般信息
View Source
var EOF = errors.New("End of Rows")
Functions ¶
This section is empty.
Types ¶
type Curder ¶
type Curder interface { Err() error Close() error Closed() bool Get(query string, args ...interface{}) Rowser Post(query string, args ...interface{}) sql.Result Put(query string, args ...interface{}) sql.Result Delete(query string, args ...interface{}) sql.Result Prepare(query string) error Exec(args ...interface{}) sql.Result }
Curder 提供了一种简易方法操作数据库 Get 方法返回 Rowser,细节见 Rowser Post,Put,Delete都是单条 update 操作的情况,没有对重复SQL进行Prepare优化支持 如果要使用Prepare优化SQL请使用 Prepare,Exec
type Rows ¶
type Rows struct { //列名称 map, 其 int 值从 1 开始,对 Cols 增删或者改变其绝对值会造成不可预计的错误 //可以通过设置 Cols[key] 为负数(绝对值不能变), 来过滤 Get 返回的 map Cols map[string]int // contains filtered or unexported fields }
func (*Rows) Row ¶
如果只有一个参数并且是 *struct 类型,以 map[string]reflect.Value 形式返回一条记录 否则相当于调用 Rows.Scan 如果遇到错误, 返回 nil, 并自动关闭, 调用 Rows.Err() 查看错误 如果没有数据, 返回 nil, 并自动关闭, 调用 Rows.Err() 将返回 EOF
Click to show internal directories.
Click to hide internal directories.