-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlist.go
More file actions
36 lines (30 loc) · 880 Bytes
/
list.go
File metadata and controls
36 lines (30 loc) · 880 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package intacct
import (
"encoding/xml"
)
// TODO Or Common method and change the Name field...?
type GetList struct {
XMLName xml.Name `xml:"get_list"`
Object string `xml:"object,attr"`
ListParams
}
// TODO params should include filters, sorts, max items?
// Filters and sorts can be attached to the params or passed directly to List
// TODO How to support multiple or nested filter expressions?
type ListParams struct {
MaxItems uint64 `xml:"maxitems,attr"`
Filter Logical `xml:"filter"`
Sorts Sorts `xml:"sorts"`
}
// Merge will merge two ListParams - the given values (if non-zero) take
// precedence
func (l ListParams) Merge(other ListParams) ListParams {
if other.MaxItems > 0 {
l.MaxItems = other.MaxItems
}
l.Filter.Filters = append(l.Filter.Filters, other.Filter.Filters...)
if len(other.Sorts) > 0 {
l.Sorts = other.Sorts
}
return l
}