Closed warmwaffles closed 3 years ago
I think that is worthwhile to add. I can't think of a great way to do it off the top of my head, though.
One idea:
exqlite
a list of modules that subscribe to some interface, a method of which could be called to get the path to the relevant .so
or .dll
that is created during module compilation. The user would add those hex libraries as dependency and wire them up to the exqlite
app. The exqlite
app would then ensure that at db-open time that the connection also loads the relevant extension(s)Given that all we need, in the end, is a path to the .so
file and a way of telling exqlite
about it, there may be a way to do it with almost no Elixir code at all. Looks like :code.priv_dir
gets us that.
So maybe something like:
Application.put_env(:exqlite, :load_extensions, ["#{:code.priv_dir(:exqlite_unicode_ext)}/ext.so"])
With there being a convention in this scenario, I guess, of making the name of the .so
or .dll
always ext
, or perhaps the package name itself.
So all the package would need to do is to compile the extension more or less and ensure it outputs a library file to the correct location in priv/
.
I want to look into loading an extension or two from this following repository
https://github.com/nalgeon/sqlite-plus
Specifically the unicode upper and lower support. But I would love to figure out if we can support extension loading and maybe ship a way to load them. Whether it be through adding an extra dependency something like
exqlite_unicode_ext
that we provide some loading hooks.Thoughts at @kevinlang ?