textualize/core/Document/DocumentGroup.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

38 lines
865 B
Go

package document
import "textualize/entities"
type Group entities.Group
type GroupCollection entities.GroupCollection
var groupCollectionInstance *GroupCollection
func GetGroupCollection() *GroupCollection {
if groupCollectionInstance == nil {
groupCollectionInstance = &GroupCollection{}
}
return groupCollectionInstance
}
func SetGroupCollection(collection GroupCollection) *GroupCollection {
groupCollectionInstance = &collection
return groupCollectionInstance
}
func (collection *GroupCollection) AddDocumentGroup(group entities.Group) {
collection.Groups = append(collection.Groups, group)
}
func (collection *GroupCollection) GetGroupById(groupId string) *entities.Group {
var foundGroup *entities.Group
for index, g := range collection.Groups {
if g.Id == groupId {
foundGroup = &collection.Groups[index]
}
}
return foundGroup
}