Documentation
¶
Overview ¶
Package query facilitates the translation of a result selector into a PostgresSQL conditional query string, incorporating sorting and paging functionalities.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder represents a query builder used to construct PostgresSQL conditional query strings with sorting and paging functionalities.
func NewPostgresQueryBuilder ¶
NewPostgresQueryBuilder creates a new instance of the query builder with the provided settings.
type Settings ¶
type Settings struct {
// FilterFieldMapping is the mapping of filter (or sorting) fields to columns in the database.
// The columns will be part of the `WHERE` or `ORDER BY` clause, so depending on the query the entry
// needs to be prefixed with the table name or alias used in the query.
// It also serves as safeguard against sql injection.
FilterFieldMapping map[string]string
// Column used as tie breaker when sorting results. It should have a unique value for each row.
// It will be part of the `ORDER BY` clause, so depending on the query the entry needs to be prefixed
// with the table name or alias used in the query.
SortingTieBreakerColumn string
}
Settings is a configuration struct used to customize the behavior of the query builder.
Click to show internal directories.
Click to hide internal directories.