file

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2023 License: MIT Imports: 6 Imported by: 419

Documentation

Overview

Package file implements a koanf.Provider that reads raw bytes from files on disk to be used with a koanf.Parser to parse into conf maps.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

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

File implements a File provider.

func Provider

func Provider(path string) *File

Provider returns a file provider.

func (*File) Read

func (f *File) Read() (map[string]interface{}, error)

Read is not supported by the file provider.

func (*File) ReadBytes

func (f *File) ReadBytes() ([]byte, error)

ReadBytes reads the contents of a file on disk and returns the bytes.

func (*File) Watch

func (f *File) Watch(cb func(event interface{}, err error)) error

Watch watches the file and triggers a callback when it changes. It is a blocking function that internally spawns a goroutine to watch for changes.

Jump to

Keyboard shortcuts

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