github.com/annwntech/go-micro/v2@v2.9.5/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  	"github.com/annwntech/go-micro/v2/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  	Set(val interface{}, path ...string)
    22  	Del(path ...string)
    23  	Map() map[string]interface{}
    24  	Scan(v interface{}) error
    25  }
    26  
    27  // Value represents a value of any type
    28  type Value interface {
    29  	Bool(def bool) bool
    30  	Int(def int) int
    31  	String(def string) string
    32  	Float64(def float64) float64
    33  	Duration(def time.Duration) time.Duration
    34  	StringSlice(def []string) []string
    35  	StringMap(def map[string]string) map[string]string
    36  	Scan(val interface{}) error
    37  	Bytes() []byte
    38  }