Gisle Aune
6 years ago
4 changed files with 59 additions and 75 deletions
-
52graphql/resolver/queries/logs.go
-
4graphql/schema/types/log.graphql
-
32model/log/filter.go
-
40model/log/log.go
@ -0,0 +1,32 @@ |
|||||
|
package log |
||||
|
|
||||
|
// Filter for the List() function
|
||||
|
type Filter struct { |
||||
|
Search *string |
||||
|
Characters *[]string |
||||
|
Channels *[]string |
||||
|
Events *[]string |
||||
|
Open *bool |
||||
|
Limit *int32 |
||||
|
} |
||||
|
|
||||
|
// NewFilter makes a new filter
|
||||
|
func NewFilter() *Filter { |
||||
|
return &Filter{} |
||||
|
} |
||||
|
|
||||
|
// WithLimit adds a max amount of results to be returned.
|
||||
|
func (filter *Filter) WithLimit(limit int) *Filter { |
||||
|
limitPtr := int32(limit) |
||||
|
filter.Limit = &limitPtr |
||||
|
|
||||
|
return filter |
||||
|
} |
||||
|
|
||||
|
// WithOpen filters on whether a log is open.
|
||||
|
func (filter *Filter) WithOpen(limit int) *Filter { |
||||
|
limitPtr := int32(limit) |
||||
|
filter.Limit = &limitPtr |
||||
|
|
||||
|
return filter |
||||
|
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue