-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathresource.go
More file actions
32 lines (27 loc) · 831 Bytes
/
Copy pathresource.go
File metadata and controls
32 lines (27 loc) · 831 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
package fractal
// ResourceOption options for resource object
type ResourceOption struct {
data Any
resourceKey string
transformer Transformer
}
// ModResourceOption function to modify resource option
type ModResourceOption func(option *ResourceOption)
// WithData is an easy way to set data for resource
func WithData(data Any) ModResourceOption {
return func(option *ResourceOption) {
option.data = data
}
}
// WithTransformer is an easy way to set transformer for resource
func WithTransformer(transformer Transformer) ModResourceOption {
return func(option *ResourceOption) {
option.transformer = transformer
}
}
// WithResourceKey is an easy way to set resource key for resource
func WithResourceKey(key string) ModResourceOption {
return func(option *ResourceOption) {
option.resourceKey = key
}
}