backends

package
v0.0.0-...-63c5a8c Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrClientAlreadyExists = errors.New("client already exists")
)

Functions

func Register

func Register(name string, p int, f NewClientFunc) error

Types

type BackupConfig

type BackupConfig struct {
	DirPath     string
	AutoEnabled bool `toml:"auto"`
	MaxFiles    int  `toml:"max"`
}

type Client

type Client interface {
	Load() (data []byte, err error)
	Save(data []byte) error
	Backup() error
	SafeLocation() string
	IsWritable() bool
	SetWritable(writable bool) error
	Lock() error
	Unlock() error
}

func New

func New(config *Config) (Client, error)

func NewWithType

func NewWithType(t string, config *Config) (Client, error)

type Config

type Config struct {
	Type     string                 `toml:"type"`
	Backup   BackupConfig           `toml:"backup"`
	Settings map[string]interface{} `toml:"settings"`
}

func NewDefaultConfig

func NewDefaultConfig() Config

type NewClientFunc

type NewClientFunc func(c *Config) (Client, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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