Giter Club home page Giter Club logo

Comments (8)

csummers avatar csummers commented on July 24, 2024

That is strange. contains? should only be accessing the params hashmap, not the actual value for the key it's looking for.

Where does your execute! function come from? What does it look like? Is it possibly unpacking the sql-args?

from hugsql.

rcanepa avatar rcanepa commented on July 24, 2024

First, I define queries which contains a map with all database functions:

(def queries
  (hugsql/map-of-db-fns "sql/events.sql"))

Then, I use the executeQuery function as a wrapper of this piece of code ((-> queries query :fn) db args):

;; executeQuery comes from another namespace
(s/defn executeQuery
  [queries :- {s/Keyword s/Any}
   db :- ConnectionMap
   query :- s/Keyword
   args :- {s/Keyword s/Any}]
  ((-> queries query :fn) db args))

And execute! is just executeQuery curried (with the queries):

(def execute! (partial executeQuery queries))

I will go back to test on version 0.4 because I am pretty sure it was working before. Give me a couple of minutes.

from hugsql.

rcanepa avatar rcanepa commented on July 24, 2024

Nevermind, I forgot that map-of-db-fns was added on version 0.4.1.

from hugsql.

rcanepa avatar rcanepa commented on July 24, 2024

Curtis, I am not having this issue with version 0.4.1.

from hugsql.

csummers avatar csummers commented on July 24, 2024

I'm having trouble duplicating your issue:

user=> (require '[hugsql.core :as hugsql])
nil
user=> (hugsql/sqlvec "insert into test (:i*:fields) values (:v*:values)" {:fields ["id","uuid","name"] :values [1 (java.util.UUID/randomUUID) "Bo"]})
["insert into test ( id, uuid, name ) values ( ?,?,? )" 1 #uuid "dd09cde2-8966-413d-b756-c1dd328e2002" "Bo"]

from hugsql.

rcanepa avatar rcanepa commented on July 24, 2024

Ok. Let me double check that if change to version 0.4.2 without touching anything it will break again.

from hugsql.

rcanepa avatar rcanepa commented on July 24, 2024

Curtis, now I am a bit confused. For some reason, moving back to version 0.4.1 and then up to 0.4.2 solved the problem. In between I executed lein clean, could be related to that?

Anyway, thanks for you time!

from hugsql.

csummers avatar csummers commented on July 24, 2024

Maybe? I've had to do a few lein clean in my time to fix strange behavior. Glad you worked it out. I'm glad to see you and others using HugSQL in depth. I like how you're using map-of-db-fns and Schema together.

from hugsql.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.