22 lines
479 B
Go
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 |