-
Notifications
You must be signed in to change notification settings - Fork 245
/
zz_generated.options.go
92 lines (79 loc) · 2.83 KB
/
zz_generated.options.go
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
// Code generated by github.com/ecordell/optgen. DO NOT EDIT.
package testserver
import util "github.com/authzed/spicedb/pkg/cmd/util"
type ConfigOption func(c *Config)
// NewConfigWithOptions creates a new Config with the passed in options set
func NewConfigWithOptions(opts ...ConfigOption) *Config {
c := &Config{}
for _, o := range opts {
o(c)
}
return c
}
// ToOption returns a new ConfigOption that sets the values from the passed in Config
func (c *Config) ToOption() ConfigOption {
return func(to *Config) {
to.GRPCServer = c.GRPCServer
to.ReadOnlyGRPCServer = c.ReadOnlyGRPCServer
to.HTTPGateway = c.HTTPGateway
to.ReadOnlyHTTPGateway = c.ReadOnlyHTTPGateway
to.LoadConfigs = c.LoadConfigs
to.MaximumUpdatesPerWrite = c.MaximumUpdatesPerWrite
to.MaximumPreconditionCount = c.MaximumPreconditionCount
}
}
// ConfigWithOptions configures an existing Config with the passed in options set
func ConfigWithOptions(c *Config, opts ...ConfigOption) *Config {
for _, o := range opts {
o(c)
}
return c
}
// WithGRPCServer returns an option that can set GRPCServer on a Config
func WithGRPCServer(gRPCServer util.GRPCServerConfig) ConfigOption {
return func(c *Config) {
c.GRPCServer = gRPCServer
}
}
// WithReadOnlyGRPCServer returns an option that can set ReadOnlyGRPCServer on a Config
func WithReadOnlyGRPCServer(readOnlyGRPCServer util.GRPCServerConfig) ConfigOption {
return func(c *Config) {
c.ReadOnlyGRPCServer = readOnlyGRPCServer
}
}
// WithHTTPGateway returns an option that can set HTTPGateway on a Config
func WithHTTPGateway(hTTPGateway util.HTTPServerConfig) ConfigOption {
return func(c *Config) {
c.HTTPGateway = hTTPGateway
}
}
// WithReadOnlyHTTPGateway returns an option that can set ReadOnlyHTTPGateway on a Config
func WithReadOnlyHTTPGateway(readOnlyHTTPGateway util.HTTPServerConfig) ConfigOption {
return func(c *Config) {
c.ReadOnlyHTTPGateway = readOnlyHTTPGateway
}
}
// WithLoadConfigs returns an option that can append LoadConfigss to Config.LoadConfigs
func WithLoadConfigs(loadConfigs string) ConfigOption {
return func(c *Config) {
c.LoadConfigs = append(c.LoadConfigs, loadConfigs)
}
}
// SetLoadConfigs returns an option that can set LoadConfigs on a Config
func SetLoadConfigs(loadConfigs []string) ConfigOption {
return func(c *Config) {
c.LoadConfigs = loadConfigs
}
}
// WithMaximumUpdatesPerWrite returns an option that can set MaximumUpdatesPerWrite on a Config
func WithMaximumUpdatesPerWrite(maximumUpdatesPerWrite uint16) ConfigOption {
return func(c *Config) {
c.MaximumUpdatesPerWrite = maximumUpdatesPerWrite
}
}
// WithMaximumPreconditionCount returns an option that can set MaximumPreconditionCount on a Config
func WithMaximumPreconditionCount(maximumPreconditionCount uint16) ConfigOption {
return func(c *Config) {
c.MaximumPreconditionCount = maximumPreconditionCount
}
}