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