df3fe83c5f
Change Log to Count Added option to get user count Moved functions to VerifyHeader Added user delete
39 lines
1.2 KiB
Go
39 lines
1.2 KiB
Go
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 CountTable interface {
|
|
Table[CountLog]
|
|
// Remove all Log items that have a CountLog.Date value less then the given value.
|
|
RemoveOldLogs(date int)
|
|
Count(platform string) int
|
|
}
|
|
|
|
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) error
|
|
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
|
|
}
|