Giter VIP home page Giter VIP logo

Comments (3)

caibirdme avatar caibirdme commented on July 24, 2024

过长的sql语句还是建议用NamedQuery自己来写,因为如果你用map[string]interface{}来描述太长的sql语句,你作为用户几乎不太可能能确信gendry最终帮你生成的sql语句是什么。NamedQuery可以在任何时候使用,NamedQuery("select * from table_foo where age > {{age}} and MATCH(col_bar) AGAINST({{keyword}} IN BOOLEAN MODE)", map[string]interface{}{"age":5,"keyword":"xxx"}) 这种并不比map[string]interface{}写起来更复杂吧?
我认为map[string]interface{}适合用来描述简单的、可以用and连接起来的sql语句,剩下的还是建议使用namedquery

from gendry.

chenbaiyu0414 avatar chenbaiyu0414 commented on July 24, 2024

在某些场景下,要根据条件的不同在SQL里and上不同的语句,这个时候NameQuery里的SQL可能还是需要大量的进行手动拼接,而当这种需求和较长的sql语句撞车,就只有求助于手动拼接SQL了,gendry无法解决

from gendry.

caibirdme avatar caibirdme commented on July 24, 2024

我理解你的需求了,你最终的sql语句可能需要根据上下文才能确定要哪些where条件,但是又是一个比较复杂的语句对吧。我们会认真考虑要不要做上这个功能,但是目前你还是只能先用NamedQuery手动拼接一下。等我们确定好了开发计划,会reopen这个issue

from gendry.

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.