modules

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2023 License: MIT Imports: 1 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Module

type Module interface {
	Connect(refreshC chan Module)
	Exists(key string) bool
	Get(key string) any
	GetKeys() []string
	GetOptions() *Options

	GetRefreshedValue(key string) any
	Load()
	Deconstruct()
}

type ModuleBase

type ModuleBase struct {
	RefreshC chan Module
	Flatmap  map[string]interface{}
	RWTex    sync.RWMutex
	Options  *Options
}

func NewSourceBase

func NewSourceBase(options *Options) *ModuleBase

Used by external Sources

func (*ModuleBase) Connect

func (module *ModuleBase) Connect(refreshC chan Module)

Used by Configuration

func (*ModuleBase) Exists

func (module *ModuleBase) Exists(key string) bool

Checks if a key exists

func (*ModuleBase) Get

func (module *ModuleBase) Get(key string) (value interface{})

Get Config Values

func (*ModuleBase) GetKeys

func (module *ModuleBase) GetKeys() (result []string)

func (*ModuleBase) GetOptions

func (module *ModuleBase) GetOptions() *Options

func (*ModuleBase) NotifyDirtyness

func (module *ModuleBase) NotifyDirtyness(externalSource Module)

type Options

type Options struct {
	Optional        bool
	ReloadOnChange  bool
	Delimiter       string
	SentinelOptions *SentinelOptions
}

type RefreshPolicy

type RefreshPolicy int
const (
	RefreshAll RefreshPolicy = iota
	RefreshCurrentAndOver
	RefreshCurrentAndUnder
	RefreshCurrent
)

type SentinelOptions

type SentinelOptions struct {
	Key           string
	RefreshPolicy RefreshPolicy
}

Directories

Path Synopsis
files module
usersecrets module

Jump to

Keyboard shortcuts

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