textualize/storage/Local/GroupDriver.go
Yehoshua Sandler c49f8e4d07
refact: generalized back end structs (#1)
* refact: generalized back end structs

* refact: fixed front end type, removed dead code

* removed test image folder

* refact: removed dead structs
2023-05-26 19:23:35 -05:00

23 lines
665 B
Go

package storage
import (
"encoding/json"
"textualize/entities"
)
func (d LocalDriver) WriteGroupCollection(collection entities.GroupCollection, projectName string) bool {
jsonData, _ := json.MarshalIndent(collection, "", " ")
writeError := WriteDataToAppDir(jsonData, "/projects/"+projectName+"/", "Groups.json")
return writeError == nil
}
func (d LocalDriver) ReadGroupCollection(projectName string) entities.GroupCollection {
collectionData := entities.GroupCollection{}
readError := AssignFileDataToStruct("/projects/"+projectName+"/Groups.json", &collectionData)
if readError != nil {
return entities.GroupCollection{}
}
return collectionData
}