Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct{}
Config is the structure that defines your configuration. It should specify JSON tags for easy serialization & deserialization.
func NewConfig ¶
NewConfig will return the custom Config object. The helper `pkgconfig.NewConfig` does the hard work of converting the input from:
- yaml
- json
- Config{}
- &Config{}
into a *Config{} object.
func (*Config) FromJSON ¶
FromJSON will consume JSON and will set the values of the structure to the values provided in the input string.
func (*Config) FromYAML ¶
FromYAML will consume YAML and will set the values of the structure to the values provided in the input string.
func (*Config) Validate ¶
Validate will return validation errors if the configuration has invalid values. NOTE: Make sure to run `WithDefaults()` prior to validation as `nil` (not supplied) values usually are not valid configuration values.
func (Config) WithDefaults ¶
WithDefaults constructs a new Config object and will set any values for any values that are missing. A common practice is to have the member variables of a struct to always be pointers (e.g: *int) so that they can be `nil`, which indicates "not supplied." It would be these `nil` values that will get filled in.
type Filter ¶
type Filter struct{}
Filter is the structure that will implement the `Filter()` interface
func NewFilter ¶
NewFilter takes in a configuration and will create a new `Filter` structure based upon the configuration. NewFilter should validate the configuration and return any config validation errors. `NewConfig` should wrap its returned error in an `InvalidConfigErr` struct, so wrapping it again is not necessary.