strategy

package
v0.0.0-...-c188419 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 30, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecryptValue

func DecryptValue(str, key string) string

func EncryptValue

func EncryptValue(str, key string) string

Types

type AesCryptoStrategy

type AesCryptoStrategy struct {
	// contains filtered or unexported fields
}

func NewAesCryptoStrategy

func NewAesCryptoStrategy(secretKey string) *AesCryptoStrategy

func (*AesCryptoStrategy) Decrypt

func (d *AesCryptoStrategy) Decrypt(src string, field *schema.Field, db *gorm.DB) string

func (*AesCryptoStrategy) Encrypt

func (d *AesCryptoStrategy) Encrypt(src string, field *schema.Field, db *gorm.DB) string

func (*AesCryptoStrategy) Name

func (d *AesCryptoStrategy) Name() string

type CryptoStrategy

type CryptoStrategy interface {
	//
	// Name
	//  @Description:  CryptoType Name
	//  @return string crypto type name
	//
	Name() string
	//
	// Encrypt
	//  @Description: encrypt data
	//  @param src
	//  @param field
	//  @param db
	//  @return string encryption value
	//
	Encrypt(src string, field *schema.Field, db *gorm.DB) string
	//
	// Decrypt
	//  @Description: decrypt data
	//  @param src
	//  @param field
	//  @param db
	//  @return string decrypted value
	//
	Decrypt(src string, field *schema.Field, db *gorm.DB) string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL