Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( MaxQueryDepth = 10 MaxConditions = 50 MaxJoinDepth = 3 )
Configuration options for query validation
View Source
var AllowedFunctions = map[string]bool{ "COUNT": true, "SUM": true, "AVG": true, "MIN": true, "MAX": true, }
AllowedFunctions defines SQL functions that are permitted in queries
View Source
var AllowedOperators = map[string]bool{ "=": true, "<": true, ">": true, "<=": true, ">=": true, "!=": true, "<>": true, "IN": true, "LIKE": true, "IS": true, "IS NOT": true, }
AllowedOperators defines SQL operators that are permitted in queries
View Source
var AllowedTables = map[string][]string{
"stocks": {"product_id", "warehouse_id", "size_option_id", "quantity", "basic_price", "timestamp"},
"orders": {"product_id", "size_option_id", "warehouse_id", "price", "orders", "timestamp"},
"orders30d": {"product_id", "subject_id", "price", "orders", "is_fbs", "total_revenue"},
}
AllowedTables defines tables and their fields that are permitted in queries
View Source
var ProhibitedPatterns = []string{
`(?i)\bWITH\b`,
`/\*.*\*/`,
`--.*$`,
`;\s*\S`,
`\bunion\b`,
`\bexcept\b`,
`\bintersect\b`,
`\bcreate\b`,
`\bdrop\b`,
`\balter\b`,
`\bexec\b`,
`\bcall\b`,
`\bpragma\b`,
`\binsert\b`,
`\bupdate\b`,
`\bdelete\b`,
`\bwindow\b`,
`\bpartition\b`,
`\brecursive\b`,
`\busing\b`,
`\bexplain\b`,
`\banalyze\b`,
`\bexplain\s+analyze\b`,
`\bcase\b`,
`\bover\b`,
`\bnatural\b\s+\bjoin\b`,
}
ProhibitedPatterns defines regex patterns for prohibited SQL constructs
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.