Documentation
¶
Index ¶
- Variables
- func CreateDatabase(cfg ConnectionConfig) error
- func DeleteDatabase(cfg ConnectionConfig) error
- type Condition
- type ConditionGroup
- type ConnectionConfig
- type DB
- func (db *DB) AddDateFilters(query *bun.SelectQuery, filters []DateFilter) *bun.SelectQuery
- func (db *DB) AddLimitAndOffset(query *bun.SelectQuery, limit, offset int) *bun.SelectQuery
- func (db *DB) CreateExtensions(extensions []string) error
- func (db *DB) CreateTables(models []interface{}) error
- func (db *DB) QueryBuilder(groups []ConditionGroup) (query string, queryArgs []interface{}, err error)
- func (db *DB) QueryCount(ctx context.Context, model interface{}, query string, ...) (int, error)
- func (db *DB) ResetTables(models []interface{}) error
- type DateFilter
- type LogicalOperator
- type Operator
- type Option
Constants ¶
This section is empty.
Variables ¶
View Source
var ( EqualOperator = Operator{"="} GreaterThanOperator = Operator{">"} LessThanOperator = Operator{"<"} GreaterThanOrEqualOperator = Operator{">="} LessThanOrEqualOperator = Operator{"<="} NotEqualOperator = Operator{"!="} InOperator = Operator{"IN"} BetweenOperator = Operator{"BETWEEN"} LikeOperator = Operator{"LIKE"} ILikeOperator = Operator{"ILIKE"} IsNullOperator = Operator{"IS NULL"} IsNotNullOperator = Operator{"IS NOT NULL"} NotOperator = Operator{"NOT"} )
View Source
var ( AndOperator = LogicalOperator{"AND"} OrOperator = LogicalOperator{"OR"} )
Functions ¶
func CreateDatabase ¶
func CreateDatabase(cfg ConnectionConfig) error
CreateDatabase - Creates a new database with the given configuration
func DeleteDatabase ¶
func DeleteDatabase(cfg ConnectionConfig) error
DeleteDatabase - Deletes an existing database with the given configuration
Types ¶
type Condition ¶
type Condition struct {
Column string
Comparison Operator
LogOp LogicalOperator
Value interface{}
}
type ConditionGroup ¶
type ConditionGroup struct {
Conditions []Condition
}
type ConnectionConfig ¶
type DB ¶
func ConnectToDatabase ¶
func ConnectToDatabase(cfg *ConnectionConfig) (*DB, error)
ConnectToDatabase - Creates a new connection to a PSQL database with the given configuration.
func (*DB) AddDateFilters ¶
func (db *DB) AddDateFilters(query *bun.SelectQuery, filters []DateFilter) *bun.SelectQuery
func (*DB) AddLimitAndOffset ¶
func (db *DB) AddLimitAndOffset(query *bun.SelectQuery, limit, offset int) *bun.SelectQuery
func (*DB) CreateExtensions ¶ added in v1.0.6
CreateExtensions - Creates a database extension if it doesn't already exist
func (*DB) CreateTables ¶
CreateTables - Creates the database schema if it doesn't already exist
func (*DB) QueryBuilder ¶
func (db *DB) QueryBuilder(groups []ConditionGroup) (query string, queryArgs []interface{}, err error)
func (*DB) QueryCount ¶
func (*DB) ResetTables ¶
ResetTables - Drops and recreates the database schema
type DateFilter ¶
type LogicalOperator ¶
type LogicalOperator struct {
Value string
}
func (LogicalOperator) String ¶
func (s LogicalOperator) String() string
Click to show internal directories.
Click to hide internal directories.