Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WherePart ¶
WherePart returns the part of the where clause between parens, as in: (
geography_code IN ( ... )
OR
geography_code BETWEEN (low, high)
...
)
col is the name of the column we are matching (eg, "geography_code" or "category_code"). set is a ValueSet which contains the single value and ranges returned by ParseMultiArgs.
If set has no single values or ranges, an empty string will be returned.
Types ¶
type Callback ¶
When operating on a Single, the value of s on return can be:
nil - delete this Single ptr to a new value - changes this Single ptr to the current value - does not change this Single
Similarly when operating on a Range, the value of l and h on return can be:
nil - delete this Range ptrs to new values - change this Range ptrs to current values - does not change this Range
See the example changeCallback in where_test.go.
type ValueRange ¶
ValueRange holds the low and high values for a range.
type ValueSet ¶
type ValueSet struct {
Singles []string // list of single values; becomes IN
Ranges []*ValueRange // list of value ranges; becomes BETWEEN
}
ValueSet holds all the single values and ranges for a for a multi-valued query parameter.
func NewValueSet ¶
func NewValueSet() *ValueSet
func ParseMultiArgs ¶
ParseMultiArgs generates a ValueSet from multi value query parameters.
XXX return proper error types once errors are factored out of geodata
func (*ValueSet) Walk ¶
Walk calls the callback function for every Single and Range in set. The callback function can return values telling Walk to delete, change, or leave the value untouched. If the callback function returns an error, Walk will stop and return the error, returning a nil ValueSet. The original ValueSet will not be changed on error.