Documentation
¶
Index ¶
- Constants
- func DefaultCopyFunc(r Recordable, h interface{}) error
- func GetHistoryFields(i interface{}) []reflect.StructField
- type Action
- type Config
- type ConfigFunc
- type Context
- type CopyFunc
- type Entry
- type FieldNotFoundError
- type History
- type Option
- type Plugin
- type Recordable
- type Version
- type VersionFunc
Constants ¶
View Source
const ( Tag = "gorm-history" FieldTagObjectID = "objectID" FieldTagVersion = "version" FieldTagAction = "action" )
Variables ¶
This section is empty.
Functions ¶
func DefaultCopyFunc ¶
func DefaultCopyFunc(r Recordable, h interface{}) error
func GetHistoryFields ¶
func GetHistoryFields(i interface{}) []reflect.StructField
Types ¶
type Config ¶
type Config struct {
VersionFunc VersionFunc
CopyFunc CopyFunc
}
type ConfigFunc ¶
type ConfigFunc func(c *Config)
func WithCopyFunc ¶
func WithCopyFunc(fn CopyFunc) ConfigFunc
func WithVersionFunc ¶
func WithVersionFunc(fn VersionFunc) ConfigFunc
type Context ¶
type Context struct {
Object Recordable
History interface{}
Action Action
Scope *gorm.Scope
}
type CopyFunc ¶
type CopyFunc func(r Recordable, h interface{}) error
type Entry ¶
type Entry struct {
Version Version `gorm-history:"version"`
ObjectID uint `gorm:"index" gorm-history:"objectID"`
Action Action `gorm:"type: string" gorm-history:"action"`
}
func (*Entry) SetHistoryAction ¶
func (*Entry) SetHistoryObjectID ¶
func (l *Entry) SetHistoryObjectID(id interface{})
func (*Entry) SetHistoryVersion ¶
type FieldNotFoundError ¶
type FieldNotFoundError struct {
// contains filtered or unexported fields
}
func (FieldNotFoundError) Error ¶
func (e FieldNotFoundError) Error() string
type Plugin ¶
type Plugin struct {
VersionFunc VersionFunc
CopyFunc CopyFunc
// contains filtered or unexported fields
}
type Recordable ¶
type Recordable interface {
CreateHistory() interface{}
}
type VersionFunc ¶
Click to show internal directories.
Click to hide internal directories.