Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
ErrMissingKey = errors.New("missing key - unable to save data")
)
Functions ¶
This section is empty.
Types ¶
type Driver ¶
type Driver struct {
// contains filtered or unexported fields
}
Driver holds the config and interacts with the underlying file store.
func New ¶
New creates a new driver at the given location, and returns a *Driver for further interaction. By default will use teh JSONMarshaler.
type JSONMarshaler ¶
type JSONMarshaler struct {
}
JSONMarshaler uses the JSON file format.
func (JSONMarshaler) GetFileExtension ¶
func (m JSONMarshaler) GetFileExtension() string
func (JSONMarshaler) Marshal ¶
func (m JSONMarshaler) Marshal(v interface{}) ([]byte, error)
func (JSONMarshaler) Unmarshal ¶
func (m JSONMarshaler) Unmarshal(b []byte, v interface{}) error
type Logger ¶
type Logger interface {
Fatal(string, ...interface{})
Error(string, ...interface{})
Warn(string, ...interface{})
Info(string, ...interface{})
Debug(string, ...interface{})
Trace(string, ...interface{})
}
Logger is a generic logger
type Marshaler ¶
type Marshaler interface {
Marshal(interface{}) ([]byte, error)
Unmarshal([]byte, interface{}) error
GetFileExtension() string
}
Marshaler is used to read/write the data
type SimplePlacer ¶
type SimplePlacer struct{}
func (SimplePlacer) GetPath ¶
func (p SimplePlacer) GetPath(key string) string
type YAMLMarshaler ¶
type YAMLMarshaler struct {
}
JSONMarshaler uses the YAML file format.
func (YAMLMarshaler) GetFileExtension ¶
func (m YAMLMarshaler) GetFileExtension() string
func (YAMLMarshaler) Marshal ¶
func (m YAMLMarshaler) Marshal(v interface{}) ([]byte, error)
func (YAMLMarshaler) Unmarshal ¶
func (m YAMLMarshaler) Unmarshal(b []byte, v interface{}) error