Documentation
¶
Index ¶
- Constants
- func AddKeywords(funcs map[string]interface{}) map[string]interface{}
- func AddOperatorKV(funcs map[string]interface{}) map[string]interface{}
- func Aor(strs ...string) string
- func Col(strs ...string) string
- func Date(params map[string][]string) func(string, string, string) template.HTML
- func DateNode(name, value, class string) (node *html.Node)
- func FilterCheckbox(params map[string][]string) func() template.HTML
- func Funcs(funcs map[string]interface{}, params map[string][]string) map[string]interface{}
- func IsValidSuffix(suffix string) bool
- func Join(items ...interface{}) string
- func Multinumber(params map[string][]string) func(string, string, string) template.HTML
- func Multiselect(params map[string][]string) func(string, []KV, string, string) template.HTML
- func MultiselectOptional(params map[string][]string) func(string, []KV, string, string) template.HTML
- func Multitext(params map[string][]string) func(string, string, string) template.HTML
- func Number(params map[string][]string) func(string, string, string) template.HTML
- func NumberNode(name, value, class string) (node *html.Node)
- func Opr(strs ...string) string
- func Ord(strs ...string) string
- func PaginateHandlerFunc(url string, delta int, ...) http.HandlerFunc
- func ReplacePlaceholders(query string) string
- func ResolvePage(params map[string][]string) map[string][]string
- func ScrubForm(form url.Values) url.Values
- func ScrubRequest(r *http.Request) *http.Request
- func ScrubUrl(url string, form url.Values) string
- func Select(params map[string][]string) func(string, []KV, string, string) template.HTML
- func SelectNode(name string, values []KV, selected, class string) (node *html.Node)
- func SelectOptional(params map[string][]string) func(string, []KV, string, string) template.HTML
- func Subst(query string, args ...interface{}) string
- func Text(params map[string][]string) func(string, string, string) template.HTML
- func TextNode(name, value, class string) (node *html.Node)
- func Val(strs ...string) string
- type KV
- type OrderBy
- type Pred
- type PredGrp
- type SelectOption
- type SelectQuery
- type SelectStats
- type SelectStatsConfig
- type SelectStatsOption
Constants ¶
View Source
const ( Sel = "SEL" // SELECT Frm = "FRM" // FROM Lim = "LIM" // LIMIT Off = "OFF" // OFFSET Page = "PAGE" Filter = "FILTER" )
Suffixes
View Source
const ( Count = "COUNT(*)" Asc = "ASC" Desc = "DESC" And = "AND" Or = "OR" )
SQL Keywords
View Source
const ( Eq = "EQ" Ne = "NE" In = "IN" Gt = "GT" Ge = "GE" Lt = "LT" Le = "LE" Null = "NULL" NotNull = "NOTNULL" Like = "LIKE" ILike = "ILIKE" Between = "BETWEEN" Ignore = "IGNORE" )
Operators
View Source
const Sep = "."
The separator between the prefixes and suffix
Variables ¶
This section is empty.
Functions ¶
func AddKeywords ¶
func AddOperatorKV ¶
func IsValidSuffix ¶
func Multinumber ¶
func Multiselect ¶
func MultiselectOptional ¶
func NumberNode ¶
func PaginateHandlerFunc ¶
func PaginateHandlerFunc(url string, delta int, errorHandler func(http.ResponseWriter, *http.Request, error)) http.HandlerFunc
func ReplacePlaceholders ¶
Replace all ? with postgres placeholders $<number>
func SelectNode ¶
func SelectOptional ¶
Types ¶
type Pred ¶
type Pred struct {
Column string
Operator string
Value string
Values []string
Nested bool
PredGrp *PredGrp
}
Column Operator Value/Values name = 'bob' name IN ('bob', 'alice')
type SelectOption ¶
type SelectOption func(SelectQuery) SelectQuery
var SelectAll SelectOption = func(sq SelectQuery) SelectQuery { sq.Select = []string{"*"} return sq }
var SelectCount SelectOption = func(sq SelectQuery) SelectQuery { sq.Select = []string{Count} sq.OrderBys = nil sq.Limit = 0 sq.Offset = 0 return sq }
var WhereOnly SelectOption = func(sq SelectQuery) SelectQuery { sq.Select = nil sq.From = "" sq.OrderBys = nil sq.Limit = 0 sq.Offset = 0 return sq }
type SelectQuery ¶
type SelectQuery struct {
Select []string
From string
Where *PredGrp
OrderBys []OrderBy
Limit int
Offset int
}
func ParseSelect ¶
func ParseSelect(params map[string][]string) (query SelectQuery)
func (SelectQuery) Sql ¶
func (sq SelectQuery) Sql(options ...SelectOption) (query string, args []interface{})
type SelectStats ¶
func DBSelectWithStats ¶
func DBSelectWithStats(db *sqlx.DB, params map[string][]string, options ...SelectStatsOption) (rows *sqlx.Rows, stats SelectStats, err error)
type SelectStatsConfig ¶
type SelectStatsConfig struct {
MinimumLimit int
QueryOptions []SelectOption
}
type SelectStatsOption ¶
type SelectStatsOption func(SelectStatsConfig) SelectStatsConfig
var SelectStatsQueryAll SelectStatsOption = func(config SelectStatsConfig) SelectStatsConfig { config.QueryOptions = append(config.QueryOptions, SelectAll) return config }
func SelectStatsMinimumLimit ¶
func SelectStatsMinimumLimit(limit int) SelectStatsOption
Click to show internal directories.
Click to hide internal directories.