archivist

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2023 License: BSD-3-Clause Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const EnvName_ConfGroup = "WATCHER_CONF_GROUP"
View Source
const EnvName_ConfSubgroup = "WATCHER_CONF_SUBGROUP"

Variables

View Source
var (
	ErrUpgradeNeeded = fmt.Errorf("%s", "configuration upgrade needed")
)
View Source
var (
	ResolveI18n func(lang, key string) string
)

Functions

func ConfGroup

func ConfGroup() string

func ConfSubgroup

func ConfSubgroup() string

func Dump

func Dump(c Collection, outputDir string) error

func MustHaveConfGroup

func MustHaveConfGroup()

Types

type Archivist

type Archivist struct {
	slog.Logger
	// contains filtered or unexported fields
}

func NewArchivist

func NewArchivist(opts ...Option) *Archivist

func (*Archivist) FindCollection

func (this *Archivist) FindCollection(version string) (Collection, error)

func (*Archivist) LoadCollection

func (this *Archivist) LoadCollection(newCollection func() interface{}, overwrites ...Overwrite) (Collection, error)

func (*Archivist) PatchCollection

func (this *Archivist) PatchCollection(coll Collection, overwrites ...Overwrite) (Collection, error)

func (*Archivist) SetCurrentCollection

func (this *Archivist) SetCurrentCollection(c Collection)

type Collection

type Collection interface {
	CompatibleVersions() []string
	Filename2Conf() map[string]interface{}
	RevRefGraph() map[string][]string
	BindRefs() error
	FixPointers()
}

type CollectionWrapper

type CollectionWrapper struct {
	Collection
	// contains filtered or unexported fields
}

type I18n

type I18n string

func (I18n) I18n

func (s I18n) I18n(lang string) string

func (I18n) Sprintf

func (s I18n) Sprintf(lang string, a ...interface{}) (string, error)

type Option

type Option func(arch *Archivist)

func WithBlacklist

func WithBlacklist(blacklist []string) Option

func WithLogger

func WithLogger(log slog.Logger) Option

func WithReloadCallback

func WithReloadCallback(f func(newC, oldC Collection) error) Option

func WithRoot

func WithRoot(root string) Option

func WithWhitelist

func WithWhitelist(whitelist []string) Option

type Overwrite

type Overwrite struct {
	FileLevel bool
	Target    string
	Data      []byte
}

Jump to

Keyboard shortcuts

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