Loading single struct field #179
-
I am writing a chat small chat program and want to load the members of a room without getting other data.
Can I save it in one value were I do something like |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
When you serialize a struct, it's just a blob of bytes, the storage engine doesn't understand it.
(# being the NULL terminator). Then you get the room (without members) using |
Beta Was this translation helpful? Give feedback.
When you serialize a struct, it's just a blob of bytes, the storage engine doesn't understand it.
You'll need to separate your entities, and design key prefixes to sort them:
r#{room_id} => ROOM_DATA
m#{room_id}#{member_id} => MEMBER_DATA
(# being the NULL terminator).
Then you get the room (without members) using
db.get("r#room25")
and the members usingdb.prefix("m#room25#")