-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmodule.go
More file actions
29 lines (26 loc) · 783 Bytes
/
module.go
File metadata and controls
29 lines (26 loc) · 783 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
package alice
// Module is a marker interface for structs that defines how to initialize instances.
type Module interface {
// IsModule indicates if this is a module.
IsModule() bool
}
// BaseModule is an implementation of Module interface. It should be embedded into each module defined in the
// application.
//
// A typical module is defined as follows:
//
// type ExampleModule struct {
// alice.BaseModule
// Foo Foo `alice:""` // associated by type
// Bar Bar `alice:"Bar"` // associated by name
// URL string // not associated. Provided by creating the module.
// }
//
// func (m *ExampleModule) Baz() Baz {
// return Baz{}
// }
type BaseModule struct{}
// IsModule indicates it is a module.
func (b *BaseModule) IsModule() bool {
return true
}