Documentation
¶
Index ¶
- Constants
- Variables
- type Condition
- type Item
- type Items
- type Model
- type Query
- func (q *Query) And(qs ...string) string
- func (q *Query) AndEq(f string, v interface{}) string
- func (q *Query) AndGe(f string, v interface{}) string
- func (q *Query) AndGt(f string, v interface{}) string
- func (q *Query) AndIn(f string, v ...interface{}) string
- func (q *Query) AndLe(f string, v interface{}) string
- func (q *Query) AndLike(f string, v interface{}) string
- func (q *Query) AndLt(f string, v interface{}) string
- func (q *Query) AndNe(f string, v interface{}) string
- func (q *Query) DeleteFrom(tb string) *Query
- func (q *Query) Eq(f string, v interface{}) string
- func (q *Query) Exec(d ...map[string]interface{}) (Result, error)
- func (q *Query) Fields(f ...string) *Query
- func (q *Query) From(tb string) *Query
- func (q *Query) Ge(f string, v interface{}) string
- func (q *Query) GroupBy(f ...string) *Query
- func (q *Query) Gt(f string, v interface{}) string
- func (q *Query) Having(qs ...string) *Query
- func (q *Query) In(f string, v ...interface{}) string
- func (q *Query) InnerJoin(tb string) *Query
- func (q *Query) InsertInto(tb string) *Query
- func (q *Query) Join(tb string) *Query
- func (q *Query) Le(f string, v interface{}) string
- func (q *Query) LeftJoin(tb string) *Query
- func (q *Query) Like(f string, v interface{}) string
- func (q *Query) Limit(offset, rows int64) *Query
- func (q *Query) Lt(f string, v interface{}) string
- func (q *Query) Ne(f string, v interface{}) string
- func (q *Query) On(qs ...string) *Query
- func (q *Query) Or(qs ...string) string
- func (q *Query) OrEq(f string, v interface{}) string
- func (q *Query) OrGe(f string, v interface{}) string
- func (q *Query) OrGt(f string, v interface{}) string
- func (q *Query) OrIn(f string, v ...interface{}) string
- func (q *Query) OrLe(f string, v interface{}) string
- func (q *Query) OrLike(f string, v interface{}) string
- func (q *Query) OrLt(f string, v interface{}) string
- func (q *Query) OrNe(f string, v interface{}) string
- func (q *Query) OrderAsc(f ...string) *Query
- func (q *Query) OrderDesc(f ...string) *Query
- func (q *Query) OuterJoin(tb string) *Query
- func (q *Query) Parse(c Condition) *Query
- func (q *Query) RightJoin(tb string) *Query
- func (q *Query) Row(ptr interface{}, d ...Where) error
- func (q *Query) Rows(ptr interface{}, d ...Where) error
- func (q *Query) Select(f ...string) *Query
- func (q *Query) Set(f string, v interface{}) *Query
- func (q *Query) SetPrimary(p string)
- func (q *Query) ToString() string
- func (q *Query) Update(tb string) *Query
- func (q *Query) Values(vs ...interface{}) *Query
- func (q *Query) Where(qs ...string) *Query
- type Result
- type Server
- func (e *Server) Close()
- func (e *Server) DeleteFrom(tb string) *Query
- func (e *Server) Exec(sql string, args ...interface{}) (sql.Result, error)
- func (e *Server) InsertInto(tb string) *Query
- func (e *Server) NewQuery() *Query
- func (e *Server) Row(ptr interface{}, sql string, args ...interface{}) error
- func (e *Server) Rows(ptr interface{}, sql string, args ...interface{}) error
- func (e *Server) Select(f ...string) *Query
- func (e *Server) Update(tb string) *Query
- type Table
- type Where
Constants ¶
View Source
const ( QueryInsert = iota QueryUpdate QueryDelete QuerySelect )
Query type
Variables ¶
View Source
var Env int8 = 0
Enviroment: 0, 1, 2, 3
View Source
var Servers = make(map[string]*Server)
Server list
Functions ¶
This section is empty.
Types ¶
type Condition ¶
type Condition struct {
Eq map[string]string `json:"eq"`
Ge map[string]string `json:"ge"`
Gt map[string]string `json:"gt"`
Le map[string]string `json:"le"`
Lt map[string]string `json:"lt"`
Ne map[string]string `json:"ne"`
Like map[string]string `json:"like"`
In map[string][]string `json:"in"`
}
Condition struct
type Query ¶
type Query struct {
// Server
Server *Server
// Query type: Insert, Update, Delete, Select
Type uint
// Table primary field
Primary string
// Sql
Sql map[string]string
// Condition SQL
SqlCond []string
//args for Sql
Args []interface{}
//args index
ArgIndex int
// If the query object is created by Model, this is will be assigned. optional.
Table *Table
// contains filtered or unexported fields
}
Query struct
type Result ¶
type Result struct {
// LastInsertId returns the integer generated by the database
// in response to a command. Typically this will be from an
// "auto increment" column when inserting a new row. Not all
// databases support this feature, and the syntax of such
// statements varies.
LastInsertId 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
}
A Result summarizes an executed SQL command.
type Server ¶
type Server struct {
// Database type: mysql postgresql or sqlite3
Type string `json:"type"`
// Data Source Name
DSN string `json:"dsn"`
}
Server struct
type Table ¶
type Table struct {
// Table name
Name string
// Table primary
Primary string
// All fields, except primary
Fields []string
// Fields for select, include primary
SelectFields []string
// Fields for add
AddFields []string
// Fields for update
UpdateFields []string
// json and field property map
FiledsMap map[string]string
// Entity type
EntityType reflect.Type
}
Table struct
Click to show internal directories.
Click to hide internal directories.
