From 87e0213b065d306a56451e911d79896bcf38e1b1 Mon Sep 17 00:00:00 2001 From: jilen Date: Thu, 12 Dec 2024 15:38:00 +0800 Subject: [PATCH] use quote --- src/main/scala/minisql/dsl.scala | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/src/main/scala/minisql/dsl.scala b/src/main/scala/minisql/dsl.scala index c566cf3..58f452c 100644 --- a/src/main/scala/minisql/dsl.scala +++ b/src/main/scala/minisql/dsl.scala @@ -23,17 +23,6 @@ extension [E](inline e: EntityQuery[E]) { } } -extension [A, B](inline f1: A => B) { - private inline def param0 = parsing.parseParamAt(f1, 0) - private inline def body = parsing.parseBody(f1) -} - -extension [A1, A2, B](inline f1: (A1, A2) => B) { - private inline def param0 = parsing.parseParamAt(f1, 0) - private inline def param1 = parsing.parseParamAt(f1, 1) - private inline def body = parsing.parseBody(f1) -} - private inline def transform[D1 <: Quoted, D2 <: Quoted, A, B](inline ast: Ast)( inline f: A => B )(inline fast: (Ast, Ident, Ast) => Ast)(inline f2: Ast => D2): D2 = { @@ -79,6 +68,13 @@ private def compileImpl(x: Expr[Quoted])(using Quotes): Expr[Option[String]] = { } } -case class Foo(id: Long) +extension [A, B](inline f1: A => B) { + private inline def param0 = parsing.parseParamAt(f1, 0) + private inline def body = parsing.parseBody(f1) +} -inline def queryFooId = query[Foo]("foo").map(_.id) +extension [A1, A2, B](inline f1: (A1, A2) => B) { + private inline def param0 = parsing.parseParamAt(f1, 0) + private inline def param1 = parsing.parseParamAt(f1, 1) + private inline def body = parsing.parseBody(f1) +}