gitee.com/liuxuezhan/go-micro-v1.18.0@v1.0.0/config/reader/reader.go (about)

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