Files
mongo/audit.go
2026-04-23 13:19:20 -04:00

22 lines
479 B
Go

package mongo
type Op string
const (
OpUpdate Op = "update"
OpDelete Op = "delete"
OpInsert Op = "insert"
OpArchive Op = "archive"
OpRestore Op = "restore"
)
type AuditResult struct {
Op Op `bson:"op" json:"op"`
Entity string `bson:"entity" json:"entity"`
Data any `bson:"data" json:"data"`
Before any `bson:"before" json:"before"`
After any `bson:"after" json:"after"`
Context any `bson:"context" json:"context"`
}
type OnAudit func(audit *AuditResult) error