You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
boundary/internal/requests/options.go

32 lines
680 B

package requests
func getOpts(opt ...Option) options {
opts := getDefaultOptions()
for _, o := range opt {
o(&opts)
}
return opts
}
// Option - how Options are passed as arguments. Some of these are used for
// types within the handlers package, and some are for handlers to re-use across
// the various handler types.
type Option func(*options)
// options = how options are represented
type options struct {
withUserId string
}
func getDefaultOptions() options {
return options{}
}
// WithUserId specifies a user ID with which to populate the returned
// RequestContext
func WithUserId(userId string) Option {
return func(o *options) {
o.withUserId = userId
}
}