-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.go
More file actions
72 lines (65 loc) · 1.79 KB
/
Copy pathtypes.go
File metadata and controls
72 lines (65 loc) · 1.79 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package fractal
// Paginator interface
type Paginator interface {
GetCurrentPage() uint
GetLastPage() uint
GetTotal() uint
GetCount() uint
GetPerPage() uint
GetURL(page uint) string
}
// Cursor interface
type Cursor interface {
GetCurrent() string
GetPrev() string
GetNext() string
GetCount() uint
}
// Resource interface
type Resource interface {
GetResourceKey() string
SetResourceKey(key string)
GetData() Any
SetData(data Any)
GetTransformer() Transformer
SetTransformer(Transformer) Resource
GetMeta() M
SetMeta(M) Resource
GetMetaValue(key string) Any
SetMetaValue(key string, value Any) Resource
}
// Transformer interface
type Transformer interface {
Transform(data Any) M
GetAvailableIncludes() []string
SetAvailableIncludes(includes []string) Transformer
GetDefaultIncludes() []string
SetDefaultIncludes(includes []string) Transformer
GetCurrentScope() *Scope
SetCurrentScope(scope *Scope) Transformer
ProcessIncludedResources(scope *Scope, data Any) M
}
// Includer interface
type Includer interface {
Include(includeName string, data Any, params P) Resource
}
// Serializer interface
type Serializer interface {
Collection(resourceKey string, data Any) M
Item(resourceKey string, data Any) M
Null() M
IncludeData(resource Resource, data Any) Any
Meta(meta M) M
Paginator(paginator Paginator) M
Cursor(cursor Cursor) M
MergeIncludes(transformed, included M) M
SideloadIncludes() bool
InjectData(data, rawIncluded Any) Any
InjectAvailableIncludeData(data M, availableIncludes []string) M
FilterIncludes(included, data Any) Any
}
// ScopeFactory interface
type ScopeFactory interface {
CreateScopeFor(manager *Manager, resource Resource, opts ...ModScopeOption) *Scope
CreateChildScopeFor(manager *Manager, parentScope *Scope, resource Resource, opts ...ModScopeOption) *Scope
}