Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrMemNoKey = errors.New("no such key in DataMem")
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.
type DataFile ¶ added in v0.4.0
DataFile is a filesystem-based Data.
func ConfigDataFile ¶ added in v0.4.0
ConfigDataFile creates a DataFile with the given app name and file extension.
func NewDataFile ¶ added in v0.4.0
NewDataFile creates a DataFile with a given base directory and file extension.
func (DataFile) Delete ¶ added in v0.4.0
Delete removes the given key if it exists - in this case, using os.Remove.
func (DataFile) Keys ¶ added in v0.4.0
Keys returns available keys - in this case, using os.ReadDir.
type DataMem ¶ added in v0.4.0
type DataMem struct {
// contains filtered or unexported fields
}
DataMem is a concurrent-safe, in-memory Data.
func (DataMem) Delete ¶ added in v0.4.0
Delete removes the given key if it exists - in this case, using internal maps and locks.
func (DataMem) Keys ¶ added in v0.4.0
Keys returns available keys - in this case, using internal maps and locks.
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 FormJSON ¶ added in v0.4.0
type FormJSON struct { // Marshal options EscapeHTML bool Prefix string Indent string // Unmarshal options DisallowUnknownFields bool UseNumber bool }
FormJSON is a JSON-based Form, ideal for structured data.