Documentation
¶
Index ¶
- Variables
- func BeginTx(ctx context.Context) (pgx.Tx, error)
- func GetPool() *pgxpool.Pool
- func InitPool(conf Config)
- func IsNotFound(err error) bool
- func PgTime(t time.Time) pgtype.Timestamptz
- func PgTimeNow() pgtype.Timestamptz
- type AfterGroupBy
- type AfterHaving
- type AfterLimit
- type AfterOffset
- type AfterOrderBy
- type AfterWhere
- type All
- type Clause
- type Cond
- type CondAction
- type CondGroup
- type Conditioner
- type Config
- type Do
- type Execute
- type Field
- func (f Field) Avg() Field
- func (f Field) BooleanEscape() Field
- func (f Field) Count() Field
- func (f Field) Eq(val any) Conditioner
- func (f Field) EqFold(val string) Conditioner
- func (f Field) Gt(val any) Conditioner
- func (f Field) Gte(val any) Conditioner
- func (f Field) ILike(val string) Conditioner
- func (f Field) In(val ...any) Conditioner
- func (f Field) IsNotNull() Conditioner
- func (f Field) IsNull() Conditioner
- func (f Field) Like(val string) Conditioner
- func (f Field) LikeFold(val string) Conditioner
- func (f Field) Lower() Field
- func (f Field) Lt(val any) Conditioner
- func (f Field) Lte(val any) Conditioner
- func (f Field) Max() Field
- func (f Field) Min() Field
- func (f Field) Name() string
- func (f Field) NotEq(val any) Conditioner
- func (f Field) NotIn(val ...any) Conditioner
- func (f Field) NotInSubQuery(qry WhereClause) Conditioner
- func (f Field) NumberEscape() Field
- func (f Field) String() string
- func (f Field) StringEscape() Field
- func (f Field) Sum() Field
- func (f Field) Trim() Field
- func (f Field) Upper() Field
- type First
- type GroupByClause
- type HavinClause
- type Insert
- type InsertClause
- type LimitClause
- type OffsetClause
- type OrderByClause
- type Query
- type RowScanner
- type RowsCb
- type SelectClause
- type Stringer
- type Table
- type Update
- type UpdateClause
- type WhereClause
- type WhereOrExec
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func InitPool ¶ added in v0.0.2
func InitPool(conf Config)
InitPool will create new pgxpool.Pool and will keep it for its working
func PgTimeNow ¶
func PgTimeNow() pgtype.Timestamptz
Types ¶
type AfterGroupBy ¶
type AfterGroupBy interface { HavinClause OrderByClause LimitClause OffsetClause Query }
type AfterHaving ¶
type AfterHaving interface { OrderByClause LimitClause OffsetClause Query }
type AfterLimit ¶
type AfterLimit interface { OffsetClause Query }
type AfterOffset ¶
type AfterOffset interface { LimitClause Query }
type AfterOrderBy ¶
type AfterOrderBy interface { LimitClause OffsetClause Query }
type AfterWhere ¶
type AfterWhere interface { WhereClause GroupByClause OrderByClause LimitClause OffsetClause Query }
type Clause ¶
type Clause interface {
Select(fields ...Field) SelectClause
}
type CondAction ¶
type CondAction uint8
const ( CondActionNothing CondAction = iota CondActionNeedToClose CondActionSubQuery )
Contdition actions
type Conditioner ¶
func And ¶
func And(cond ...Conditioner) Conditioner
func Or ¶
func Or(cond ...Conditioner) Conditioner
type Field ¶
type Field string
Field related to a table
func StringAggCast ¶
func (Field) BooleanEscape ¶ added in v0.0.7
BooleanEscape will return a false for null value
func (Field) EqFold ¶
func (f Field) EqFold(val string) Conditioner
EqualFold will use LOWER(column_name) = LOWER(val) for comparision
func (Field) Gt ¶
func (f Field) Gt(val any) Conditioner
func (Field) Gte ¶
func (f Field) Gte(val any) Conditioner
func (Field) IsNotNull ¶ added in v0.0.6
func (f Field) IsNotNull() Conditioner
func (Field) IsNull ¶ added in v0.0.6
func (f Field) IsNull() Conditioner
func (Field) Like ¶
func (f Field) Like(val string) Conditioner
func (Field) LikeFold ¶
func (f Field) LikeFold(val string) Conditioner
func (Field) Lt ¶ added in v0.0.5
func (f Field) Lt(val any) Conditioner
func (Field) Lte ¶ added in v0.0.5
func (f Field) Lte(val any) Conditioner
func (Field) NotEq ¶ added in v0.1.3
func (f Field) NotEq(val any) Conditioner
func (Field) NotInSubQuery ¶
func (f Field) NotInSubQuery(qry WhereClause) Conditioner
NotInSubQuery using ANY
func (Field) NumberEscape ¶ added in v0.0.7
NumberEscape will return a zero string for null value
func (Field) StringEscape ¶ added in v0.0.7
StringEscape will return a empty string for null value
type GroupByClause ¶
type GroupByClause interface {
GroupBy(fields ...Field) AfterGroupBy
}
type HavinClause ¶
type HavinClause interface {
Having(cond ...Conditioner) AfterHaving
}
type Insert ¶
type Insert interface { Set(field Field, val any) InsertClause SetMap(fields map[Field]any) InsertClause }
type InsertClause ¶
type LimitClause ¶
type LimitClause interface {
Limit(v int) AfterLimit
}
type OffsetClause ¶
type OffsetClause interface {
Offset(v int) AfterOffset
}
type OrderByClause ¶
type OrderByClause interface {
OrderBy(fields ...Field) AfterOrderBy
}
type RowScanner ¶
type RowsCb ¶
type RowsCb func(row RowScanner) error
type SelectClause ¶
type SelectClause interface { // Join and Inner Join are same Join(m Table, t1Field, t2Field Field, cond ...Conditioner) SelectClause LeftJoin(m Table, t1Field, t2Field Field, cond ...Conditioner) SelectClause RightJoin(m Table, t1Field, t2Field Field, cond ...Conditioner) SelectClause FullJoin(m Table, t1Field, t2Field Field, cond ...Conditioner) SelectClause CrossJoin(m Table) SelectClause WhereClause OrderByClause GroupByClause LimitClause OffsetClause Query // contains filtered or unexported methods }
type Table ¶
type Table struct { Name string PK []string FieldCount uint16 // contains filtered or unexported fields }
Table in database
func (*Table) Delete ¶
func (t *Table) Delete() WhereOrExec
type Update ¶
type Update interface { Set(field Field, val any) UpdateClause SetMap(fields map[Field]any) UpdateClause }
type UpdateClause ¶
type UpdateClause interface { Update Where(cond ...Conditioner) WhereOrExec }
type WhereClause ¶
type WhereClause interface {
Where(cond ...Conditioner) AfterWhere
}
type WhereOrExec ¶
type WhereOrExec interface { Where(cond ...Conditioner) WhereOrExec Execute }
Source Files
¶
Click to show internal directories.
Click to hide internal directories.