go-micro: github.com/micro/go-micro/config/source Index | Files | Directories

package source

import "github.com/micro/go-micro/config/source"

Package source is the interface for sources


Package Files

changeset.go noop.go options.go source.go


var (
    // ErrWatcherStopped is returned when source watcher has been stopped
    ErrWatcherStopped = errors.New("watcher stopped")

type ChangeSet Uses

type ChangeSet struct {
    Data      []byte
    Checksum  string
    Format    string
    Source    string
    Timestamp time.Time

ChangeSet represents a set of changes from a source

func (*ChangeSet) Sum Uses

func (c *ChangeSet) Sum() string

Sum returns the md5 checksum of the ChangeSet data

type Option Uses

type Option func(o *Options)

func WithEncoder Uses

func WithEncoder(e encoder.Encoder) Option

WithEncoder sets the source encoder

type Options Uses

type Options struct {
    // Encoder
    Encoder encoder.Encoder

    // for alternative data
    Context context.Context

func NewOptions Uses

func NewOptions(opts ...Option) Options

type Source Uses

type Source interface {
    Read() (*ChangeSet, error)
    Write(*ChangeSet) error
    Watch() (Watcher, error)
    String() string

Source is the source from which config is loaded

type Watcher Uses

type Watcher interface {
    Next() (*ChangeSet, error)
    Stop() error

Watcher watches a source for changes

func NewNoopWatcher Uses

func NewNoopWatcher() (Watcher, error)

NewNoopWatcher returns a watcher that blocks on Next() until Stop() is called.


filePackage file is a file source.
memoryPackage memory is a memory source

Package source imports 7 packages (graph) and is imported by 48 packages. Updated 2020-03-30. Refresh now. Tools for package owners.