reader.go 902 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. // Package reader parses change sets and provides config values
  2. package reader
  3. import (
  4. "time"
  5. "gogs.baozhida.cn/zoie/OAuth-core/config/source"
  6. )
  7. // Reader is an interface for merging changesets
  8. type Reader interface {
  9. Merge(...*source.ChangeSet) (*source.ChangeSet, error)
  10. Values(*source.ChangeSet) (Values, error)
  11. String() string
  12. }
  13. // Values is returned by the reader
  14. type Values interface {
  15. Bytes() []byte
  16. Get(path ...string) Value
  17. Set(val interface{}, path ...string)
  18. Del(path ...string)
  19. Map() map[string]interface{}
  20. Scan(v interface{}) error
  21. }
  22. // Value represents a value of any type
  23. type Value interface {
  24. Bool(def bool) bool
  25. Int(def int) int
  26. String(def string) string
  27. Float64(def float64) float64
  28. Duration(def time.Duration) time.Duration
  29. StringSlice(def []string) []string
  30. StringMap(def map[string]string) map[string]string
  31. Scan(val interface{}) error
  32. Bytes() []byte
  33. }