2019-05-31 01:11:13 +03:00
|
|
|
// Package reader parses change sets and provides config values
|
|
|
|
package reader
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
2020-08-19 17:47:17 +03:00
|
|
|
"github.com/unistack-org/micro/v3/config/source"
|
2019-05-31 01:11:13 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
// Reader is an interface for merging changesets
|
|
|
|
type Reader interface {
|
|
|
|
Merge(...*source.ChangeSet) (*source.ChangeSet, error)
|
|
|
|
Values(*source.ChangeSet) (Values, error)
|
|
|
|
String() string
|
|
|
|
}
|
|
|
|
|
|
|
|
// Values is returned by the reader
|
|
|
|
type Values interface {
|
|
|
|
Bytes() []byte
|
|
|
|
Get(path ...string) Value
|
2020-01-11 23:50:09 +03:00
|
|
|
Set(val interface{}, path ...string)
|
|
|
|
Del(path ...string)
|
2019-05-31 01:11:13 +03:00
|
|
|
Map() map[string]interface{}
|
|
|
|
Scan(v interface{}) error
|
|
|
|
}
|
|
|
|
|
|
|
|
// Value represents a value of any type
|
|
|
|
type Value interface {
|
|
|
|
Bool(def bool) bool
|
|
|
|
Int(def int) int
|
|
|
|
String(def string) string
|
|
|
|
Float64(def float64) float64
|
|
|
|
Duration(def time.Duration) time.Duration
|
|
|
|
StringSlice(def []string) []string
|
|
|
|
StringMap(def map[string]string) map[string]string
|
|
|
|
Scan(val interface{}) error
|
|
|
|
Bytes() []byte
|
|
|
|
}
|