...
This commit is contained in:
@@ -2,10 +2,10 @@ module db
|
||||
|
||||
import freeflowuniverse.herolib.data.ourtime
|
||||
import freeflowuniverse.herolib.data.encoder
|
||||
import time
|
||||
|
||||
pub fn (mut self DB) set[T](mut obj T) ! {
|
||||
pub fn (mut self DB) set[T](obj_ T) !T {
|
||||
// Get the next ID
|
||||
mut obj := obj_
|
||||
if obj.id == 0 {
|
||||
obj.id = self.new_id()!
|
||||
}
|
||||
@@ -32,6 +32,8 @@ pub fn (mut self DB) set[T](mut obj T) ! {
|
||||
|
||||
obj.dump(mut e)!
|
||||
self.redis.hset(self.db_name[T](), obj.id.str(), e.data.bytestr())!
|
||||
|
||||
return obj
|
||||
}
|
||||
|
||||
// return the data, cannot return the object as we do not know the type
|
||||
|
||||
Reference in New Issue
Block a user