fixes formatting on collection.go
[arvados.git] / sdk / go / arvados / resource_list.go
1 package arvados
2
3 import "encoding/json"
4
5 // ResourceListParams expresses which results are requested in a
6 // list/index API.
7 type ResourceListParams struct {
8         Select   []string `json:"select,omitempty"`
9         Filters  []Filter `json:"filters,omitempty"`
10         Limit    *int     `json:"limit,omitempty"`
11         Offset   int      `json:"offset,omitempty"`
12         Order    string   `json:"order,omitempty"`
13         Distinct bool     `json:"distinct,omitempty"`
14         Count    bool     `json:"count,omitempty"`
15 }
16
17 // A Filter restricts the set of records returned by a list/index API.
18 type Filter struct {
19         Attr     string
20         Operator string
21         Operand  interface{}
22 }
23
24 // MarshalJSON encodes a Filter in the form expected by the API.
25 func (f *Filter) MarshalJSON() ([]byte, error) {
26         return json.Marshal([]interface{}{f.Attr, f.Operator, f.Operand})
27 }