TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Show HN: fluent SQL – a minimalistic SQL builder for Java

35 点作者 ivanceras将近 12 年前
A minimalistic Fluent SQL API for Java built with one compilation unit aimed to resemble the code to your original SQL code

11 条评论

cpfohl将近 12 年前
Very slick. My only suggestion is to allow a bit more terseness by adding static versions of all the calls that can happen at the beginning of the Query. The static versions would just create a new SQL object and pass the call on to the SQL object&#x27;s call.<p>Instead of:<p><pre><code> new SQL().SELECT_ALL() </code></pre> You could have Query.SELECT_ALL()<p>Ideally Java would be cool with having Static and non-Static methods with identical signatures and names, but alas, looks like a static class Query or whatever would be the way to do this.
评论 #6025019 未加载
评论 #5957575 未加载
jhh将近 12 年前
This looks very similar to jOOQ in my first impression. <a href="http://www.jooq.org/" rel="nofollow">http:&#x2F;&#x2F;www.jooq.org&#x2F;</a><p>I wonder if the author was aware of the existence of jOOQ?
评论 #5957313 未加载
评论 #5959077 未加载
zeroDivisible将近 12 年前
This is opinion only, so please don&#x27;t take this as me being negative: I really like the idea, but there&#x27;s one thing which need to happen for this to be upstream.<p>Most decent IDE&#x27;s (Idea and few others) are clever enough to understand the SQL between quotation marks and if connected to database will give you instant errors if something is incorrect - misspelled names, missing commas, etc. Sometimes this can be a big time saver.
grandpoobah将近 12 年前
I wrote something like this for C# just yesterday as I couldn&#x27;t find an sql builder with a real fluent interface. I found one which pretended to be fluent by returning itself after each method call, but that completely misses the point, because you want each call to create a mutation but leave the original in tact. That allows me to build a query using all of the WHEREs and then branch it off into two separate queries.. one for COUNT and one to select the actual data.<p>Just wondering.. did you create this to be used in the read layer of a DDD&#x2F;CQS based system?<p>Edit: actually looking at the source it appears this one is similar to the one i saw in C# where each call just returns the same builder rather than a new version
评论 #6025024 未加载
ww520将近 12 年前
Looks cool. I love DSL style API for chaining calls. Make it so simple.
steve_barham将近 12 年前
I don&#x27;t like this. I&#x27;m strongly of the opinion that SQL is a beautiful language, able to express in terse yet readable statements operations which would take many pages of Java to execute. Why try and wrap it up, and pretend that you are writing Java, when you&#x27;re still writing SQL?<p>Please don&#x27;t take this as a dig at you or your code - everyone has an itch to scratch, and I&#x27;m quite sure writing this was fun.
评论 #5957302 未加载
评论 #5957980 未加载
评论 #6025429 未加载
评论 #5957181 未加载
评论 #5957345 未加载
andrewcooke将近 12 年前
is anyone wants something similar for c, i am looking for beta users (users that are happy with a beta release, not users less impressive than alpha users...) of c-orm, which includes (a very minimal version of) this - <a href="https://bitbucket.org/isti/c-orm/wiki/SQL#markdown-header-conditional-statements" rel="nofollow">https:&#x2F;&#x2F;bitbucket.org&#x2F;isti&#x2F;c-orm&#x2F;wiki&#x2F;SQL#markdown-header-co...</a>
mimog将近 12 年前
Nice, but anyone needing something like this should probably consider looking at jooq.
jkrasnay将近 12 年前
Looks cool! I wrote a similar library that&#x27;s been working out well in my projects:<p><a href="https://github.com/jkrasnay/sqlbuilder" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;jkrasnay&#x2F;sqlbuilder</a>
time4tea将近 12 年前
Hmm looks a bit like Squiggle SQL, <a href="http://code.google.com/p/squiggle-sql/" rel="nofollow">http:&#x2F;&#x2F;code.google.com&#x2F;p&#x2F;squiggle-sql&#x2F;</a> but less
评论 #5958054 未加载
icedchai将近 12 年前
Looks cool, but personally I&#x27;d rather just use regular SQL.
评论 #5957385 未加载