Documentation ¶
Overview ¶
Package dirloader provides a loader based on the local directory to load some resources.
Index ¶
- type DirLoader
- func (l *DirLoader[T]) Load() (resources []T, etag string, err error)
- func (l *DirLoader[T]) Resource() *resource.Resource[[]T]
- func (l *DirLoader[T]) SetDecoder(decode func(data []byte, dst any) error) *DirLoader[T]
- func (l *DirLoader[T]) SetEtagEncoder(encode func(changed time.Time) string) *DirLoader[T]
- func (l *DirLoader[T]) Sync(ctx context.Context, rsctype string, interval time.Duration, ...)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DirLoader ¶
type DirLoader[T any] struct { // contains filtered or unexported fields }
DirLoader is used to load the resources from the files in a directory.
func (*DirLoader[T]) Load ¶
Load scans the files in the directory, loads and returns them if changed.
func (*DirLoader[T]) SetDecoder ¶ added in v0.2.0
SetDecoder sets the resource decoder.
func (*DirLoader[T]) SetEtagEncoder ¶ added in v0.4.0
SetEtagEncoder sets the etag encoder.
Click to show internal directories.
Click to hide internal directories.