merge github.com/SysLabIT/scribble
This commit is contained in:
parent
40c88ff105
commit
a5b2727275
@ -162,7 +162,6 @@ func (d *Driver) Read(collection, resource string, v interface{}) error {
|
|||||||
func read(record string, v interface{}) error {
|
func read(record string, v interface{}) error {
|
||||||
|
|
||||||
b, err := ioutil.ReadFile(record + ".json")
|
b, err := ioutil.ReadFile(record + ".json")
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -180,11 +179,14 @@ func (d *Driver) ReadAll(collection string) ([][]byte, error) {
|
|||||||
return nil, ErrMissingCollection
|
return nil, ErrMissingCollection
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
dir := filepath.Join(d.dir, collection)
|
dir := filepath.Join(d.dir, collection)
|
||||||
os.MkdirAll(dir, 0777)
|
os.MkdirAll(dir, 0777)
|
||||||
|
|
||||||
// check to see if collection (directory) exists
|
// read all the files in the transaction.Collection; an error here just means
|
||||||
if _, err := stat(dir); err != nil {
|
// the collection is either empty or doesn't exist
|
||||||
|
files, err := ioutil.ReadDir(dir)
|
||||||
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user