Silly idea I had
This commit is contained in:
25
provider.go
25
provider.go
@@ -5,6 +5,23 @@ import "html/template"
|
||||
// Provider is an object which provides extra functionality to an environment.
|
||||
type Provider any
|
||||
|
||||
// Configurable is an object that can be configured according to metadata.
|
||||
type Configurable interface {
|
||||
Provider
|
||||
// Configure uses config to configure the object. It must not modify
|
||||
// config. Keys are namespaced with a '.' and are written in kebab case.
|
||||
Configure (config Meta) error
|
||||
}
|
||||
|
||||
// ConfigProcessor is an object that can alter the environment configuration
|
||||
// before other providers are configured in order to provide a sort of macro
|
||||
// system.
|
||||
type ConfigProcessor interface {
|
||||
// ProcessConfig analyzes and makes necessary changes to config. Unlike
|
||||
// Configurable.Configure, it can modify config.
|
||||
ProcessConfig (config Meta) error
|
||||
}
|
||||
|
||||
// FuncProvider provides a template.FuncMap.
|
||||
type FuncProvider interface {
|
||||
Provider
|
||||
@@ -21,11 +38,3 @@ type FuncProviderFor interface {
|
||||
// may return nil, in which case its result is simply not considered.
|
||||
FuncMapFor (*Document) template.FuncMap
|
||||
}
|
||||
|
||||
// Configurable is an object that can be configured according to metadata.
|
||||
type Configurable interface {
|
||||
Provider
|
||||
// Configure uses config to configure the object. It must not modify
|
||||
// config. Keys are namespaced with a '.' and are written in kebab case.
|
||||
Configure (config Meta) error
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user