Documentation
¶
Index ¶
- Constants
- func Alias(prepare string, alias ...string) string
- func FieldMerge(fields ...[]string) (result []string)
- func ForRowsNextScan(rows *sql.Rows, rowsScan func(rows *sql.Rows) (err error)) (err error)
- func PreparePostgresql(prepare string) string
- func RemoveDuplicate(dynamic ...interface{}) (result []interface{})
- func ScanSliceStruct(rows *sql.Rows, result interface{}, structTag string) (err error)
- func StructAssign(origin interface{}, latest interface{})
- func StructAttributeIndex(rt reflect.Type) map[string]int
- func StructModify(origin interface{}, latest interface{})
- func StructTagIndex(rt reflect.Type, tag string) map[string]int
- func SubQuery(prepare string) string
- type Delete
- type Filter
- type Insert
- func (s *Insert) Field(field ...string) *Insert
- func (s *Insert) ForMap(fieldValue map[string]interface{}) *Insert
- func (s *Insert) ForSlice(field []string, value []interface{}) *Insert
- func (s *Insert) Result() (string, []interface{})
- func (s *Insert) Table(table string) *Insert
- func (s *Insert) Tag(tag string) *Insert
- func (s *Insert) Value(value ...[]interface{}) *Insert
- func (s *Insert) ValuesFromQuery(prepare string, args ...interface{}) *Insert
- func (s *Insert) ValuesFromSelect(selector *Select) *Insert
- func (s *Insert) WithContext(ctx context.Context) *Insert
- type Join
- func (s *Join) Alias() string
- func (s *Join) As(as string) Joiner
- func (s *Join) Asa() Joiner
- func (s *Join) Asb() Joiner
- func (s *Join) Asc() Joiner
- func (s *Join) Asd() Joiner
- func (s *Join) Ase() Joiner
- func (s *Join) Asf() Joiner
- func (s *Join) Field(field string) string
- func (s *Join) Name() string
- func (s *Join) On(joinOn string, joinOnFilter ...Filter) Joiner
- func (s *Join) OnEqual(left string, right string, filter ...Filter) Joiner
- func (s *Join) Query(field ...string) Joiner
- func (s *Join) QueryFields() []string
- func (s *Join) Result() (prepare string, args []interface{})
- func (s *Join) Table() string
- type JoinType
- type Joiner
- type Logger
- type Order
- type Select
- func (s *Select) Alias(alias string) *Select
- func (s *Select) Asc(field ...string) *Select
- func (s *Select) Count() (result int64, err error)
- func (s *Select) Desc(field ...string) *Select
- func (s *Select) Field(field ...string) *Select
- func (s *Select) FromSelect(selector *Select, alias string) *Select
- func (s *Select) Get(forRowsNextScan func(rows *sql.Rows) (err error)) error
- func (s *Select) Group(group ...string) *Select
- func (s *Select) Having(having Filter) *Select
- func (s *Select) Join(join ...Joiner) *Select
- func (s *Select) Limit(limit int64) *Select
- func (s *Select) Master(master Joiner) *Select
- func (s *Select) Offset(offset int64) *Select
- func (s *Select) Order(order *Order) *Select
- func (s *Select) Result() (string, []interface{})
- func (s *Select) ResultForCount() (string, []interface{})
- func (s *Select) Scan(result interface{}) error
- func (s *Select) Table(table string, args ...interface{}) *Select
- func (s *Select) Tag(tag string) *Select
- func (s *Select) Union(c ...*Select) *Select
- func (s *Select) UnionAll(c ...*Select) *Select
- func (s *Select) Where(where Filter) *Select
- func (s *Select) WithContext(ctx context.Context) *Select
- type Table
- type TypeUnion
- type Update
- func (s *Update) Decr(field string, value interface{}) *Update
- func (s *Update) Expr(expr string, args ...interface{}) *Update
- func (s *Update) ForMap(fieldValue map[string]interface{}) *Update
- func (s *Update) ForSlice(field []string, value []interface{}) *Update
- func (s *Update) Force() *Update
- func (s *Update) Incr(field string, value interface{}) *Update
- func (s *Update) Result() (string, []interface{})
- func (s *Update) Set(field string, value interface{}) *Update
- func (s *Update) Table(table string) *Update
- func (s *Update) Tag(tag string) *Update
- func (s *Update) Where(where Filter) *Update
- func (s *Update) WithContext(ctx context.Context) *Update
- type Way
- func (s *Way) CallTakeWarn(milliseconds int64) *Way
- func (s *Way) DB() *sql.DB
- func (s *Way) Exec(prepare string, args ...interface{}) (int64, error)
- func (s *Way) ExecContext(ctx context.Context, prepare string, args ...interface{}) (rowsAffected int64, err error)
- func (s *Way) Logger(logger Logger) *Way
- func (s *Way) Prepare(fn func(prepare string) (result string)) *Way
- func (s *Way) Query(handlingRows func(rows *sql.Rows) (err error), prepare string, ...) error
- func (s *Way) QueryContext(ctx context.Context, handlingRows func(rows *sql.Rows) (err error), ...) (err error)
- func (s *Way) Scan(result interface{}, prepare string, args ...interface{}) error
- func (s *Way) ScanContext(ctx context.Context, result interface{}, prepare string, args ...interface{}) error
- func (s *Way) Scanner(fn func(rows *sql.Rows, result interface{}) error) *Way
- func (s *Way) Table(table string) *Table
- func (s *Way) Transaction(fn func(tx *Way) (err error)) error
- func (s *Way) TransactionContext(ctx context.Context, opts *sql.TxOptions, fn func(tx *Way) (err error)) (err error)
- func (s *Way) TxNil() bool
Constants ¶
View Source
const ( DefaultColumnName = "*" // default column name DefaultCountAliasName = "hey_rows_total" // default total rows alias name DefaultUnionResultTableAliasName = "hey_union_result_table_alias_name" // union query result table alias name )
View Source
const (
Placeholder = "?"
)
Variables ¶
This section is empty.
Functions ¶
func FieldMerge ¶
func ForRowsNextScan ¶
func PreparePostgresql ¶
func RemoveDuplicate ¶
func RemoveDuplicate(dynamic ...interface{}) (result []interface{})
RemoveDuplicate remove duplicate element
func ScanSliceStruct ¶
ScanSliceStruct scan queries result into slice *[]struct or *[]*struct
func StructAssign ¶
func StructAssign(origin interface{}, latest interface{})
StructAssign struct attribute assignment, both the origin and latest parameters must be struct pointers
func StructModify ¶
func StructModify(origin interface{}, latest interface{})
StructModify struct attribute is not nil assignment, both the origin and latest parameters must be struct pointers
Types ¶
type Filter ¶
type Filter interface {
And(prepare string, args ...interface{}) Filter
Or(prepare string, args ...interface{}) Filter
Filter(filters ...Filter) Filter
OrFilter(filters ...Filter) Filter
Group(group func(filter Filter) Filter) Filter
OrGroup(group func(filter Filter) Filter) Filter
Equal(column string, value interface{}) Filter
NotEqual(column string, value interface{}) Filter
MoreThan(column string, value interface{}) Filter
MoreThanEqual(column string, value interface{}) Filter
LessThan(column string, value interface{}) Filter
LessThanEqual(column string, value interface{}) Filter
In(column string, values ...interface{}) Filter
NotIn(column string, values ...interface{}) Filter
Between(column string, start interface{}, end interface{}) Filter
NotBetween(column string, start interface{}, end interface{}) Filter
Like(column string, value interface{}) Filter
NotLike(column string, value interface{}) Filter
IsNull(column string) Filter
IsNotNull(column string) Filter
OrEqual(column string, value interface{}) Filter
OrNotEqual(column string, value interface{}) Filter
OrMoreThan(column string, value interface{}) Filter
OrMoreThanEqual(column string, value interface{}) Filter
OrLessThan(column string, value interface{}) Filter
OrLessThanEqual(column string, value interface{}) Filter
OrIn(column string, values ...interface{}) Filter
OrNotIn(column string, values ...interface{}) Filter
OrBetween(column string, start interface{}, end interface{}) Filter
OrNotBetween(column string, start interface{}, end interface{}) Filter
OrLike(column string, value interface{}) Filter
OrNotLike(column string, value interface{}) Filter
OrIsNull(column string) Filter
OrIsNotNull(column string) Filter
Result() (prepare string, args []interface{})
}
type Insert ¶
type Insert struct {
// contains filtered or unexported fields
}
func (*Insert) ValuesFromQuery ¶
func (*Insert) ValuesFromSelect ¶
type Join ¶
type Join struct {
// contains filtered or unexported fields
}
func (*Join) QueryFields ¶
type Joiner ¶
type Joiner interface {
// As set current table name as alias-name
As(as string) Joiner
// Alias get current table name as alias-name
Alias() string
// Asa set current table name as <a>
Asa() Joiner
// Asb set current table name as <b>
Asb() Joiner
// Asc set current table name as <c>
Asc() Joiner
// Asd set current table name as <d>
Asd() Joiner
// Ase set current table name as <e>
Ase() Joiner
// Asf set current table name as <f>
Asf() Joiner
// Table get current table name
Table() string
// Name get the name used by the current table, aliases take precedence
Name() string
// Query set the connection query finally needs to query the field list of this table
Query(field ...string) Joiner
// QueryFields get the connection query finally needs to query the field list of this table
QueryFields() []string
// Field the table's field full name value
Field(field string) string
// On the criteria for joining the current table query
On(on string, filter ...Filter) Joiner
// OnEqual the criteria for joining the current table query, left = right
OnEqual(left string, right string, filter ...Filter) Joiner
// Result the current table joins the final sql script and parameters generated by the query
Result() (prepare string, args []interface{})
}
func MasterJoin ¶
type Select ¶
type Select struct {
// contains filtered or unexported fields
}
func (*Select) ResultForCount ¶
type Way ¶
type Way struct {
// contains filtered or unexported fields
}
func (*Way) CallTakeWarn ¶
func (*Way) ExecContext ¶
func (*Way) QueryContext ¶
func (*Way) ScanContext ¶
func (*Way) TransactionContext ¶
Click to show internal directories.
Click to hide internal directories.