loader

package
v0.8.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 20, 2022 License: Zlib Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoModified = errors.New("file not modified")

Functions

func DecodeJson

func DecodeJson(data Data, r io.Reader) error

func DecodeXml

func DecodeXml(data Data, r io.Reader) error

func DecodeYaml

func DecodeYaml(data Data, r io.Reader) error

Types

type Cache

type Cache struct {
	Loader
	// contains filtered or unexported fields
}

type Data

type Data interface{}

func LoadFile

func LoadFile(path string, lastModifyTime int64, decoder DecodeFunc) (int64, Data, error)

type DecodeFunc

type DecodeFunc func(r io.Reader) (Data, error)

type Filer

type Filer struct {
	Loader
	// contains filtered or unexported fields
}

type Http added in v0.4.6

type Http struct {
	Loader
	// contains filtered or unexported fields
}

type LoadFunc

type LoadFunc func() (Data, error)

type Loader

type Loader struct {
	// contains filtered or unexported fields
}

func New

func New() *Loader

func NewCache

func NewCache(key string, rds redis.Client, data Data) *Loader

func NewFiler

func NewFiler(path string, format string, data Data) *Loader

func NewHttp added in v0.4.6

func NewHttp(url string, data Data, headFunc commonhttp.HeaderFunc) *Loader

func (*Loader) Get

func (load *Loader) Get() Data

func (*Loader) JSON

func (load *Loader) JSON() (string, error)

func (*Loader) Read

func (load *Loader) Read() (error, bool)

func (*Loader) Reset added in v0.5.1

func (load *Loader) Reset()

func (*Loader) Stop

func (load *Loader) Stop()

func (*Loader) Update added in v0.5.1

func (load *Loader) Update(async bool)

func (*Loader) Watch

func (load *Loader) Watch()

func (*Loader) WithCmd added in v0.4.2

func (load *Loader) WithCmd(cmd string) *Loader

func (*Loader) WithLoadFunc

func (load *Loader) WithLoadFunc(l LoadFunc) *Loader

func (*Loader) WithPublisher

func (load *Loader) WithPublisher(p bus.Publisher) *Loader

func (*Loader) WithSecond

func (load *Loader) WithSecond(second time.Duration) *Loader

func (*Loader) WithTopic added in v0.4.2

func (load *Loader) WithTopic(topic string) *Loader

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL