textualize/storage/Storage.go
Joshua Shoemaker 2963dac8a6 refact: moved storage behind interface
also better read and write methods
2023-03-28 23:50:54 -05:00

32 lines
1010 B
Go

package storage
import (
entity "textualize/storage/Entities"
local "textualize/storage/Local"
)
type Driver interface {
WriteUserData(entity.User) bool
ReadUserData() entity.User
WriteProjectData(entity.Project) bool
ReadProjectDataByName(string) entity.Project
ReadAllProjects() []entity.Project
WriteDocumentCollection(entity.DocumentCollection, string) bool
ReadDocumentCollection(string) entity.DocumentCollection
WriteGroupCollection(entity.GroupCollection, string) bool
ReadGroupCollection(string) entity.GroupCollection
WriteProcessedTextCollection(entity.ProcessedTextCollection, string) bool
ReadProcessedTextCollection(string) entity.ProcessedTextCollection
WriteProcessedUserMarkdownCollection(entity.ProcessedUserMarkdownCollection, string) bool
ReadProcessedUserMarkdownCollection(string) entity.ProcessedUserMarkdownCollection
}
var driverInstance Driver
func GetDriver() Driver {
if driverInstance == nil {
driverInstance = local.LocalDriver{}
}
return driverInstance
}