Documentation ¶
Index ¶
- type Clause
- type Client
- func (c *Client) Close()
- func (c *Client) Delete(ctx context.Context, statement *Statement) (int64, error)
- func (c *Client) FindAll(ctx context.Context, statement *Statement, dest interface{}) (err error)
- func (c *Client) FindOne(ctx context.Context, statement *Statement, dest interface{}) (err error)
- func (c *Client) Insert(ctx context.Context, statement *Statement) (int64, error)
- func (c *Client) Transaction(f TxFunc) (result interface{}, err error)
- func (c *Client) Update(ctx context.Context, statement *Statement) (int64, error)
- type CommonDB
- type Field
- type Operation
- type Schema
- type Session
- func (s *Session) Begin() (err error)
- func (s *Session) Clear()
- func (s *Session) Commit() (err error)
- func (s *Session) DB() CommonDB
- func (s *Session) Exec() (result sql.Result, err error)
- func (s *Session) Query() (rows *sql.Rows, err error)
- func (s *Session) QueryRow() *sql.Row
- func (s *Session) Raw(sql string, values ...interface{}) *Session
- func (s *Session) Rollback() (err error)
- type Settings
- type Statement
- func (s *Statement) AndEqual(field string, value interface{}) *Statement
- func (s *Statement) AndGreaterThan(field string, value interface{}) *Statement
- func (s *Statement) AndLessThan(field string, value interface{}) *Statement
- func (s *Statement) AndLike(field string, value interface{}) *Statement
- func (s *Statement) InsertStruct(vars interface{}) *Statement
- func (s *Statement) OrEqual(field string, value interface{}) *Statement
- func (s *Statement) OrGreaterThan(field string, value interface{}) *Statement
- func (s *Statement) OrLessThan(field string, value interface{}) *Statement
- func (s *Statement) OrLike(field string, value interface{}) *Statement
- func (s *Statement) Select(field ...string) *Statement
- func (s *Statement) SetTableName(tableName string) *Statement
- func (s *Statement) UpdateStruct(vars interface{}) *Statement
- type TxFunc
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Clause ¶
type Clause struct {
// contains filtered or unexported fields
}
Clause 条款、子句
func (*Clause) SetCondition ¶
func (*Clause) SetTableName ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) Transaction ¶
事务支持
type CommonDB ¶
type CommonDB interface { Query(query string, args ...interface{}) (*sql.Rows, error) QueryRow(query string, args ...interface{}) *sql.Row Exec(query string, args ...interface{}) (sql.Result, error) }
CommonDB is a minimal function set of db
type Schema ¶
type Schema struct { Fields []*Field //字段属性组合 FieldNames []string //字段名称 FieldTags []string //tag名称 FieldMap map[string]*Field // key:value }
func StructForType ¶
func (*Schema) RecordValues ¶
func (this *Schema) RecordValues(dest interface{}) []interface{}
func (*Schema) UpdateParam ¶
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
func NewSession ¶
type Settings ¶
type Settings struct { DriverName string User string Password string Database string Host string Options map[string]string MaxOpenConns int MaxIdleConns int LoggingEnabled bool }
func (*Settings) DataSourceName ¶
type Statement ¶
type Statement struct {
// contains filtered or unexported fields
}
条件组装 用户API层
func NewStatement ¶
func NewStatement() *Statement
func (*Statement) AndGreaterThan ¶
func (*Statement) AndLessThan ¶
func (*Statement) InsertStruct ¶
新增数据API
func (*Statement) OrGreaterThan ¶
func (*Statement) OrLessThan ¶
func (*Statement) SetTableName ¶
SetTableName 设置表名
func (*Statement) UpdateStruct ¶
修改数据API
Source Files ¶
Click to show internal directories.
Click to hide internal directories.