-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to store Types like Atom using couchdb-erlfdb. #45
Comments
That's correct, I see at least a couple of options for handling a broader spectrum of data types: User-Specific Type CodesThe FDB Tuple spec reserves a set of type codes for user-specific data types that do not map directly to one of the supported data types already defined in the spec. We could choose to allocate type codes within that space to support other Erlang data types. For example, we could declare that Ignore Tuple Layer for ValuesAlternatively, your application could decide that every Value your app stores with FoundationDB is encoded with Eshell V12.1.4 (abort with ^G)
1> DB = erlfdb:open().
{erlfdb_database,#Ref<0.289576361.3161587713.93177>}
2> Key = erlfdb_tuple:pack({<<"foo">>, 123}).
<<1,102,111,111,0,21,123>>
3> erlfdb:set(DB, Key, term_to_binary(hello)).
ok
4> erlfdb:get(DB, Key).
<<131,100,0,5,104,101,108,108,111>>
5> binary_to_term(erlfdb:get(DB, Key)).
hello You'll see I still used the Tuple encoding for Keys, as it's carefully designed for proper sorting that's essential to most data modeling techniques in FoundationDB. |
Hi, I'm coming again.
The problem is that I would like to store tuples into FoundationDB.
But it seems it won't work fine if I want to store tuples with atom() in it to FoundaitonDB.
#{context => {invalid_tuple_term,message},exception => error,stacktrace => [{erlfdb_tuple,encode,2,[{file,"er│me has already been fetched lfdb_tuple.erl"},{line,258}]}
Furthermore, If I want to store types other than binary(), the only way seems to be call
erlfdb_tuple:pack()
?Any advice if I want store arbitrary type in foundationdb? That will help a lot.
The text was updated successfully, but these errors were encountered: