Documentation ¶
Overview ¶
Package pql helps build PostgreSQL queries.
Index ¶
- func Init(p *pgxpool.Pool)
- type Builder
- type DeleteStmt
- func (ds *DeleteStmt) Apply(w *WhereCls) *DeleteStmt
- func (ds *DeleteStmt) Build() (string, []interface{})
- func (ds *DeleteStmt) Exec(ctx context.Context) error
- func (ds *DeleteStmt) ExecRet(ctx context.Context) pgx.Row
- func (ds *DeleteStmt) Returning(cols ...string) *DeleteStmt
- func (ds *DeleteStmt) Where(col string, args ...interface{}) *WhereCls
- func (ds *DeleteStmt) WhereNot(col string, args ...interface{}) *WhereCls
- type InsertStmt
- func (is *InsertStmt) Build() (string, []interface{})
- func (is *InsertStmt) Exec(ctx context.Context) error
- func (is *InsertStmt) ExecRet(ctx context.Context) pgx.Row
- func (is *InsertStmt) Returning(cols ...string) *InsertStmt
- func (is *InsertStmt) Set(col string, val interface{}) *InsertStmt
- func (is *InsertStmt) Values(m Map) *InsertStmt
- type Map
- type SelectStmt
- func (ss *SelectStmt) Apply(w *WhereCls) *SelectStmt
- func (ss *SelectStmt) Asc(col string) *SelectStmt
- func (ss *SelectStmt) Build() (string, []interface{})
- func (ss *SelectStmt) Desc(col string) *SelectStmt
- func (ss *SelectStmt) From(table string) *SelectStmt
- func (ss *SelectStmt) GetOffset() int
- func (ss *SelectStmt) Limit(n int) *SelectStmt
- func (ss *SelectStmt) Offset(n int) *SelectStmt
- func (ss *SelectStmt) Order(col string, desc bool) *SelectStmt
- func (ss *SelectStmt) Query(ctx context.Context) (pgx.Rows, error)
- func (ss *SelectStmt) QueryFunc(ctx context.Context, scans []interface{}, f func(pgx.QueryFuncRow) error) error
- func (ss *SelectStmt) QueryRow(ctx context.Context) pgx.Row
- func (ss *SelectStmt) Select(cols ...string) *SelectStmt
- func (ss *SelectStmt) Where(col string, args ...interface{}) *WhereCls
- func (ss *SelectStmt) WhereCond(cond bool, col string, args ...interface{}) *WhereCls
- func (ss *SelectStmt) WhereNot(col string, args ...interface{}) *WhereCls
- type UpdateStmt
- func (us *UpdateStmt) Apply(w *WhereCls) *UpdateStmt
- func (us *UpdateStmt) Build() (string, []interface{})
- func (us *UpdateStmt) Exec(ctx context.Context) error
- func (us *UpdateStmt) ExecRet(ctx context.Context) pgx.Row
- func (us *UpdateStmt) Returning(cols ...string) *UpdateStmt
- func (us *UpdateStmt) Set(col string, val interface{}) *UpdateStmt
- func (us *UpdateStmt) Values(m Map) *UpdateStmt
- func (us *UpdateStmt) Where(col string, args ...interface{}) *WhereCls
- func (us *UpdateStmt) WhereNot(col string, args ...interface{}) *WhereCls
- type WhereCls
- func (wc *WhereCls) And(col string, args ...interface{}) *WhereCls
- func (wc *WhereCls) Build() (string, []interface{})
- func (wc *WhereCls) ContainedBy(v interface{}) *WhereCls
- func (wc *WhereCls) Contains(v interface{}) *WhereCls
- func (wc *WhereCls) DS() *DeleteStmt
- func (wc *WhereCls) Eq(v interface{}) *WhereCls
- func (wc *WhereCls) Ge(v interface{}) *WhereCls
- func (wc *WhereCls) Gt(v interface{}) *WhereCls
- func (wc *WhereCls) Ilike(v interface{}) *WhereCls
- func (wc *WhereCls) IsNotNull() *WhereCls
- func (wc *WhereCls) IsNull() *WhereCls
- func (wc *WhereCls) Le(v interface{}) *WhereCls
- func (wc *WhereCls) Like(v interface{}) *WhereCls
- func (wc *WhereCls) Lt(v interface{}) *WhereCls
- func (wc *WhereCls) Neq(v interface{}) *WhereCls
- func (wc *WhereCls) Or(col string, args ...interface{}) *WhereCls
- func (wc *WhereCls) SS() *SelectStmt
- func (wc *WhereCls) US() *UpdateStmt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DeleteStmt ¶
type DeleteStmt struct {
// contains filtered or unexported fields
}
func Delete ¶
func Delete(table string) *DeleteStmt
func (*DeleteStmt) Apply ¶
func (ds *DeleteStmt) Apply(w *WhereCls) *DeleteStmt
func (*DeleteStmt) Build ¶
func (ds *DeleteStmt) Build() (string, []interface{})
func (*DeleteStmt) ExecRet ¶ added in v0.1.2
func (ds *DeleteStmt) ExecRet(ctx context.Context) pgx.Row
func (*DeleteStmt) Returning ¶ added in v0.1.2
func (ds *DeleteStmt) Returning(cols ...string) *DeleteStmt
func (*DeleteStmt) Where ¶
func (ds *DeleteStmt) Where(col string, args ...interface{}) *WhereCls
func (*DeleteStmt) WhereNot ¶
func (ds *DeleteStmt) WhereNot(col string, args ...interface{}) *WhereCls
type InsertStmt ¶
type InsertStmt struct {
// contains filtered or unexported fields
}
func Insert ¶
func Insert(table string) *InsertStmt
func (*InsertStmt) Build ¶
func (is *InsertStmt) Build() (string, []interface{})
func (*InsertStmt) ExecRet ¶ added in v0.1.2
func (is *InsertStmt) ExecRet(ctx context.Context) pgx.Row
func (*InsertStmt) Returning ¶ added in v0.1.2
func (is *InsertStmt) Returning(cols ...string) *InsertStmt
func (*InsertStmt) Set ¶
func (is *InsertStmt) Set(col string, val interface{}) *InsertStmt
func (*InsertStmt) Values ¶
func (is *InsertStmt) Values(m Map) *InsertStmt
type SelectStmt ¶
type SelectStmt struct {
// contains filtered or unexported fields
}
func Select ¶
func Select(cols ...string) *SelectStmt
func (*SelectStmt) Apply ¶
func (ss *SelectStmt) Apply(w *WhereCls) *SelectStmt
func (*SelectStmt) Asc ¶
func (ss *SelectStmt) Asc(col string) *SelectStmt
func (*SelectStmt) Build ¶
func (ss *SelectStmt) Build() (string, []interface{})
func (*SelectStmt) Desc ¶
func (ss *SelectStmt) Desc(col string) *SelectStmt
func (*SelectStmt) From ¶
func (ss *SelectStmt) From(table string) *SelectStmt
func (*SelectStmt) GetOffset ¶ added in v0.1.2
func (ss *SelectStmt) GetOffset() int
func (*SelectStmt) Limit ¶
func (ss *SelectStmt) Limit(n int) *SelectStmt
func (*SelectStmt) Offset ¶
func (ss *SelectStmt) Offset(n int) *SelectStmt
func (*SelectStmt) Order ¶ added in v0.1.2
func (ss *SelectStmt) Order(col string, desc bool) *SelectStmt
func (*SelectStmt) Query ¶ added in v0.1.2
func (ss *SelectStmt) Query(ctx context.Context) (pgx.Rows, error)
func (*SelectStmt) QueryFunc ¶ added in v0.1.2
func (ss *SelectStmt) QueryFunc(ctx context.Context, scans []interface{}, f func(pgx.QueryFuncRow) error) error
func (*SelectStmt) QueryRow ¶ added in v0.1.2
func (ss *SelectStmt) QueryRow(ctx context.Context) pgx.Row
func (*SelectStmt) Select ¶ added in v0.1.2
func (ss *SelectStmt) Select(cols ...string) *SelectStmt
func (*SelectStmt) Where ¶
func (ss *SelectStmt) Where(col string, args ...interface{}) *WhereCls
func (*SelectStmt) WhereCond ¶ added in v0.1.2
func (ss *SelectStmt) WhereCond(cond bool, col string, args ...interface{}) *WhereCls
func (*SelectStmt) WhereNot ¶
func (ss *SelectStmt) WhereNot(col string, args ...interface{}) *WhereCls
type UpdateStmt ¶
type UpdateStmt struct {
// contains filtered or unexported fields
}
func Update ¶
func Update(table string) *UpdateStmt
func (*UpdateStmt) Apply ¶
func (us *UpdateStmt) Apply(w *WhereCls) *UpdateStmt
func (*UpdateStmt) Build ¶
func (us *UpdateStmt) Build() (string, []interface{})
func (*UpdateStmt) ExecRet ¶ added in v0.1.2
func (us *UpdateStmt) ExecRet(ctx context.Context) pgx.Row
func (*UpdateStmt) Returning ¶ added in v0.1.2
func (us *UpdateStmt) Returning(cols ...string) *UpdateStmt
func (*UpdateStmt) Set ¶
func (us *UpdateStmt) Set(col string, val interface{}) *UpdateStmt
func (*UpdateStmt) Values ¶
func (us *UpdateStmt) Values(m Map) *UpdateStmt
func (*UpdateStmt) Where ¶
func (us *UpdateStmt) Where(col string, args ...interface{}) *WhereCls
func (*UpdateStmt) WhereNot ¶
func (us *UpdateStmt) WhereNot(col string, args ...interface{}) *WhereCls
type WhereCls ¶
type WhereCls struct {
// contains filtered or unexported fields
}
func (*WhereCls) ContainedBy ¶
func (*WhereCls) DS ¶
func (wc *WhereCls) DS() *DeleteStmt
func (*WhereCls) SS ¶
func (wc *WhereCls) SS() *SelectStmt
func (*WhereCls) US ¶
func (wc *WhereCls) US() *UpdateStmt
Click to show internal directories.
Click to hide internal directories.