Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuditLog ¶
type AuditLog struct {
ID uint `gorm:"primaryKey" json:"id"`
UserID uint `gorm:"index;not null;default:0" json:"user_id"`
Action string `gorm:"size:50;not null;index" json:"action"`
ModelType string `gorm:"size:100;not null;index" json:"model_type"`
ModelID uint `gorm:"not null;index" json:"model_id"`
OldValues string `gorm:"type:text" json:"old_values,omitempty"`
NewValues string `gorm:"type:text" json:"new_values,omitempty"`
Metadata string `gorm:"type:text" json:"metadata,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
AuditLog records a single auditable action on a model.
type Entry ¶
type Entry struct {
UserID uint
Action string
ModelType string
ModelID uint
OldValues map[string]interface{}
NewValues map[string]interface{}
Metadata map[string]interface{}
}
Entry holds the data for a single audit log record.
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger writes audit log entries to the database.
func (*Logger) Find ¶
Find returns audit log entries matching the given conditions, ordered newest first. Conditions use GORM Where syntax: Find("user_id = ?", 42).
Click to show internal directories.
Click to hide internal directories.