At this point you may be reading and thinking "WTF", but fear not, it all makes sense.
At this point you may be reading and thinking "WTF", but fear not, it all makes sense. Every call to a "value method" will generate a new Insert Query, but the list of statements in the new query will include a new (String, String) pair, where the first part is the column name and the second one is the serialised value. This is a very simple accumulator that will eventually allow calling the "insert" method on a queryBuilder to produce the final serialisation result, a hopefully valid MySQL insert query.
The SQL primitive or rather it's Scala correspondent to use at this time.
The insert condition is a pair of a column with the value to use for it. It looks like this: value(_.someColumn, someValue), where the assignment is of course type safe.
The object is the value to use for the column.
The primitive is the SQL primitive that converts the object into an SQL Primitive. Since the user cannot deal with types that are not "marked" as SQL primitives for the particular database in use, we use a simple context bound to enforce this constraint.
The first evidence parameter is a restriction upon the Type phantom type and it tests if the Query is an Insert query. This prevents the user from jumping around with the implicit conversion mechanism and converting an Update query to an implicit and so on. It also allows us to guarantee the MySQL syntax is followed with respect to what methods are available on certain types of queries, all with a single Query class.
The second evidence parameter is a restriction upon the status of a Query. Certain "exit" points mark the serialisation as Terminated with respect to the SQL syntax in use. It's a way of saying: there are no further options possible according to the DB you are using.
A new InsertQuery, where the list of statements in the Insert has been chained and updated for serialisation.