Skip to content
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

feature request: Support promises #5

Open
michael-ts opened this issue Nov 25, 2017 · 6 comments
Open

feature request: Support promises #5

michael-ts opened this issue Nov 25, 2017 · 6 comments

Comments

@michael-ts
Copy link

Looks like node-sqlite3 has a wrapper module called node-sqlite which provides promises. However, it seems the hard-code the sqlite3 module. Since cross-sqlcipher is ultimately based on node-sqlite3, maybe some of this effort could be re-used?

@fritx
Copy link
Owner

fritx commented Nov 25, 2017

@michael-ts hi, you mean the promise wrapper has to hard-code some C++ parts?

I used to think that promise wrapper is only some JS wrapper around the library --
for example, we can write a library to wrap all the APIs of it.

@fritx
Copy link
Owner

fritx commented Nov 25, 2017

Sorry for the misunderstanding if exists, I meant I totally agree the feature request.

And my suggestion is to make another library that based on cross-sqlcipher, and provide promise support, is it right?

@michael-ts
Copy link
Author

I mean, in the node-sqlite code it looks like it might do exactly what is wanted, except it is requiring 'sqlite3' instead of 'cross-sqlcipher'. Maybe there is some easy way to "trick" it into requiring 'cross-sqlcipher' instead? If not, I suppose a fork that simply does a string replace would work, but then somebody has to make the effort to detect and sync changes any time node-sqlite is updated.

@fritx
Copy link
Owner

fritx commented Nov 26, 2017

OK got it! Hmm... since the cross-sqlcipher is made to be API-compatible with node-sqlite3,
I suggest that we just set an alias would be a best way!

In web-frontend, we already had some webpack settings to do it (alias),
in node, I guess we can use module-alias or require-alias.

See also: Better local require() paths for Node.js

I was recently doing the exact same thing in my node server stuff!

@fritx
Copy link
Owner

fritx commented Nov 26, 2017

@michael-ts oops, seems I was wrong, 'cause cross-sqlcipher itself depends on node-sqlite3 too,
so an alias won't be the solution.

@fritx
Copy link
Owner

fritx commented Nov 26, 2017

Now what I want to do is to provide a PR to node-sqlite,
which supports a custom sqlite3 argument just like the Promise arg to custom the sqlite3 source.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants