-
Notifications
You must be signed in to change notification settings - Fork 3
/
interface.go
57 lines (44 loc) · 1.25 KB
/
interface.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
package larago
import "github.com/urfave/cli"
// Bootstrapper function.
type Bootstrapper func(application *Application) error
// ServiceProvider interface.
type ServiceProvider interface {
// Register service.
Register(application *Application)
}
// ExitHandler provides interface to handle application exits and panic throws.
type ExitHandler interface {
// Exit application gracefully with message and code.
Exit(message string, exitCode int)
// Defer handles panics.
Defer()
}
// SignalsHandler provides interface to handle system signals.
type SignalsHandler interface {
// CatchInterrupt handles sigterm.
CatchInterrupt()
}
// Kernel interface.
type Kernel interface {
// Handle console command.
Handle()
// SetBootstrappers sets Application bootstrappers.
SetBootstrappers(bootstrappers ...Bootstrapper)
}
// ConsoleCommand interface.
type ConsoleCommand interface {
// GetCommand for the cli to register.
GetCommand() cli.Command
// Handle command.
Handle(args cli.Args) error
}
// ConfigLoader is a callback function for lazy loading application config.
type ConfigLoader func() Config
// Config interface.
type Config interface {
// Env returns current environment name.
Env() string
// Debug returs debug mode state.
Debug() bool
}