Sqlite
Closed this issue · 2 comments
Is there a method for connecting to the android/ios sqlite db?
I'm afraid there's not an official capacitor plugin for that so I'm not planning to include it in this crate.
However there is a community plugin which seems to do what you want and you could write the rust bindings yourself. I'm happy to help with this and I've written some tips below.
I'm also potentially open to having a second crate with bindings for the more popular community plugins. I do fear, however, that such a thing would be a nightmare to maintain.
I will probably write a guide for how to do the bindings yourself, but very broadly my advice is to do the following:
- install capacitor following the instructions in the readme of this crate
- install the community plugin following its instructions
- go through the API of the plugin and write rust bindings for all the methods. See this file for examples of what this looks like
- write functions that call those methods using idiomatic rust (basically, you don't want the user to have to see any
JsValue
s). This is an example of how I've done this. You probably need to copy/paste my wholehelpers.rs
file as unfortunately all the useful methods in it are pub (crate)
That's the best I can do I'm afraid. If you do try to write the bindings yourself and run into any problems (or succeed with ease and want to brag) please let me know.
Good info! I may end up taking you up on that.