file

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContentInfo

type ContentInfo struct {
	Content string
	Path    string
}

ContentInfo holds the content of a file and its path.

type Options

type Options struct {
	Paths      []string `json:"paths"      yaml:"paths"`
	Extensions []string `json:"extensions" yaml:"extensions"`
	Watch      bool     `json:"watch"      yaml:"watch"`
	Enabled    bool     `json:"enabled"    yaml:"enabled"`
}

Options defines the configuration for the file provider.

type Provider added in v0.10.0

type Provider struct {
	OnChanged provider.ChangeFunc
	// contains filtered or unexported fields
}

Provider implements a configuration provider that reads from the local filesystem.

func NewProvider

func NewProvider(opts Options) *Provider

NewProvider creates a new FileProvider instance.

func (*Provider) Add added in v0.10.0

func (p *Provider) Add(path string)

Add adds a path to the file provider.

func (*Provider) Open added in v0.10.0

func (p *Provider) Open() ([]*ContentInfo, error)

Open reads all files from the configured paths and returns their content.

func (*Provider) Reset added in v0.10.0

func (p *Provider) Reset()

Reset clears the paths in the file provider.

func (*Provider) SetOnChanged added in v0.10.0

func (p *Provider) SetOnChanged(changeFunc provider.ChangeFunc)

SetOnChanged sets the callback function to be called when a file changes.

func (*Provider) Watch added in v0.10.0

func (p *Provider) Watch() error

Watch starts watching the configured paths for changes.

Jump to

Keyboard shortcuts

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