-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathoptions.go
More file actions
42 lines (35 loc) · 1008 Bytes
/
Copy pathoptions.go
File metadata and controls
42 lines (35 loc) · 1008 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
33
34
35
36
37
38
39
40
41
42
package vabastegi
import "context"
// Options of Vabastegi.
type Options struct {
GracefulShutdown bool
AppName string
EventHandlers []EventHandler
Ctx context.Context
}
// Option of Vabastegi.
type Option func(options *Options)
// WithGraceFullShutdown used if you need gracefully shutdown for your application.
func WithGraceFullShutdown(active bool) Option {
return func(options *Options) {
options.GracefulShutdown = active
}
}
// WithAppName provide appName for
func WithAppName(appName string) Option {
return func(options *Options) {
options.AppName = appName
}
}
// WithEventHandlers register event handlers for vabastegi events.
func WithEventHandlers(handlers ...EventHandler) Option {
return func(options *Options) {
options.EventHandlers = append(options.EventHandlers, handlers...)
}
}
// WithContext used if you need to pass custom context.
func WithContext(ctx context.Context) Option {
return func(options *Options) {
options.Ctx = ctx
}
}