Documentation ¶
Index ¶
- Constants
- func BuildCondition(scons []SqlCondition, fcons []FieldCondition) (string, []interface{}, error)
- func GetString(key string) (string, error)
- func HGet(key string, field string) (string, error)
- func HGetAll(key string) (map[string]string, error)
- func HSet(key string, field string, value string) error
- func SetNx(key string, value string) (bool, error)
- func TTL(key string) (int, error)
- type FieldCondition
- type PageCondition
- type SearchModelResult
- type SearchResult
- type SqlCondition
Constants ¶
View Source
const ( Accurate = "accurate" // 精确匹配 Fuzzy = "fuzzy" // 模糊匹配 Not = "not" // 不匹配 Bwt = "between" // 位于两者之间(含) In = "in" // 在某个范围内 NotIn = "notin" // 不在某个范围内 Larger = "larger" // 大于 LargerOrEqual = "le" // 大于或等于 Smaller = "smaller" // 小于 SmallerOrEqual = "se" // 小于或等于 )
Variables ¶
This section is empty.
Functions ¶
func BuildCondition ¶
func BuildCondition(scons []SqlCondition, fcons []FieldCondition) (string, []interface{}, error)
BuildCondition 根据condition生成where条件
Types ¶
type FieldCondition ¶
type FieldCondition struct { TableName string `json:"table_name"` Field string `json:"field"` Value string `json:"value"` MatchType string `json:"match_type"` }
FieldCondition 字段条件
type PageCondition ¶
type PageCondition struct { Conditions []FieldCondition `json:"conditions"` PageNo int `json:"page_no"` PageSize int `json:"page_size"` }
PageCondition 基于Field查询专用的结构体
type SearchModelResult ¶
type SearchModelResult struct { TotalCount int64 `json:"total_count"` Items interface{} `json:"items"` }
SearchModelResult 查询返回结果类
func PagerModel ¶
func PagerModel(tableName string, scons []SqlCondition, fcons []FieldCondition, pageSize int64, pageIndex int64, orderBy string, traceID string) (SearchModelResult, error)
PagerModel 表分页查询的方法
type SearchResult ¶
type SearchResult struct { TotalCount int64 `json:"total_count"` Items []map[string]interface{} `json:"items"` }
SearchResult 查询返回结果类
func Pager ¶
func Pager(tableName string, scons []SqlCondition, fcons []FieldCondition, pageSize int64, pageIndex int64, orderBy string, traceID string) (SearchResult, error)
Pager 表分页查询的方法
type SqlCondition ¶
type SqlCondition struct { Sql string `json:"sql"` Values []string `json:"values"` // SQL条件对应的value集合 }
SqlCondition Sql条件
Click to show internal directories.
Click to hide internal directories.