loader

package
v1.8.14 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2023 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 JSON added in v1.6.10

func JSON(filename string, data interface{}) error

func LoadFile

func LoadFile(path string, lastModifyTime int64, decoder DecodeFunc) (int64, interface{}, error)

func XML added in v1.6.10

func XML(filename string, data interface{}) error

func YAML added in v1.6.10

func YAML(filename string, data interface{}) error

Types

type Cache

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

func (*Cache) WithCacheLoadFunc added in v1.1.23

func (ca *Cache) WithCacheLoadFunc(fn CacheLoadFunc) *Cache

type CacheLoadFunc added in v1.1.23

type CacheLoadFunc func(dao *dao.Dao, opt *CacheOption) error

type CacheOption added in v1.1.23

type CacheOption struct {
	Key  string
	Data interface{}
}

type DecodeFunc

type DecodeFunc func(v []byte) (interface{}, 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() (interface{}, error)

type Loader

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

func CreateLoader added in v1.3.23

func CreateLoader() Loader

func New

func New() *Loader

func NewCache

func NewCache(key string, dao *dao.Dao, data interface{}) *Loader

func NewFiler

func NewFiler(path string, format string, data interface{}) *Loader

func NewHttp added in v0.4.6

func NewHttp(url string, data interface{}, headFunc commonhttp.HeaderFunc) *Loader

func (*Loader) Get

func (load *Loader) Get() interface{}

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) WithFormat added in v1.0.56

func (load *Loader) WithFormat(format 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

func (*Loader) WithUnmarshal added in v1.0.56

func (load *Loader) WithUnmarshal(l coder.Unmarshal) *Loader

func (*Loader) XML added in v1.6.10

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

Jump to

Keyboard shortcuts

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