Pipeline
Perform the pipeline of creating an insert statement. The 'insertee' is the case class on which the SQL insert statement is based. The schema is based on the EntityQuery which could potentially be an unquoted QuerySchema.
Perform the pipeline of creating an insert statement. The 'insertee' is the case class on which the SQL insert statement is based. The schema is based on the EntityQuery which could potentially be an unquoted QuerySchema.
Type members
Classlikes
Is the assignment list know at compile time or only runtime?
Is the assignment list know at compile time or only runtime?
Inherited classlikes
Value members
Concrete methods
Note that the only reason Parser is needed here is to pass it into parseInsertee. The batch pipeline driven by createFromPremade currently doesn't need it.
Note that the only reason Parser is needed here is to pass it into parseInsertee. The batch pipeline driven by createFromPremade currently doesn't need it.
Create a static or dynamic quotation based on the state. Wrap the expr using some additional functions if we need to. This is used for the createFromPremade if we need to wrap it into insertReturning which is used for batch-returning query execution.
Create a static or dynamic quotation based on the state. Wrap the expr using some additional functions if we need to. This is used for the createFromPremade if we need to wrap it into insertReturning which is used for batch-returning query execution.
Actually the same as deduceAssignmentsFromCaseClass, but I decided to write
a separate function and comment it extensively since the logic is not simple to
extrapolate.
This function creates a series of assignments
of a elaborated product. However, each assignment just assigns to the identifier
which will be plugged in (i.e. BetaReduced) once the Ident is actually substituted.
E.g. if we have something like this: val ip = quote { (p: Person) => query[Person].insert(p) }
and then later: run(ip(lift(Person("Joe",123))))
then the assignments list is just based
on the p
identifier of the ip
quoted function i.e:
(v:Person) => v.firstName -> p.firstName
this is achived by doing
BetaReduce(v.firstName, v -> p). Later on when ip(lift(Person("Joe",123)))
happens the CaseClass(firstName -> lift(...), age -> lift(...))
comes in and
all the right values are plugged in correctly.
Actually the same as deduceAssignmentsFromCaseClass, but I decided to write
a separate function and comment it extensively since the logic is not simple to
extrapolate.
This function creates a series of assignments
of a elaborated product. However, each assignment just assigns to the identifier
which will be plugged in (i.e. BetaReduced) once the Ident is actually substituted.
E.g. if we have something like this: val ip = quote { (p: Person) => query[Person].insert(p) }
and then later: run(ip(lift(Person("Joe",123))))
then the assignments list is just based
on the p
identifier of the ip
quoted function i.e:
(v:Person) => v.firstName -> p.firstName
this is achived by doing
BetaReduce(v.firstName, v -> p). Later on when ip(lift(Person("Joe",123)))
happens the CaseClass(firstName -> lift(...), age -> lift(...))
comes in and
all the right values are plugged in correctly.
Inserted object can either be static: query[Person].insert(Person("Joe", "Bloggs")) or it can be lifted: query[Person].insert(lift(Person("Joe", "Bloggs")))
Inserted object can either be static: query[Person].insert(Person("Joe", "Bloggs")) or it can be lifted: query[Person].insert(lift(Person("Joe", "Bloggs")))
In the later case, it will become: {{ //Assuming x := Person("Joe", "Bloggs") CaseClassLift( Quoted(ast: CaseClass(name -> lift(idA)), ...), lifts: List(EagerLift(x.name, idA), ...)) ) }}
For batch queries liftQuery(people).foreach(p => query[Person].insert(p)) it will be just the ast Ident("p")
Parse the input to of query[Person].insert(Person("Joe", "Bloggs")) into CaseClass(firstName="Joe",lastName="Bloggs")
Parse the input to of query[Person].insert(Person("Joe", "Bloggs")) into CaseClass(firstName="Joe",lastName="Bloggs")