Closed bchavez closed 8 years ago
@epsitec: New release of the C# driver now allows you to serialize ReQL Expressions. v2.3.6-beta-1
now available on NuGet.
Driver documentation on the new feature is here: https://github.com/bchavez/RethinkDb.Driver/wiki/Extra-C%23-Driver-Features#serializing-reql-expressions. :v:
@bchavez thank you again. We build the package from source code; we currently need a signed assembly to integrate it into our project, so it's easier to do that from source rather than post-signing the NuGet output.
Important chat from slack to avoid losing history on the subject.
@bchavez: Hello, I sort of have an odd question regarding
Func
and the scope ofVarId
. It refers to a question proposed to me last night: https://rethinkdb.slack.com/archives/general/p1466483600000840The basic idea is taking a ReQL expression, (like
ReqlFunction1 filter = expr => expr["Bar"].Gt(2);
) seralizing it into a string, sending it over a network to a server, then deserializing the string back into something that can be used in the final query across an application boundary.I was able to pull this off with some hackery, but then I remembered the C# and Java driver keep
VarId
state in the driver which is the crux of my questions.A more concrete example:
In somewhat human readable form, the serialized expression looks like:
filterTerm
in the final query is of typeReqlRaw
.ReqlRaw
a unique pseudo term that injects the raw protocol string into the final query. So, the final query looks like this:And it works yo. :scream_cat: And so, some questions about that
VAR,[1]
... because I can foresee some danger ahead...var,[1]
within theFUNC
term only? or isVAR
scoped over the entire query?Filters
:otherFilterTerm
could haveVAR,[1]
same asfilterTerm
also, but would that interfere with the firstfilterTerm
?VAR
only named by integer? or could it be a named variable? Like:[VAR,["someNameInsteadOfINT"]]
?I guess what I'm trying to understand the danger if
FUNC
VAR
ids can interfere with each other if two expressions are used within the same query (but in different AST terms). Eah. I don't know if I'm making any sense.Cool driver feature nonetheless, if we can pull it off without danger.
@mlucy [12:51 PM]
@bchavez [12:56 PM]
@mlucy [1:00 PM]: The basic problem is if someone does something like: (ruby code,
x
isReqlExpr
)And then they write:
If
sequence
andcontains
both generated the same number for their variable, this wouldn't do what you expect.@bchavez [1:03 PM]
@mlucy [1:03 PM]
@bchavez [1:14 PM]
@mlucy [5:47 PM]
@epsitec [9:33 PM]
@bchavez [9:38 PM]
@epsitec [9:42 PM]
@bchavez [9:52 PM]
@bchavez: would you think it possible to inject the
string
into theFilter()
method? (edited)@bchavez [10:00 PM]
@epsitec [10:00 PM]
@epsitec [10:01 PM]
@bchavez [10:03 PM]
@epsitec [10:05 PM]
@bchavez [10:35 PM]
@bchavez [11:08 PM]