Skip to content
Snippets Groups Projects
Commit eba6b368 authored by Xavier Perret's avatar Xavier Perret
Browse files

added method to get transaction from db by id

parent 421bfc14
No related branches found
No related tags found
1 merge request!2added file to separate client function from the server
......@@ -285,12 +285,21 @@ func TestObjectStorage() {
}
}
func IsTransactionInDatabase(objectStorage Blob, trans Transaction) bool {
func GetTransactionInDatabaseById(objectStorage Blob, trans Transaction) Transaction {
db := ReadDatabaseFromBlobStorage(objectStorage)
for _, t := range db {
if t.Id == trans.Id {
return true
return trans
}
}
return Transaction{
Id: "",
Sender: "",
Receiver: "",
Amount: "",
}
}
return false
func IsTransactionInDatabase(objectStorage Blob, trans Transaction) bool {
return GetTransactionInDatabaseById(objectStorage, trans).Id == trans.Id
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment