Skip to content

Commit

Permalink
添加wherein
Browse files Browse the repository at this point in the history
  • Loading branch information
hulutech-web committed Nov 4, 2024
1 parent 68c5453 commit 28b0ae2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions http_result.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ type HttpResult struct {
func NewResult(ctx http.Context) *HttpResult {
return &HttpResult{
Context: ctx,
Query: facades.Orm().Query(),
}
}

Expand Down
12 changes: 12 additions & 0 deletions paginator.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,18 @@ type PageResult struct {
Meta Meta `json:"meta"`
}

func (h *HttpResult) SearchByIncludes(column string, values []interface{}) *HttpResult {
// 再处理url查询
query := facades.Orm().Query()
h.Query = func(q orm.Query) orm.Query {
//处理日期时间
// 先处理过滤条件
q = q.Where(column+" in ?", values).(orm.Query)
return q
}(query)
return h
}

// SearchByParams
// ?name=xxx&pageSize=1&currentPage=1&sort=xxx&order=xxx
func (h *HttpResult) SearchByParams(params map[string]string, conditionMap map[string]interface{}, excepts ...string) *HttpResult {
Expand Down

0 comments on commit 28b0ae2

Please sign in to comment.