modifier

package module
v0.0.0-...-1ad5a9a Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2022 License: Apache-2.0 Imports: 22 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllowMysqlAES

func AllowMysqlAES() bool

func NewAesConverter

func NewAesConverter(dbName string) gust.Option[*AesConverter]

func QueryDbName

func QueryDbName(db QueryRow) (string, error)

func RegisterAesTable

func RegisterAesTable(db *sql.DB, tableName, aesKey string, aesColumnNames []string) error

RegisterAesTable Register mysql table field information that requires automatic encryption and decryption

Types

type AesConverter

type AesConverter struct {
	*TabCtx
}

func (*AesConverter) ConvertDml

func (a *AesConverter) ConvertDml(sql string) (string, error)

func (*AesConverter) ConvertDmlAst

func (a *AesConverter) ConvertDmlAst(stmt ast.StmtNode) error

func (*AesConverter) ExpandWildcard

func (a *AesConverter) ExpandWildcard(tableName string, addAlias bool) []string

func (*AesConverter) ToDecryptedJoinConditions

func (a *AesConverter) ToDecryptedJoinConditions(tableName, join string) (string, error)

func (*AesConverter) ToDecryptedSelectFields

func (a *AesConverter) ToDecryptedSelectFields(tableName string, hadSelectPrefix bool, selectFields ...string) ([]string, error)

func (*AesConverter) ToDecryptedWhereConditions

func (a *AesConverter) ToDecryptedWhereConditions(tableName, cond string, hadWherePrefix bool) (string, error)

type DbInfo

type DbInfo struct {
	DbName     string
	TableInfos sync.Map // *TableInfo
	// contains filtered or unexported fields
}

func (*DbInfo) GetAesTable

func (a *DbInfo) GetAesTable(tableName string) gust.Option[*TableInfo]

type FieldInfo

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

type QueryRow

type QueryRow interface {
	QueryRowContext(ctx context.Context, query string, args ...any) *sql.Row
}

type SubConverter

type SubConverter struct {
	*AesConverter
	// contains filtered or unexported fields
}

func (SubConverter) Enter

func (s SubConverter) Enter(n ast.Node) (node ast.Node, skipChildren bool)

func (SubConverter) Leave

func (s SubConverter) Leave(n ast.Node) (node ast.Node, ok bool)

type TabCtx

type TabCtx struct {
	*DbInfo
	// contains filtered or unexported fields
}

type TableInfo

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

func (*TableInfo) EncryptValueNode

func (a *TableInfo) EncryptValueNode(value ast.ExprNode) ast.ExprNode

func (*TableInfo) GetEncryptedColumnValue

func (a *TableInfo) GetEncryptedColumnValue(v any) gust.Result[gust.Option[string]]

func (*TableInfo) IsAes

func (a *TableInfo) IsAes() bool

func (*TableInfo) IsAesField

func (a *TableInfo) IsAesField(fieldName string) bool

Jump to

Keyboard shortcuts

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