Improve database storage put method

This commit is contained in:
Daniel 2020-04-15 17:27:33 +02:00
parent 812c1e26c5
commit 558486483b
13 changed files with 56 additions and 45 deletions

View file

@ -44,12 +44,12 @@ func (hm *HashMap) Get(key string) (record.Record, error) {
}
// Put stores a record in the database.
func (hm *HashMap) Put(r record.Record) error {
func (hm *HashMap) Put(r record.Record) (record.Record, error) {
hm.dbLock.Lock()
defer hm.dbLock.Unlock()
hm.db[r.DatabaseKey()] = r
return nil
return r, nil
}
// PutMany stores many records in the database.