Documentation ¶
Index ¶
- func NewDBPool(ctx context.Context, config DBConfig) (*pgxpool.Pool, error)
- type DBConfig
- type QueryBuilder
- func (qb *QueryBuilder) Build() (string, []interface{})
- func (qb *QueryBuilder) WithGroupBy(fieldName string) *QueryBuilder
- func (qb *QueryBuilder) WithLimit(limit int32) *QueryBuilder
- func (qb *QueryBuilder) WithOffset(offset int32) *QueryBuilder
- func (qb *QueryBuilder) WithOrderBy(fieldName string) *QueryBuilder
- func (qb *QueryBuilder) WithWhereClause(whereClause string) *QueryBuilder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DBConfig ¶
type DBConfig struct { Host string Port int User string Password string DBName string Schema string SSLMode string }
func ConfigFromEnv ¶
func ConfigFromEnv() DBConfig
Same env.vars as per: https://www.postgresql.org/docs/current/libpq-envars.html
type QueryBuilder ¶
type QueryBuilder struct {
// contains filtered or unexported fields
}
func NewQueryBuilder ¶
func NewQueryBuilder(selectPart string, criteria *model.SearchRequest) *QueryBuilder
func (*QueryBuilder) Build ¶
func (qb *QueryBuilder) Build() (string, []interface{})
func (*QueryBuilder) WithGroupBy ¶
func (qb *QueryBuilder) WithGroupBy(fieldName string) *QueryBuilder
func (*QueryBuilder) WithLimit ¶
func (qb *QueryBuilder) WithLimit(limit int32) *QueryBuilder
func (*QueryBuilder) WithOffset ¶
func (qb *QueryBuilder) WithOffset(offset int32) *QueryBuilder
func (*QueryBuilder) WithOrderBy ¶
func (qb *QueryBuilder) WithOrderBy(fieldName string) *QueryBuilder
func (*QueryBuilder) WithWhereClause ¶
func (qb *QueryBuilder) WithWhereClause(whereClause string) *QueryBuilder
Click to show internal directories.
Click to hide internal directories.