Documentation ¶
Index ¶
- Constants
- func Contains(a []string, x string) bool
- func FieldAlias(val string, a string) string
- func GetPagination(p *Pagination) (string, error)
- func GetParam(params url.Values, key string, defaultVal string) []string
- func TagsToField(tag string, value interface{}) (result map[string][]interface{}, err error)
- type DB
- func (r *DB) BeginCtx() (context.Context, context.CancelFunc)
- func (r *DB) BeginTx(ctx context.Context) (*sql.Tx, context.CancelFunc)
- func (r *DB) Close() error
- func (r *DB) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
- func (r *DB) PrepareContext(ctx context.Context, query string) (stmt *sql.Stmt, err error)
- func (r *DB) QueryCtx(ctx context.Context, fn func(rs *sql.Rows) error, query string, ...) error
- func (r *DB) QueryRowCtx(ctx context.Context, fn func(rs *sql.Row) error, query string, ...) error
- func (r *DB) TxCommit(ctx context.Context, tx *sql.Tx) error
- func (r *DB) TxExecContext(ctx context.Context, tx *sql.Tx, query string, args ...interface{}) (affected int64, err error)
- func (r *DB) TxExecContextWithID(ctx context.Context, tx *sql.Tx, query string, args ...interface{}) (ids interface{}, err error)
- func (r *DB) WithTransaction(ctx context.Context, fn func(tx *sql.Tx) error) error
- type Factory
- type Model
- type NullBool
- type NullFloat64
- type NullInt64
- type NullString
- type NullTime
- type Op
- type Pagination
- type Query
- func (s *Query) Insert(model interface{}) *Query
- func (s *Query) Inserts(model interface{}) *Query
- func (s *Query) Join(model interface{}, fields ...string) *Query
- func (s *Query) NewScope(model interface{}) *SQL
- func (s *Query) Select(model interface{}) *Query
- func (s *Query) SetTag(tag string) *Query
- func (s *Query) ToSQL() (string, []interface{})
- func (s *Query) Updates(model interface{}) *Query
- func (s *Query) Where(query interface{}, args ...interface{}) *Query
- type QueryFilter
- type SQL
- type TxArgs
Constants ¶
View Source
const ( EQ = Op("eq") // = NEQ = Op("neq") // <> LT = Op("lt") // < GT = Op("gt") // > LTE = Op("lte") // <= GTE = Op("gte") // >= LIKE = Op("like") // LIKE "PATTERN" OR = Op("or") // disjunction AND = Op("and") // conjunction )
Operators that support by rql.
View Source
const POSTGRES string = "postgres"
Variables ¶
This section is empty.
Functions ¶
func FieldAlias ¶
func GetPagination ¶
func GetPagination(p *Pagination) (string, error)
func TagsToField ¶
Types ¶
type DB ¶
func (*DB) ExecContext ¶
func (*DB) PrepareContext ¶
func (*DB) QueryRowCtx ¶
func (*DB) TxExecContext ¶
func (*DB) TxExecContextWithID ¶
type Factory ¶
type Factory interface { Close() error BeginCtx() (context.Context, context.CancelFunc) BeginTx(ctx context.Context) (*sql.Tx, context.CancelFunc) QueryCtx(ctx context.Context, fn func(rs *sql.Rows) error, query string, args ...interface{}) error QueryRowCtx(ctx context.Context, fn func(rs *sql.Row) error, query string, args ...interface{}) error ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error) TxExecContextWithID(ctx context.Context, tx *sql.Tx, query string, args ...interface{}) (ids interface{}, err error) TxExecContext(ctx context.Context, tx *sql.Tx, query string, args ...interface{}) (affected int64, err error) TxCommit(ctx context.Context, tx *sql.Tx) error WithTransaction(ctx context.Context, fn func(tx *sql.Tx) error) error PrepareContext(ctx context.Context, query string) (stmt *sql.Stmt, err error) }
type NullBool ¶
NullBool is an alias for sql.NullBool data type
func (NullBool) MarshalJSON ¶
MarshalJSON for NullBool
type NullFloat64 ¶
type NullFloat64 struct {
sql.NullFloat64
}
NullFloat64 is an alias for sql.NullFloat64 data type
func Float64 ¶
func Float64(value float64) NullFloat64
func (NullFloat64) MarshalJSON ¶
func (nf NullFloat64) MarshalJSON() ([]byte, error)
MarshalJSON for NullFloat64
type NullInt64 ¶
NullInt64 is an alias for sql.NullInt64 data type
func (NullInt64) MarshalJSON ¶
MarshalJSON for NullInt64
type NullString ¶
type NullString struct {
sql.NullString
}
NullString is an alias for sql.NullString data type
func String ¶
func String(value string) NullString
func (NullString) MarshalJSON ¶
func (ns NullString) MarshalJSON() ([]byte, error)
MarshalJSON for NullString
type NullTime ¶
func (NullTime) MarshalJSON ¶
MarshalJSON for NullTime
type Pagination ¶
type Query ¶
type Query struct { Query string Args []interface{} // contains filtered or unexported fields }
type QueryFilter ¶
type QueryFilter struct { *bytes.Buffer Model interface{} TagName string FieldSep string Args []interface{} Filter interface{} `json:"filter"` Log func(string, ...interface{}) }
func NewQueryFilter ¶
func NewQueryFilter(model interface{}) (*QueryFilter, error)
NewParser creates a new Parser. it fails if the configuration is invalid.
func (*QueryFilter) QueryStringParser ¶
func (p *QueryFilter) QueryStringParser(params url.Values, alias string, allowFields []string) (*QueryFilter, error)
Click to show internal directories.
Click to hide internal directories.