Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ryarnyah/micronaut-querydsl
QueryDSL SQL support for Micronaut
https://github.com/ryarnyah/micronaut-querydsl
sql
Last synced: 15 days ago
JSON representation
QueryDSL SQL support for Micronaut
- Host: GitHub
- URL: https://github.com/ryarnyah/micronaut-querydsl
- Owner: ryarnyah
- License: apache-2.0
- Created: 2020-12-31T16:08:43.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2021-09-27T19:55:53.000Z (about 3 years ago)
- Last Synced: 2023-06-30T23:03:36.454Z (over 1 year ago)
- Topics: sql
- Language: Kotlin
- Homepage:
- Size: 75.2 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Micronaut-QuerySQL
Micronaut support for [QuerySQL](https://github.com/querydsl/querydsl)
## HowTo To install
```kotlin
dependencies {
//...
implementation("com.github.ryarnyah:micronaut-querydsl:${micronautQueryDslVersion}")
//...
}
```## HowToUse
### Kotlin version
```kotlin
@Singleton
open class TestService(
private val sqlQueryFactory: MicronautSQLQueryFactory
) {
@Transactional
open fun insert(entity: TestData) {
sqlQueryFactory.insert(QTestData.testData).populate(entity).execute()
}
open fun findById(id: String): TestData? {
return sqlQueryFactory.select(QTestData.testData)
.from(QTestData.testData)
.where(QTestData.testData.uid.eq(id))
}
}
```
### Java version
```java
@Singleton
public class TestService {
private final MicronautSQLQueryFactory sqlQueryFactory;public TestService(MicronautSQLQueryFactory sqlQueryFactory) {
this.entityDataStore = entityDataStore;
}@Transactional
public void save(TestData entity) {
sqlQueryFactory.insert(QTestData.testData).populate(entity).execute();
}
public TestData findById(String id) {
return sqlQueryFactory.select(QTestData.testData)
.from(QTestData.testData)
.where(QTestData.testData.uid.eq(id));
}
}
```## Current status
- [X] Add basic micronaut support
- [X] Add Java Support
- [ ] Make more configurable