Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ToSnakeCase = toSomeCase("_")
Functions ¶
func ToLowerFirst ¶ added in v1.3.0
Types ¶
type ChangeLog ¶
type ChangeLog struct {
ID string `gorm:"type:uuid;primary_key;"`
CreatedAt time.Time `sql:"DEFAULT:current_timestamp"`
Action string
ObjectID string `gorm:"index"`
ObjectType string `gorm:"index"`
RawObject JSONB `sql:"type:JSONB"`
RawMeta JSONB `sql:"type:JSONB"`
Object interface{} `sql:"-"`
Meta interface{} `sql:"-"`
}
ChangeLog is a main entity, which used to log changes.
type Interface ¶
type Interface interface {
// Meta should return structure, that can be converted to json.
Meta() interface{}
// enable/disable loggable
Enable(v bool)
// contains filtered or unexported methods
}
Interface is used to get metadata from your models.
type LoggableModel ¶
type LoggableModel struct {
Disabled bool `sql:"-"`
}
LoggableModel is a root structure, which implement Interface. Embed LoggableModel to your model so that Plugin starts tracking changes.
func (LoggableModel) Enable ¶
func (l LoggableModel) Enable(v bool)
func (LoggableModel) Meta ¶
func (LoggableModel) Meta() interface{}
type Option ¶ added in v1.3.0
type Option func(options *options)
func LazyUpdate ¶
func RegMetaType ¶
func RegObjectType ¶
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
func (*Plugin) GetLastRecord ¶
Click to show internal directories.
Click to hide internal directories.