package darkstorm import "errors" var ( ErrNotFound = errors.New("no matches found in table") ) type IDStruct interface { GetID() string } type Table[T IDStruct] interface { Get(ID string) (data T, err error) Find(values map[string]any) ([]T, error) Insert(data T) error Remove(ID string) error FullUpdate(ID string, data T) error PartUpdate(ID string, update map[string]any) error } type CrashTable interface { Table[CrashReport] // Move a crash type to archive. All instances that perfectly match that appear in CrashReport.Individual should be deleted. // If a CrashReport ends up with an empty Individual array it should also be deleted. Archive(ArchivedCrash) IsArchived(IndividualCrash) bool // Add the IndividualCrash report to the crash table. If a CrashReport exists that matches, then it gets added to CrashReport.Individual. // If an IndividualCrash exists that is a perfect match, Count is incremented instead of adding it to the array. InsertCrash(IndividualCrash) error }