Documentation ¶
Overview ¶
nolint:lll
Index ¶
- Constants
- Variables
- func ConstructLimitOffsetSQLString(limit, offset int) string
- func ConstructOrderBySQLString(orders []*Order) string
- func ConstructWhereSQLString(wps []WherePart) (sql string, args []interface{})
- type Client
- type Execer
- type Filter
- type InFilter
- type JSONFilter
- type JSONFilterFunc
- type JSONObject
- type JSONPBObject
- type NullFilter
- type Option
- type Order
- type OrderDirection
- type QueryExecer
- type Queryer
- type Result
- type Row
- type Rows
- type SearchQuery
- type Transaction
- type WherePart
- func NewFilter(column, operator string, value interface{}) WherePart
- func NewInFilter(column string, values []interface{}) WherePart
- func NewJSONFilter(column string, f JSONFilterFunc, values []interface{}) WherePart
- func NewNullFilter(column string, isNull bool) WherePart
- func NewSearchQuery(columns []string, keyword string) WherePart
Constants ¶
View Source
const ( QueryNoLimit = 0 QueryNoOffset = 0 )
Variables ¶
Functions ¶
func ConstructWhereSQLString ¶
Types ¶
type Client ¶
type Client interface { QueryExecer Close() error BeginTx(ctx context.Context) (Transaction, error) RunInTransaction(ctx context.Context, tx Transaction, f func() error) error }
type JSONFilter ¶
type JSONFilter struct { Column string Func JSONFilterFunc Values []interface{} }
func (*JSONFilter) SQLString ¶
func (f *JSONFilter) SQLString() (sql string, args []interface{})
type JSONFilterFunc ¶
type JSONFilterFunc int
const ( JSONContainsNumber JSONFilterFunc JSONContainsString JSONLengthGreaterThan JSONLengthSmallerThan JSONContainsJSON )
type JSONObject ¶
type JSONObject struct {
Val interface{}
}
func (*JSONObject) Scan ¶
func (o *JSONObject) Scan(src interface{}) error
type JSONPBObject ¶
func (*JSONPBObject) Scan ¶
func (o *JSONPBObject) Scan(src interface{}) error
type NullFilter ¶
func (*NullFilter) SQLString ¶
func (f *NullFilter) SQLString() (sql string, args []interface{})
type Option ¶
type Option func(*options)
func WithConnMaxIdleTime ¶ added in v0.3.0
func WithConnMaxLifetime ¶
func WithLogger ¶
func WithMaxIdleConns ¶
func WithMaxOpenConns ¶
func WithMetrics ¶
func WithMetrics(r metrics.Registerer) Option
type Order ¶
type Order struct { Column string Direction OrderDirection }
func NewOrder ¶
func NewOrder(column string, direction OrderDirection) *Order
type OrderDirection ¶
type OrderDirection int
const ( // default asc OrderDirectionAsc OrderDirection = iota OrderDirectionDesc )
func (OrderDirection) String ¶
func (o OrderDirection) String() string
type QueryExecer ¶
type SearchQuery ¶
func (*SearchQuery) SQLString ¶
func (q *SearchQuery) SQLString() (sql string, args []interface{})
type Transaction ¶
type Transaction interface { QueryExecer Commit() error Rollback() error }
type WherePart ¶
type WherePart interface {
SQLString() (sql string, args []interface{})
}
func NewInFilter ¶
func NewJSONFilter ¶
func NewJSONFilter(column string, f JSONFilterFunc, values []interface{}) WherePart
func NewNullFilter ¶
func NewSearchQuery ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.