loader

package
v1.20.57 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Zlib Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JsonFormat = "json"
	XmlFormat  = "xml"
	YamlFormat = "yaml"
)

Variables

View Source
var ErrNotDefined = errors.New("not defined")

Functions

func JSON added in v1.6.10

func JSON(filename string, data 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 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) Data added in v1.8.65

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

func (*Loader) Get deprecated

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

Deprecated: this function simply calls [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) WatchChan added in v1.8.64

func (load *Loader) WatchChan() <-chan bool

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)

func (*Loader) YAML added in v1.8.65

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

Jump to

Keyboard shortcuts

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