groostav
02/10/2017, 11:08 PMwhere
function would take an AST representation of the body --effectively it takes source code, and then transcompiles the AST for it.name == "bob"
into WHERE c.name == bob
, of the equivalent mongo thing (iirc something resembling {"where" { eq { field { "fname" }, "bob" }}
6 replies
what your describing is effectively breaking the AST down through some of the nifty reflection mechanisms built into kotlin --the fact that Model::fname
is trivially converted to a KProperty
is a really cool feature, but it doesn't go anywhere near far enough imho. When you get into queries of even minimal sophistication this is going to get ulgy