-
Notifications
You must be signed in to change notification settings - Fork 23
added filter list with query parser #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added filter list with query parser #1
Conversation
merge go-lang code |
75e23a1
to
4da503b
Compare
main.go
Outdated
for i := 0; i < len(q.Filters); i++ { | ||
filter := q.Filters[i] | ||
for key := range q.Filters { | ||
where = `` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where = ""
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ready
main.go
Outdated
} else if filter.Or && OR { | ||
prefix = " OR " | ||
// if last element of next element not OR method | ||
if i+1 == len(q.Filters[key]) || (i+1 < len(q.Filters[key]) && !q.Filters[key][key+1].Or) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you have an error in:
q.Filters[key][key+1]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ready
main.go
Outdated
where += fmt.Sprintf("%s%s%s", prefix, a, suffix) | ||
} else { | ||
continue | ||
if where != `` { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if where != "" {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ready
main.go
Outdated
} | ||
|
||
if len(whereList) == 0 { | ||
return `` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return ""
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ready
main.go
Outdated
} | ||
|
||
return where | ||
return strings.Join(whereList, ` AND `) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
" AND "
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ready
main.go
Outdated
|
||
return " WHERE " + q.Where() | ||
where := q.Where() | ||
if where == `` { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
""
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ready
4da503b
to
d6af7f6
Compare
eefad9c
to
f66d5bb
Compare
c762140
to
4ca7d68
Compare
4ca7d68
to
586157a
Compare
merge timsolov/rest-query-parser::master to master
No description provided.