micro/init/init.go

22 lines
513 B
Go
Raw Normal View History

2019-06-06 13:32:38 +03:00
// Package init is an interface for initialising options
package init
2019-06-06 13:46:13 +03:00
// Options is used for initialisation
type Options interface {
2019-06-06 13:32:38 +03:00
// Initialise options
Init(...Option) error
// Options returns the current options
2019-06-06 13:46:13 +03:00
Options() Options
2019-06-06 13:32:38 +03:00
// Value returns an option value
Value(k interface{}) (interface{}, bool)
// The name for who these options exist
String() string
}
2019-06-06 13:46:13 +03:00
// NewOptions returns a new initialiser
func NewOptions(opts ...Option) Options {
o := new(defaultOptions)
o.Init(opts...)
return o
2019-06-06 13:32:38 +03:00
}