config.go 455 B

123456789101112131415161718192021222324252627
  1. package stdout
  2. import (
  3. "errors"
  4. "github.com/BurntSushi/toml"
  5. )
  6. type Config struct {
  7. Name string `tome:"name"`
  8. }
  9. func (c *Config) ConfigValidate() (error) {
  10. if c == nil {
  11. return errors.New("config of Stdout Output is nil")
  12. }
  13. return nil
  14. }
  15. func DecodeConfig(md toml.MetaData, primValue toml.Primitive) (c interface{}, err error) {
  16. c = new(Config)
  17. if err = md.PrimitiveDecode(primValue, c); err != nil {
  18. return nil, err
  19. }
  20. return c, nil
  21. }