Documentation
¶
Index ¶
- Variables
- func Now(t, now time.Time, update bool) time.Time
- func NowP(t *time.Time, now time.Time, update bool) time.Time
- func Ternary(cond bool, exp1, exp2 interface{}) interface{}
- func WriteCols(w SQLWriter, prefix string, cols string)
- type Array
- type Bool
- type CommonQuery
- type DBInterface
- type Error
- type Float
- type Float32
- type Float64
- type IFind
- type IGet
- type IInsert
- type IJoin
- type IPreload
- type IScan
- type IScanRow
- type ISelect
- type ITableName
- type IUpdate
- type Int
- type Int16
- type Int32
- type Int64
- type Int8
- type Interface
- func (i Interface) Bool() *bool
- func (i Interface) Int() *int
- func (i Interface) Int32() *int32
- func (i Interface) Int64() *int64
- func (i Interface) JSON() json.RawMessage
- func (i Interface) Map() map[string]interface{}
- func (i Interface) String() *string
- func (i Interface) Time() time.Time
- func (i Interface) Unmarshal(v interface{}) error
- type InvalidArgumentError
- type JSON
- type JoinType
- type Map
- type Opts
- type PreloadDesc
- type Query
- type Row
- type SQLWriter
- type String
- type Time
- type Uint
- type Uint16
- type Uint32
- type Uint64
- type Uint8
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNoColumn = Error("sqlgen: no column to update") ErrNoRows = sql.ErrNoRows )
Errors
Functions ¶
Types ¶
type Array ¶
type Array struct {
V interface{}
Opts
}
Array ...
func ArrayScanner ¶
func ArrayScanner(v interface{}) Array
type Bool ¶
type Bool bool
Bool handles null as false
type CommonQuery ¶
type CommonQuery interface {
Get(obj IGet, preds ...interface{}) (bool, error)
Find(objs IFind, preds ...interface{}) error
Insert(objs ...IInsert) (int64, error)
Update(objs ...IUpdate) (int64, error)
UpdateMap(m map[string]interface{}) (int64, error)
Delete(obj ITableName) (int64, error)
Count(obj ITableName, preds ...interface{}) (uint64, error)
Table(name string) Query
Prefix(sql string, args ...interface{}) Query
Select(cols ...string) Query
From(table string) Query
SQL(preds ...interface{}) Query
Where(preds ...interface{}) Query
OrderBy(orderBys ...string) Query
GroupBy(groupBys ...string) Query
Limit(limit uint64) Query
Offset(offset uint64) Query
Suffix(sql string, args ...interface{}) Query
UpdateAll() Query
In(column string, args ...interface{}) Query
NotIn(column string, args ...interface{}) Query
Exists(column string, exists bool) Query
IsNull(column string, null bool) Query
Preload(table string, preds ...interface{}) Query
Apply(funcs ...func(CommonQuery)) Query
}
QueryInterface ...
type DBInterface ¶
type DBInterface interface {
Exec(query string, args ...interface{}) (sql.Result, error)
ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
Query(query string, args ...interface{}) (*sql.Rows, error)
QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
QueryRow(query string, args ...interface{}) Row
QueryRowContext(ctx context.Context, query string, args ...interface{}) Row
}
DBInterface ...
type Float32 ¶
type Float32 float32
Float32 handles null as 0
type Float64 ¶
type Float64 float64
Float64 handles null as 0
type IPreload ¶
type IPreload interface {
SQLPreload(name string) *PreloadDesc
SQLPopulate(items IFind) error
}
type IUpdate ¶
type IUpdate interface {
ITableName
SQLUpdate(SQLWriter) error
SQLUpdateAll(SQLWriter) error
}
IUpdate ...
type Int64 ¶
type Int64 int64
Int64 handles null as 0 but stores 0 as null. It's because int64 is usually used for identifier.
type Interface ¶
type Interface struct{ V interface{} }
func (Interface) JSON ¶
func (i Interface) JSON() json.RawMessage
type InvalidArgumentError ¶
type InvalidArgumentError string
InvalidArgumentError ...
func (InvalidArgumentError) Error ¶
func (e InvalidArgumentError) Error() string
type PreloadDesc ¶
type Query ¶
type Query interface {
CommonQuery
Build(preds ...interface{}) (string, []interface{}, error)
BuildGet(obj IGet, preds ...interface{}) (string, []interface{}, error)
BuildFind(objs IFind, preds ...interface{}) (string, []interface{}, error)
BuildInsert(obj IInsert) (string, []interface{}, error)
BuildUpdate(obj IUpdate) (string, []interface{}, error)
BuildDelete(obj ITableName) (string, []interface{}, error)
BuildCount(obj ITableName, preds ...interface{}) (string, []interface{}, error)
Clone() Query
Exec() (sql.Result, error)
Query() (*sql.Rows, error)
QueryRow() (Row, error)
Scan(dest ...interface{}) error
WithContext(context.Context) Query
}
Query ...
type SQLWriter ¶
type SQLWriter interface {
Len() int
Opts() Opts
TrimLast(n int)
WriteArg(arg interface{})
WriteArgs(args []interface{})
WriteByte(b byte)
WriteMarker()
WriteMarkers(n int)
WriteName(name string)
WritePrefixedName(schema string, name string)
WriteQuery(b []byte)
WriteQueryName(name string)
WriteQueryString(s string)
WriteQueryStringWithPrefix(prefix string, s string)
WriteRaw(b []byte)
WriteRawString(s string)
WriteScanArg(arg interface{})
WriteScanArgs(args []interface{})
}
type String ¶
type String string
String handles null as empty string
type Uint ¶
type Uint uint
Uint handles null as 0 and stores 0 as is.
Click to show internal directories.
Click to hide internal directories.