Skip to content

Commit

Permalink
fix: added omitempty to filters (#16)
Browse files Browse the repository at this point in the history
* fix: added omitempty on children type on struct block

* feat: added ommit empty
  • Loading branch information
mustafasegf authored Aug 11, 2021
1 parent 8aab81a commit ba3cd5d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions database.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,14 @@ func (qr *DatabaseQueryRequest) MarshalJSON() ([]byte, error) {
var filter interface{}
if qr.PropertyFilter != nil {
filter = qr.PropertyFilter
} else {
} else if qr.CompoundFilter != nil{
filter = qr.CompoundFilter
}
return json.Marshal(struct {
Sorts []SortObject `json:"sorts,omitempty"`
StartCursor Cursor `json:"start_cursor,omitempty"`
PageSize int `json:"page_size,omitempty"`
Filter interface{} `json:"filter"`
Filter interface{} `json:"filter,omitempty"`
}{
Sorts: qr.Sorts,
StartCursor: qr.StartCursor,
Expand Down
2 changes: 1 addition & 1 deletion search.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type SearchRequest struct {
Sort *SortObject `json:"sort,omitempty"`
Filter interface{} `json:"filter,omitempty"`
StartCursor Cursor `json:"start_cursor,omitempty"`
PageSize int `json:"page_size"`
PageSize int `json:"page_size,omitempty"`
}

type SearchResponse struct {
Expand Down

0 comments on commit ba3cd5d

Please sign in to comment.