Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrMemNoKey = errors.New("no such key in MemData")
ErrMemNoKey occurs when a given key does not exist.
Functions ¶
This section is empty.
Types ¶
type Confy ¶
A Confy is a stupid simple configuration store.
type Data ¶
type Data interface {
// Reader fetches a ReadCloser for the given key.
Reader(key string) (io.ReadCloser, error)
// Writer fetches a WriteCloser for the given key.
Writer(key string) (io.WriteCloser, error)
// Delete removes the given key if it exists.
Delete(key string) error
// Keys returns available keys.
Keys() ([]string, error)
}
Data exposes a storage backend.
func ConfigFileData ¶
ConfigFileData creates a FileData with the given app name and file extension.
func NewFileData ¶
NewFileData creates a FileData with a given base directory and file extension.
type FileData ¶
FileData is a filesystem-based Data.
type Form ¶
type Form interface {
// Marshal encodes the given value into the given Writer.
Marshal(w io.Writer, value interface{}) error
// Unmarshal decodes the given Reader into the given pointer.
Unmarshal(r io.Reader, ptr interface{}) error
}
Form describes an object encoding format.
type JSONForm ¶
type JSONForm struct {
// Marshal options
EscapeHTML bool
Prefix string
Indent string
// Unmarshal options
DisallowUnknownFields bool
UseNumber bool
}
JSONForm is a JSON-based Form, ideal for structured data.
type MemData ¶
type MemData struct {
// contains filtered or unexported fields
}
MemData is a concurrent-safe, in-memory Data.
func (MemData) Delete ¶
Delete removes the given key if it exists - in this case, using internal maps and locks.
Click to show internal directories.
Click to hide internal directories.