Giter VIP home page Giter VIP logo

Comments (4)

jingyugao avatar jingyugao commented on August 27, 2024

ok,I use column alias. Though not so convenient,it works.

from gendry.

caibirdme avatar caibirdme commented on August 27, 2024
for example:
  where := map[string]interface{}{
	"_orderby":          "IFNULL(I_VALUE,0) DESC, I_ID DESC",
	"_limit":            []uint{0, 1},
}
query, args, err := builder.BuildSelect("src_table", where, []string{"I_ID,I_VALUE"})
if err != nil {
	return
}
err = db.Select(&ret, query, args...)

in this case,gendry will split the "," in function "IFNULL".

Sorry for the inconvenience. Gendry splits the comma for the sake of supporting grammar like this colA asc,colB desc. But if taking function call into consideration, it will become extremely complicated and hard to implement, we must parse it into an AST in advance, by doing so can we understand the meaning of each parts.
For sql like this, I recommend you'd better use builder.NamedQuery to write sql manually

from gendry.

caibirdme avatar caibirdme commented on August 27, 2024

One of the advantages Gendry has is that, it's non-intrusive. Which means if something gendry not support, you can write sql manually, which, in fact, won't cost you too much time . It just a tool which help you construct sql, and do nothing else.

from gendry.

jingyugao avatar jingyugao commented on August 27, 2024

One of the advantages Gendry has is that, it's non-intrusive. Which means if something gendry not support, you can write sql manually, which, in fact, won't cost you too much time . It just a tool which help you construct sql, and do nothing else.

Thanks a lot.

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.