dave08
02/12/2025, 4:58 PM@KomapperPartial
that has two parts... the WITH ... before the sql I need to put it in and the actual place I need it in (like adding a JOIN to that WITH, or an ORDER BY by it...). One possibility is having the annotation be able to receive an array of sql parts (using the same parameters in the class they're annotating), and then being able to use it:
@KomapperPartial([
"""....""",
"""...."""
]) data class P(...)
@KomapperCommand("""
/*> p.1 */
....
/*> p.2 */
...
""") data class Q(p: P, ...)...
this would help encapsulate a whole functionality in one partial.Toshihiro Nakamura
02/13/2025, 10:37 PM@KomapperPartial("with x (/*# common.a */, /*# common.b */)")
data class P1(common: Common)
@KomapperPartial("order by /*# common.a */, /*# common.b */")
data class P2(common: Common)
@KomapperCommand("""
/*> p1 */
....
/*> p2 */
...
""")
data class Q(p1: P1, p2: P2)
dave08
02/16/2025, 12:51 PMdave08
02/17/2025, 1:57 PM@KomapperPartial("") // What could I write here...
data class P(p1: P1, p2: P2)
That way they're grouped together, and there's no arrays... I can pass them together to the command using them.dave08
02/17/2025, 1:58 PMdave08
02/17/2025, 2:02 PMToshihiro Nakamura
02/17/2025, 11:19 PM@KomapperPartial(
"""
limit /* value */0
""",
)
data class Limit(val value: Int)
@KomapperPartial(
"""
offset /* value */0
""",
)
data class Offset(val value: Int)
data class Pagination(limit: Limit, offset: Offset)
@KomapperCommand(
"""
select * from address order by address_id
/*> pagination?.limit */
/*> pagination?.offset */
""",
)
class UsePartial(val pagination: Pagination?) : Many<Address>({ selectAsAddress() })
dave08
02/18/2025, 10:15 AMToshihiro Nakamura
02/18/2025, 11:46 AM