pql

package module
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 10, 2021 License: MIT Imports: 5 Imported by: 0

README

pql

pql helps build PostgreSQL queries.
It was inspired by https://github.com/jackc/pgsql.

Documentation

Overview

Package pql helps build PostgreSQL queries.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init added in v0.1.2

func Init(p *pgxpool.Pool)

Types

type Builder

type Builder interface {
	Build() (string, []interface{})
}

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) Exec added in v0.1.2

func (ds *DeleteStmt) Exec(ctx context.Context) error

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) Exec added in v0.1.2

func (is *InsertStmt) Exec(ctx context.Context) error

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 Map

type Map map[string]interface{}

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) Exec added in v0.1.2

func (us *UpdateStmt) Exec(ctx context.Context) error

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 Where

func Where(col string, args ...interface{}) *WhereCls

func (*WhereCls) And

func (wc *WhereCls) And(col string, args ...interface{}) *WhereCls

func (*WhereCls) Build

func (wc *WhereCls) Build() (string, []interface{})

func (*WhereCls) ContainedBy

func (wc *WhereCls) ContainedBy(v interface{}) *WhereCls

func (*WhereCls) Contains

func (wc *WhereCls) Contains(v interface{}) *WhereCls

func (*WhereCls) DS

func (wc *WhereCls) DS() *DeleteStmt

func (*WhereCls) Eq

func (wc *WhereCls) Eq(v interface{}) *WhereCls

func (*WhereCls) Ge

func (wc *WhereCls) Ge(v interface{}) *WhereCls

func (*WhereCls) Gt

func (wc *WhereCls) Gt(v interface{}) *WhereCls

func (*WhereCls) Ilike

func (wc *WhereCls) Ilike(v interface{}) *WhereCls

func (*WhereCls) IsNotNull

func (wc *WhereCls) IsNotNull() *WhereCls

func (*WhereCls) IsNull

func (wc *WhereCls) IsNull() *WhereCls

func (*WhereCls) Le

func (wc *WhereCls) Le(v interface{}) *WhereCls

func (*WhereCls) Like

func (wc *WhereCls) Like(v interface{}) *WhereCls

func (*WhereCls) Lt

func (wc *WhereCls) Lt(v interface{}) *WhereCls

func (*WhereCls) Neq

func (wc *WhereCls) Neq(v interface{}) *WhereCls

func (*WhereCls) Or

func (wc *WhereCls) Or(col string, args ...interface{}) *WhereCls

func (*WhereCls) SS

func (wc *WhereCls) SS() *SelectStmt

func (*WhereCls) US

func (wc *WhereCls) US() *UpdateStmt

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL