-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuilder_gen_opts.go
More file actions
executable file
·121 lines (98 loc) · 2.57 KB
/
builder_gen_opts.go
File metadata and controls
executable file
·121 lines (98 loc) · 2.57 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
// Code generated by builder-gen. DO NOT EDIT.
package errutil
func (o Opts) HasTags() bool {
return o.Tags != nil
}
func (o Opts) HasStackTrace() bool {
return o.StackTrace != nil
}
func (o Opts) HasInternalErrorMessage() bool {
return o.InternalErrorMessage != nil
}
func (o Opts) HasCode() bool {
return o.Code != nil
}
func (o Opts) HasStatusCode() bool {
return o.StatusCode != nil
}
type OptsFunc func(*Opts)
func ToOpts(opts ...OptsFunc) Opts {
var info Opts
ToOptsWithDefault(&info, opts...)
return info
}
func ToOptsWithDefault(info *Opts, opts ...OptsFunc) {
for _, o := range opts {
o(info)
}
}
func WithAccessDenied(accessDeniedParam ...bool) OptsFunc {
return func(opts *Opts) {
opts.AccessDenied = len(accessDeniedParam) == 0 || accessDeniedParam[0]
}
}
func WithConflict(conflictParam ...bool) OptsFunc {
return func(opts *Opts) {
opts.Conflict = len(conflictParam) == 0 || conflictParam[0]
}
}
func WithNotFound(notFoundParam ...bool) OptsFunc {
return func(opts *Opts) {
opts.NotFound = len(notFoundParam) == 0 || notFoundParam[0]
}
}
func WithExists(existsParam ...bool) OptsFunc {
return func(opts *Opts) {
opts.Exists = len(existsParam) == 0 || existsParam[0]
}
}
func WithTooLarge(tooLargeParam ...bool) OptsFunc {
return func(opts *Opts) {
opts.TooLarge = len(tooLargeParam) == 0 || tooLargeParam[0]
}
}
func WithRateLimit(rateLimitParam ...bool) OptsFunc {
return func(opts *Opts) {
opts.RateLimit = len(rateLimitParam) == 0 || rateLimitParam[0]
}
}
func WithTags(tagsParam ...Tag) OptsFunc {
return func(opts *Opts) {
opts.Tags = tagsParam
}
}
func WithStackTrace(stackTraceParam int) OptsFunc {
return func(opts *Opts) {
opts.StackTrace = &stackTraceParam
}
}
func WithUnauthorized(unauthorizedParam ...bool) OptsFunc {
return func(opts *Opts) {
opts.Unauthorized = len(unauthorizedParam) == 0 || unauthorizedParam[0]
}
}
func WithTemporary(temporaryParam ...bool) OptsFunc {
return func(opts *Opts) {
opts.Temporary = len(temporaryParam) == 0 || temporaryParam[0]
}
}
func WithInternalErrorMessage(internalErrorMessageParam string) OptsFunc {
return func(opts *Opts) {
opts.InternalErrorMessage = &internalErrorMessageParam
}
}
func WithCode(codeParam string) OptsFunc {
return func(opts *Opts) {
opts.Code = &codeParam
}
}
func WithStatusCode(statusCodeParam int) OptsFunc {
return func(opts *Opts) {
opts.StatusCode = &statusCodeParam
}
}
func WithTooManyRequests(tooManyRequestsParam ...bool) OptsFunc {
return func(opts *Opts) {
opts.TooManyRequests = len(tooManyRequestsParam) == 0 || tooManyRequestsParam[0]
}
}