Add Audit cababilities. First try on deleteOne
This commit is contained in:
22
audit.go
Normal file
22
audit.go
Normal file
@@ -0,0 +1,22 @@
|
||||
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
|
||||
Reference in New Issue
Block a user