Giter Club home page Giter Club logo

Comments (5)

arichiardi avatar arichiardi commented on July 24, 2024 1

I 👍 to this, especially the pluggable middleware would make HugSql even more powerful than it is now.
I call (cske/transform-keys csk/->kebab-case ...) after each query call and at the moment it is not easy to hook it up automatically being vars interned by a macro.
I was thinking of using robert-hooke for automating the process...

from hugsql.

csummers avatar csummers commented on July 24, 2024

This is a duplicate of #21, which has details on how you can use HugSQL's return flag hooks to implement case-converting and hyphen/dash-converting versions for query results.

You could likewise do the same for incoming parameter types, but you can already use hyphenated keywords within your SQL: select * from test where id = :my-hyphenated-id

from hugsql.

csummers avatar csummers commented on July 24, 2024

I'm still not totally opposed to adding some kind of option that would allow users to define this behavior when calling def-db-fns. Your additional request adds some support for that eventually happening.

from hugsql.

katox avatar katox commented on July 24, 2024

Thanks for hint to result-fn, I didn't get it from the docs.

Maybe some kind of transformation middleware would be good for this. With clojure.spec around the corner there should be a bump in popularity of namespaced keywords too.

Not quite sure how to access information bits from a query but something like

    "select building.*, site.name from building, site where building.site_id = site.id"
    ==> { :building/id 1
          :building/name "tower"
          :building/long-name "City Tower"
          :site/name "Big City" }

would be really useful.

from hugsql.

LukasRychtecky avatar LukasRychtecky commented on July 24, 2024

Hi @katox you can create an adapter for this. And I did it see https://github.com/druids/hugsql-adapter-case

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.