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
Add support for serialize/deserialize #95
Comments
Can you give me an example of how would you use this? First time I see those functions. In particular
Either the operations are just available as C functions (which they can happen outside crystal-sqlite3 if needed) or we need some reasonable Crystal api for these operations. An example would be a great starting point. I see there are many options and I am not sure what would be best for the general use case. |
Our use case would be importing/exporting user data from/to a sister app. As an example, here is our current code to import said user data. As you can see, we have to create a file on disk, open it, read the user data, close, and make sure it is deleted. The goal would be to replace that code with something like this: DB.open "sqlite3::memory" do |db|
db.deserialize(file_io) # or maybe this?: sqlite3_deserialize(db, file_io)
watched_raw = db.query_all("SELECT url FROM streams", as: String)
subscriptions_raw = db.query_all("SELECT url FROM subscriptions", as: String)
# The in-memory database is safely closed here
end
# Use the imported data |
Could you please add support for
sqlite3_serialize
andsqlite3_deserialize
?As a downstream app, that would allow us to manipulate database in memory only, removing the need to write data on disk!
The text was updated successfully, but these errors were encountered: