kit

package
v0.0.49 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

ProviderSet 汇总 kratos-kit 脱敏运行时适配器。

Functions

This section is empty.

Types

type RedactPolicyResolver

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

RedactPolicyResolver 将 Admin 入库和出库策略转换为运行时策略。

func NewRedactPolicyResolver

func NewRedactPolicyResolver(databases map[string]*kitgorm.Client) (*RedactPolicyResolver, error)

NewRedactPolicyResolver 构造默认数据库仓储和空缓存,迁移完成后须调用 Initialize。

func (*RedactPolicyResolver) Initialize

func (r *RedactPolicyResolver) Initialize(ctx context.Context) error

Initialize 在迁移和密钥初始化完成后、数据库开始处理业务请求前加载策略并绑定回调。 同一实例成功后重复调用无副作用;失败可重试,同一数据库的初始化必须串行执行。

func (*RedactPolicyResolver) ListStoragePolicies

func (r *RedactPolicyResolver) ListStoragePolicies(ctx context.Context, tableName string) []redact.StorageFieldPolicy

ListStoragePolicies 返回默认数据源的入库策略,仅在初始化成功后自动刷新缓存。

func (*RedactPolicyResolver) Refresh

func (r *RedactPolicyResolver) Refresh(ctx context.Context) error

Refresh 从数据库刷新启用的入库和出库策略。

func (*RedactPolicyResolver) Resolve

func (r *RedactPolicyResolver) Resolve(ctx context.Context, fieldRef string) (redact.FieldPolicy, bool)

Resolve 按接口和 Proto 字段解析出库策略,仅在初始化成功后自动刷新缓存。

type StorageValueStore

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

StorageValueStore 将敏感值旁表仓储适配为运行时存储接口。

func NewStorageValueStore

func NewStorageValueStore(databases map[string]*kitgorm.Client) (*StorageValueStore, error)

NewStorageValueStore 使用默认数据库构造旁表仓储,不执行数据库查询。

func (*StorageValueStore) Delete

func (s *StorageValueStore) Delete(ctx context.Context, value *redact.StorageValue) error

Delete 物理删除旁表敏感值。

func (*StorageValueStore) DeleteWithDB

func (s *StorageValueStore) DeleteWithDB(ctx context.Context, db *gorm.DB, storagePolicyID, recordID int64) error

DeleteWithDB 使用当前 GORM 事务物理删除旁表敏感值。

func (*StorageValueStore) Find

func (s *StorageValueStore) Find(ctx context.Context, storagePolicyID, recordID int64) (*redact.StorageValue, error)

Find 查询指定入库策略和业务记录的旁表敏感值。

func (*StorageValueStore) ListByDigest

func (s *StorageValueStore) ListByDigest(ctx context.Context, storagePolicyID int64, digest []byte) ([]*redact.StorageValue, error)

ListByDigest 按入库策略和查询摘要查找业务记录。

func (*StorageValueStore) ListByRecords

func (s *StorageValueStore) ListByRecords(ctx context.Context, storagePolicyID int64, recordIDs []int64) ([]*redact.StorageValue, error)

ListByRecords 批量查询指定入库策略和业务记录的旁表敏感值。

func (*StorageValueStore) Save

Save 保存或更新旁表敏感值。

func (*StorageValueStore) SaveWithDB

func (s *StorageValueStore) SaveWithDB(ctx context.Context, db *gorm.DB, value *redact.StorageValue) error

SaveWithDB 使用当前 GORM 事务保存旁表敏感值。

Jump to

Keyboard shortcuts

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