layerware / hugsql

A Clojure library for embracing SQL
https://hugsql.org
Apache License 2.0
690 stars 54 forks source link

Support for namespaced keywords #56

Closed sebastianpoeplau closed 5 years ago

sebastianpoeplau commented 7 years ago

As far as I understand, HugSQL doesn't currently support namespace-qualified keywords:

> (hugsql.core/sqlvec "SELECT :test/value" {:test/value 42 :test 5})
["SELECT ? /value" 5]

(The expected result would be ["SELECT ?" 42], I guess.)

I think it would be very helpful to be able to process namespaced keywords, especially with the advent of clojure.spec. Are there any known obstacles to handling them? I would try to implement what is needed but wanted to check for known issues or objections first...

csummers commented 7 years ago

@sebastianpoeplau I think this is a good idea, and I've known it's coming with spec in Clojure 1.9.

We'll have to look at any possible clashes with / in SQL for division. The result may just be "you must have a space after a keyword to use /". If that's the case, adding / as a valid symbol character to the parser is the start for this:

https://github.com/layerware/hugsql/blob/master/hugsql-core/src/hugsql/parser.clj#L29

sebastianpoeplau commented 7 years ago

Great, I'll look into it.

jbethune commented 7 years ago

Any news on this? Sadly neither YeSQL nor HugSQL support this.

sebastianpoeplau commented 7 years ago

The code has been proposed via #57, which for some reason is not linked here...

abeluck commented 5 years ago

Is there a workaround for this these days? And is there a reason the PR hasn't been merged?

csummers commented 5 years ago

This has been merged in and modified to continue to allow the deep-get syntax. This will ship in 0.5.0 soon.

csummers commented 5 years ago

This is released in 0.5.0.