This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-10-28
Channels
- # aws (5)
- # aws-lambda (1)
- # beginners (133)
- # boot (1)
- # cljsrn (1)
- # clojure (28)
- # clojure-austin (3)
- # clojure-italy (2)
- # clojure-spec (17)
- # clojure-uk (18)
- # clojurescript (38)
- # cursive (6)
- # datomic (6)
- # figwheel (1)
- # graphql (1)
- # klipse (1)
- # leiningen (1)
- # off-topic (13)
- # onyx (30)
- # re-frame (44)
- # reagent (7)
- # shadow-cljs (77)
- # spacemacs (7)
what does it mean by Returns a new coll consisting of to-coll with all of the items of from-coll conjoined? does it iterate over the whole collection or just joining them together?
@h.elmougy remember values are immutable, so you'll receive a new collection with all items conjoined.
There's more detail "under the covers" but you can think of this as a "copy" of the to-coll and from-coll conj'ed into a 3rd collection.
Well, conj of course doesn't join 2 collections, so excuse that part of my explanation.
@h.elmougyif i'm not mistaken you're asking about into
, which does (reduce conj to from)
, so it does iterate
I'm surprised when I see anything other than clojure.java.jdbc used to connect / communicate, but there are many options for DSLs that construct queries
@noisesmith do you write strings for your queries?
no, but I'm 100% certain you shouldn't use the query generating library I use
jdbc is not a query generator, it's a connection library, which is what your question asked for
Any preferences for a library to manage and handle queries and transactions? From the OOP world, something like an ORM?
@itaied Since there are no "objects" in Clojure, there's no need for ORM. clojure.java.jdbc
is the "standard" contrib library for JDBC work -- [org.clojure/java.jdbc "0.7.3"]
is the latest version -- https://github.com/clojure/java.jdbc/ -- community documentation http://clojure-doc.org/articles/ecosystem/java_jdbc/home.html
(disclaimer: I maintain this library)
That library "handles queries and transactions". You have a hash map you want stored in a table? (jdbc/insert! db-spec :table my-hash-map)
Simple as that.
If you want transactions over multiple operations:
(jdbc/with-db-transaction [conn db-spec]
(jdbc/insert! conn :table my-data)
(jdbc/insert! conn :other-table more-data))
If you want a DSL for composing SQL queries, I highly recommend honey-sql
(linked from the community documentation above).
@itaied If you really want something ORM-like in Clojure, check out Korma (also linked from the community documentation above). I thought it had stopped being maintained a long time ago but it appears to have a new maintainer... My experience has been that people quickly run into limitations with Korma and end up dropping it. YMMV.