Comments (7)
I can see this being useful. It could also target usage of clojurescript on node.js and possibly some mobile platforms (e.g., cordova + websql).
Putting this on 0.5.0 since there are several concerns to think through.
from hugsql.
I'm going to take a stab at this sometime this week. If you have some thoughts I would love to hear them.
Clojurescript requires macros to be in their own .clj file, which hopefully means that most of the work revolves around moving some functions around, and making sure the tests run in clojurescript. (this would also require a nodejs sql adapter).
from hugsql.
Still holding out hope that I'll eventually get around to this, but removing from the 0.5.0 milestone for now.
from hugsql.
I've been exploring this idea, and I love to hear from folks what would be needed to get this working. Here's what I had in mind, there are some bits that are not yet obvious to me:
-
Move all the platform specific stuff into an
interop.cljc
namespace.
Effort: easy
Currently, this is mainly around reading files. -
Extend the interface to sql libraries.
Effort: not-easy
Unlike JDBC on the JVM, there is no "one interface" to speak them all. We'd need to create adapters for each of postgres/mysql, etc. I'm also not sure how well PreparedStatements are supported. The format for Postgres drivers (see node-postgres use $1, $2 $3 ...) -
Designing a callback driven API for clojurescript.
effort: not-easy
This would make the cljs version diverge from the java version. In the clojurescript version, we'd need to either return Promises, or perhaps channels. If we're changing the return type, should we even use the same interfaces?
from hugsql.
I looked into this way back when I opened the issue, sadly, I never got the time to pull together a PR.
-
Have you looked at AnyDB? https://www.npmjs.com/package/any-db
-
I believe my adapter for
postgres-async
simply returns channels without any other changes, I don't see why it should work differently when targeting a heavily async runtime: https://gitlab.com/robin.heggelund/hugsql-postgres-async/blob/master/src/hugsql/adapter/postgres_async.clj
from hugsql.
Thanks for the link.
Have you looked at AnyDB? https://www.npmjs.com/package/any-db
Have not, thanks for the link!
I don't see why it should work differently when targeting a heavily async runtime.
Technically it'd work fine. I'm interested in learning about the expectations for the users of the library and wanted to think from the community's perspective. I was thinking the same that core.async would make the most sense.
from hugsql.
Closing this for now. If there ends up being significant interest in the future, I'll reconsider it.
from hugsql.
Related Issues (20)
- Not able to update multiple column values
- Optional null parameters HOT 1
- Way to get generated SQL without executing? HOT 1
- Add support for next.jdbc.sql/insert-multi! HOT 1
- Avoid calling apply in 'hugsql.adapter.clojure-java-jdbc' HOT 5
- Incorrect Arities Shown in Docs for def-fb-fns HOT 1
- HugSql fails during AOT compilation with depstar HOT 4
- Switch to newer groupId of next.jdbc dependency in hugsql-adapter-next-jdbc HOT 1
- How to use a function from the database? HOT 2
- Migration fails if a comment is present on line with semicolon HOT 2
- Babashka support HOT 2
- No comments in doc on mobile? HOT 1
- Using classpath resource sql functions breaks cider HOT 3
- Hugsql 0.5.3 still requires SQL files on uberjar compilation (with leiningen) HOT 1
- strange key with jsonb HOT 3
- Should hugsql switch to next.jdbc by default ? HOT 2
- Cannot look up by UUID HOT 2
- Bulk update? HOT 1
- Inline parameters
- Doesn't work with AOT compilation
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hugsql.