Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JSONDatabase ¶
type JSONDatabase struct {
// contains filtered or unexported fields
}
func New ¶
func New(dir string, perm os.FileMode) *JSONDatabase
Create a new JSONDatabase in `dir`. Each document that is saved to it will have a file mode of `perm`.
func (*JSONDatabase) List ¶
func (db *JSONDatabase) List() ([]string, error)
Returns a list of all documents' names.
func (*JSONDatabase) Read ¶
func (db *JSONDatabase) Read(name string, document interface{}) (bool, error)
Reads the value at `name`. `document` must be a type that is deserializable from the JSON document `name`, or nil to not deserialize at all. Returns false if a document with `name` does not exist.
func (*JSONDatabase) Write ¶
func (db *JSONDatabase) Write(name string, document interface{}) error
Writes `document` to `name`, overwriting a previous document if it exists. `document` must be serializable to JSON.
Click to show internal directories.
Click to hide internal directories.