Documentation
¶
Index ¶
- Variables
- func BuildQuery(q *bun.SelectQuery, queryStr string, opts QueryOptions) (*bun.SelectQuery, error)
- func GetTotalCount(ctx context.Context, q *bun.SelectQuery) (int, error)
- type ColumnType
- type EnumField
- type Filter
- type JoinOperator
- type Operator
- type QueryOptions
- type QueryParams
- type RelationMapping
- type RelationType
- type SortOrder
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidDateRange = eris.New("invalid date range")
Functions ¶
func BuildQuery ¶
func BuildQuery(q *bun.SelectQuery, queryStr string, opts QueryOptions) (*bun.SelectQuery, error)
func GetTotalCount ¶
GetTotalCount retrieves the total count of records for the query
Types ¶
type ColumnType ¶
type ColumnType string
const ( ColumnTypeText ColumnType = "text" ColumnTypeNumber ColumnType = "number" ColumnTypeDate ColumnType = "date" ColumnTypeBoolean ColumnType = "boolean" ColumnTypeSelect ColumnType = "select" ColumnTypeMultiSelect ColumnType = "multi-select" )
type Filter ¶
type Filter struct { Field string `json:"field"` Operator Operator `json:"operator"` Value any `json:"value"` // Can be string, []string, number, bool, etc. ValueTo any `json:"valueTo"` // For between operations Type ColumnType `json:"type"` }
Filter represents a single filter condition
type JoinOperator ¶
type JoinOperator string
const ( JoinOperatorAnd JoinOperator = "and" JoinOperatorOr JoinOperator = "or" )
type Operator ¶
type Operator string
const ( OperatorILike Operator = "iLike" OperatorNotILike Operator = "notILike" OperatorEq Operator = "eq" OperatorNe Operator = "ne" OperatorIsEmpty Operator = "isEmpty" OperatorIsNotEmpty Operator = "isNotEmpty" // Numeric/Date Operators OperatorLt Operator = "lt" OperatorLte Operator = "lte" OperatorGt Operator = "gt" OperatorGte Operator = "gte" OperatorIsBetween Operator = "isBetween" // Select/Multi-select Operators OperatorIn Operator = "in" OperatorNotIn Operator = "notIn" // Special Operators OperatorIsRelativeToToday Operator = "isRelativeToToday" )
Text Operators
type QueryOptions ¶
type QueryOptions struct { TableAlias string EnumFields []EnumField RelationMappings []RelationMapping }
type QueryParams ¶
type QueryParams struct { Filters []*Filter `json:"filters"` JoinOperator JoinOperator `json:"joinOperator"` }
QueryParams represents the main query parameter structure
type RelationMapping ¶
type RelationMapping struct { From string // Source field/table name (e.g., "profile") To string // Target table alias (e.g., "worker_profiles") Type RelationType // Type of relationship LocalKey string // Local key field (e.g., "id") ForeignKey string // Foreign key field (e.g., "worker_id") }
RelationMapping defines how tables are related and mapped
type RelationType ¶
type RelationType string
RelationType defines how tables are related
const ( RelationTypeOneToOne RelationType = "one_to_one" RelationTypeOneToMany RelationType = "one_to_many" RelationTypeManyToOne RelationType = "many_to_one" )
Click to show internal directories.
Click to hide internal directories.