thank you for the hint, but I don’t think that I again need to learn how to implement a calculator using yecc, I think I still remember what I studied in the early '90s.
I do think I need to understand how to combine clauses (field operator value) with bool-operators, with the goal to get a single Ecto.Query.BooleanExpr
which I would then put in a one-element list, and feed to a Ecto.Query
as its wheres
value.
let’s agree that it’s not viable, building an Elixir struct form Erlang, but the impression at the moment is that we’re postponing the action without mentioning the tools needed to perform it.
I need to construct an Ecto.Query
value.
this contains one Ecto.Query.FromExpr
value, one Ecto.Query.SelectExpr
(a list of fields), a list of Ecto.Query.JoinExpr
, each associated to a Ecto.Query.QueryExpr
, and one Ecto.Query.BooleanExpr
, all of which I need to construct, none of which I know how to construct with a proper exposed API. my interpretation is detailed in another thread, and I did not understand whether I can do that, or which otherwise which would be the way to go.
I don’t mind constructing values in Erlang, nor limiting Erlang to building a structure that I would later translate to the Elixir value, but I still do not know how (for example) given this query string:
location.code = "GH2" or accession.code = "2018.0044"
which I have no trouble at all translating into:
or == . location code "GH2" == . accession code "2018.0044"
(or (== (. location code) "GH2") (== (. accession code) "2018.0044"))
it’s still not clear how I get to my target value:
%Ecto.Query.BooleanExpr{
op: :and,
expr:
{:or, [], [
{:==, [], [
{{:., [], [{:&, [], [2]}, :code]}, [], []},
"GH2"]},
{:==, [], [
{{:., [], [{:&, [], [1]}, :code]}, [], []},
"2018.0044"]}]}}]}
as said: “for example”.