https://github.com/jagedn/querydsl
simple DSL to build SQL sentences
https://github.com/jagedn/querydsl
Last synced: 3 months ago
JSON representation
simple DSL to build SQL sentences
- Host: GitHub
- URL: https://github.com/jagedn/querydsl
- Owner: jagedn
- License: gpl-3.0
- Created: 2016-02-09T12:20:59.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-02-16T08:45:48.000Z (over 10 years ago)
- Last Synced: 2025-03-02T16:48:43.056Z (over 1 year ago)
- Language: Groovy
- Size: 65.4 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# QueryDSL
simple DSL to build SQL sentences
## Usage
```groovy
def queryDSL = QueryDSL.build {
select 'a.field1, a.field2'
from 'mytable a'
where{
and{
eq "a.field1", 501
}
}
innerJoin "table2 b" on "a.field1" eq "b.field1"
groupBy 1
}
String select = queryDSL.SQL
Sql sqlSelect = new Sql(dataSource)
println sqlSelect.rows(sqlSelect)
String countResources = queryDSL.CountSQL
Sql sqlCount = new Sql(dataSource)
println sqlCount.firstRow(countResources)
```