Documentation ¶
Index ¶
- type BasePlug
- func (p *BasePlug) WalkFields(db *gorm.DB, callback func(*gorm.DB, *schema.Field))
- func (p *BasePlug) WalkFieldsByName(db *gorm.DB, callback func(*gorm.DB, *schema.Field))
- func (p *BasePlug) WalkFieldsByTag(db *gorm.DB, callback func(*gorm.DB, *schema.Field))
- func (p *BasePlug) WithFields(fields ...string) *BasePlug
- func (p *BasePlug) WithTag(tag string) *BasePlug
- type CryptoPlug
- func (p *CryptoPlug) Finalize(db *gorm.DB) error
- func (p *CryptoPlug) Initialize(db *gorm.DB) error
- func (p *CryptoPlug) Name() string
- func (p *CryptoPlug) WithDecryptFn(fn func(context.Context, []byte) ([]byte, error)) *CryptoPlug
- func (p *CryptoPlug) WithEncryptFn(fn func(context.Context, []byte) ([]byte, error)) *CryptoPlug
- func (p *CryptoPlug) WithFields(fields ...string) *CryptoPlug
- func (p *CryptoPlug) WithTag(tag string) *CryptoPlug
- type Plug
- type TimePlug
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BasePlug ¶
type BasePlug struct {
// contains filtered or unexported fields
}
func NewBasePlug ¶
func (*BasePlug) WalkFields ¶
WalkFields walks all fields of the model, and call callback. This is a useful method for building a plug, see time.go for example.
func (*BasePlug) WalkFieldsByName ¶
func (*BasePlug) WalkFieldsByTag ¶
func (*BasePlug) WithFields ¶
type CryptoPlug ¶
type CryptoPlug struct { BasePlug // contains filtered or unexported fields }
CryptoPlug is a plug for encrypt / decrypt data. NOTE: The encryptFn and decryptFn must be set, and the target column must be []byte type.
func NewCryptoPlug ¶
func NewCryptoPlug(name ...string) *CryptoPlug
func (*CryptoPlug) Initialize ¶
func (p *CryptoPlug) Initialize(db *gorm.DB) error
func (*CryptoPlug) Name ¶
func (p *CryptoPlug) Name() string
func (*CryptoPlug) WithDecryptFn ¶
func (p *CryptoPlug) WithDecryptFn(fn func(context.Context, []byte) ([]byte, error)) *CryptoPlug
func (*CryptoPlug) WithEncryptFn ¶
func (p *CryptoPlug) WithEncryptFn(fn func(context.Context, []byte) ([]byte, error)) *CryptoPlug
func (*CryptoPlug) WithFields ¶
func (p *CryptoPlug) WithFields(fields ...string) *CryptoPlug
func (*CryptoPlug) WithTag ¶
func (p *CryptoPlug) WithTag(tag string) *CryptoPlug
type TimePlug ¶
type TimePlug struct { BasePlug // contains filtered or unexported fields }
func NewTimePlug ¶
NewTimePlug creates a new time plug, name is optional. If you want to call db.Use() twice, you must set a unique name, otherwise the second call will cause a error by gorm.
func (*TimePlug) WithFields ¶
Click to show internal directories.
Click to hide internal directories.