loader

package
v0.0.26 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReloadTypeNone     = "none"
	ReloadTypeFsNotify = "fsnotify"
	ReloadTypeTimer    = "timer"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Loader

type Loader struct {
	AutoReloadType ReloadType `json:"autoReloadType" comment:"none,fsnotify,timer"` // 本地分为Watch和AutoReload,Watch采用系统调用通知,AutoReload定时器去查文件是否变更
	TimerInterval  time.Duration
}

func New

func New() *Loader

New initialize a Loader

func (*Loader) Handle

func (ld *Loader) Handle(handle func([]byte), files ...string) (err error)

Load will unmarshal configurations to struct from files that you provide

func (*Loader) SetAutoReloadType

func (ld *Loader) SetAutoReloadType(autoReloadType ReloadType, interval time.Duration)

type ReloadType

type ReloadType string

Jump to

Keyboard shortcuts

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