Clean the request process

Remove paginated
Remove Entity classes
Add Annotation for serialize object
rename selectOne/selectMultiple to execute
This commit is contained in:
2023-04-06 21:03:15 +02:00
parent 7d39dcf248
commit a7e66ab8b5
31 changed files with 380 additions and 1212 deletions

View File

@@ -26,10 +26,10 @@ data class Inventor(
val id: UUID = UUID.randomUUID(),
val name: String,
val roles: List<String> = listOf(),
): Serializable
)
// Select one entity
val result: Inventor? = connection.selectOne(
val result: Inventor = connection.execute(
"""
SELECT json_build_object(
'id', '9e65de49-712e-47ce-8bf2-dfffae53a82e',
@@ -40,7 +40,7 @@ val result: Inventor? = connection.selectOne(
)
// Select multiple entities
val result = connection.select<List<Inventor>>(
val result = connection.execute<List<Inventor>>(
"""
SELECT json_build_array(
json_build_object(
@@ -60,7 +60,7 @@ val result = connection.select<List<Inventor>>(
)
// Select multiple with real query
val result: List<Inventor> = connection.select(
val result: List<Inventor> = connection.execute(
"""
select json_agg(i)
from inventor i
@@ -71,7 +71,7 @@ val result: List<Inventor> = connection.select(
// Select multiple with only some rows
val result: List<Inventor> = connection.select(
val result: List<Inventor> = connection.execute(
"""
select json_agg(i)
from (