mirror of
https://github.com/Floriansylvain/GoAntiSqlPOC.git
synced 2026-08-19 11:43:24 +02:00
feat: update methods & improved demo
This commit is contained in:
@@ -57,3 +57,13 @@ func ListAddressesByUserID(userID string) ([]*Address, error) {
|
||||
})
|
||||
return addresses, err
|
||||
}
|
||||
|
||||
func UpdateAddress(a *Address) error {
|
||||
data, err := json.Marshal(a)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return GetDB().Update(func(txn *badger.Txn) error {
|
||||
return txn.Set([]byte(addressPrefix+a.ID), data)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user