完成数据库敏感信息的加密 close #127 close #46

This commit is contained in:
dushixiang
2021-04-17 20:00:02 +08:00
parent bceda9a95c
commit 8f22ecfb76
5 changed files with 18 additions and 71 deletions

View File

@ -243,11 +243,6 @@ func (r AssetRepository) UpdateActiveById(active bool, id string) error {
return r.DB.Exec(sql, active, id).Error
}
func (r AssetRepository) EncryptedById(encrypted bool, password, privateKey, passphrase, id string) error {
sql := "update assets set encrypted = ?, password = ?,private_key = ?, passphrase = ? where id = ?"
return r.DB.Exec(sql, encrypted, password, privateKey, passphrase, id).Error
}
func (r AssetRepository) DeleteById(id string) error {
return r.DB.Where("id = ?", id).Delete(&model.Asset{}).Error
}

View File

@ -192,8 +192,3 @@ func (r CredentialRepository) FindAll() (o []model.Credential, err error) {
err = r.DB.Find(&o).Error
return
}
func (r CredentialRepository) EncryptedById(encrypted bool, password, privateKey, passphrase, id string) error {
sql := "update assets set encrypted = ?, password = ?,private_key = ?, passphrase = ? where id = ?"
return r.DB.Exec(sql, encrypted, password, privateKey, passphrase, id).Error
}