textualize/storage/Local/ContextGroupDriver.go
Yehoshua Sandler 7dd6de064f
Refactor Context Groups & Area Detection (#4)
* feat: make new connections

* refact: context groups | feat: area detection

and a bunch of small things. hate yourself for this massive commit
2023-09-02 10:58:38 -05:00

23 lines
833 B
Go

package storage
import (
"encoding/json"
"textualize/entities"
)
func (d LocalDriver) WriteContextGroupCollection(serializedContextGroups []entities.SerializedLinkedProcessedArea, projectName string) bool {
jsonData, _ := json.MarshalIndent(serializedContextGroups, "", " ")
writeError := WriteDataToAppDir(jsonData, "/projects/"+projectName+"/", "ContextGroups.json")
return writeError == nil
}
func (d LocalDriver) ReadContextGroupCollection(projectName string) []entities.SerializedLinkedProcessedArea {
contextGroupCollectionData := make([]entities.SerializedLinkedProcessedArea, 0)
readError := AssignFileDataToStruct("/projects/"+projectName+"/ContextGroups.json", &contextGroupCollectionData)
if readError != nil {
return make([]entities.SerializedLinkedProcessedArea, 0)
}
return contextGroupCollectionData
}