public Query(QueryType type, long token, ReqlAst term, OptArgs globalOptions) { this.Type = type; this.Token = token; this.Term = term; this.GlobalOptions = globalOptions; }
///<summary> /// "float": "T_BOOL" ///</summary> public Random this[OptArgs optArgs] { get { var newOptArgs = OptArgs.FromMap(this.OptArgs).With(optArgs); return new Random (this.Args, newOptArgs); } }
///<summary> /// "timeout": "T_NUM" ///</summary> public Javascript this[OptArgs optArgs] { get { var newOptArgs = OptArgs.FromMap(this.OptArgs).With(optArgs); return new Javascript (this.Args, newOptArgs); } }
///<summary> /// "default_timezone": "T_STR" ///</summary> public Iso8601 this[OptArgs optArgs] { get { var newOptArgs = OptArgs.FromMap(this.OptArgs).With(optArgs); return new Iso8601 (this.Args, newOptArgs); } }
///<summary> /// "overwrite": "T_BOOL" ///</summary> public IndexRename this[OptArgs optArgs] { get { var newOptArgs = OptArgs.FromMap(this.OptArgs).With(optArgs); return new IndexRename (this.Args, newOptArgs); } }
///<summary> /// "index": "T_STR" ///</summary> public Min this[OptArgs optArgs] { get { var newOptArgs = OptArgs.FromMap(this.OptArgs).With(optArgs); return new Min (this.Args, newOptArgs); } }
///<summary> /// "left_bound": "E_BOUND", /// "right_bound": "E_BOUND" ///</summary> public Slice this[OptArgs optArgs] { get { var newOptArgs = OptArgs.FromMap(this.OptArgs).With(optArgs); return new Slice (this.Args, newOptArgs); } }
///<summary> /// "index": "T_STR" ///</summary> public GetAll this[OptArgs optArgs] { get { var newOptArgs = OptArgs.FromMap(this.OptArgs).With(optArgs); return new GetAll (this.Args, newOptArgs); } }
/// <summary> /// Factory method for FormatOptions from OptArgs /// </summary> public static FormatOptions FromOptArgs(OptArgs args) { var fmt = new FormatOptions(); // TODO: find a better way to do this. ReqlAst datum; var value = args.TryGetValue("time_format", out datum) ? ((Datum)datum).datum : new Datum("native").datum; fmt.RawTime = value.Equals("raw"); value = args.TryGetValue("binary_format", out datum) ? ((Datum)datum).datum : new Datum("native").datum; fmt.RawBinary = value.Equals("raw"); value = args.TryGetValue("group_format", out datum) ? ((Datum)datum).datum : new Datum("native").datum; fmt.RawGroups = value.Equals("raw"); return fmt; }
/// <summary> /// <para>Test if the first value is greater than or equal to other.</para> /// </summary> /// <example><para>Example: Is 2 greater than or equal to 2?</para> /// <code>r.expr(2).ge(2).run(conn, callback) /// </code></example> public Ge (Arguments args, OptArgs optargs) : this(TermType.GE, args, optargs) { }
public Maxval(Arguments args, OptArgs optargs) : base(TermType.MAXVAL, args, optargs) { }
/// <summary> /// <para>Construct a geometry object of type Point. The point is specified by two floating point numbers, the longitude (-180 to 180) and latitude (-90 to 90) of the point on a perfect sphere. See <a href="/docs/geo-support/">Geospatial support</a> for more information on ReQL's coordinate system.</para> /// </summary> /// <example><para>Example: Define a point.</para> /// <code>r.table('geo').insert({ /// id: 1, /// name: 'San Francisco', /// location: r.point(-122.423246,37.779388) /// }).run(conn, callback); /// </code></example> public Point (Arguments args, OptArgs optargs) : base(TermType.POINT, args, optargs) { }
protected IndexRename (TermType termType, Arguments args, OptArgs optargs) : base(termType, args, optargs) { }
/// <summary> /// <para>Create a table. A RethinkDB table is a collection of JSON documents.</para> /// </summary> /// <example><para>Example: Create a table named 'dc_universe' with the default settings.</para> /// <code>r.db('test').tableCreate('dc_universe').run(conn, callback) /// </code></example> public TableCreate (Arguments args, OptArgs optargs) : base(TermType.TABLE_CREATE, args, optargs) { }
/// <summary> /// <para>Insert a value in to an array at a given index. Returns the modified array.</para> /// </summary> /// <example><para>Example: Hulk decides to join the avengers.</para> /// <code>r.expr(["Iron Man", "Spider-Man"]).insertAt(1, "Hulk").run(conn, callback) /// </code></example> public InsertAt (Arguments args, OptArgs optargs) : base(TermType.INSERT_AT, args, optargs) { }
/// <summary> /// <para>Plucks out one or more attributes from either an object or a sequence of objects /// (projection).</para> /// </summary> /// <example><para>Example: We just need information about IronMan's reactor and not the rest of the /// document.</para> /// <code>r.table('marvel').get('IronMan').pluck('reactorState', 'reactorPower').run(conn, callback) /// </code></example> public Pluck (Arguments args, OptArgs optargs) : base(TermType.PLUCK, args, optargs) { }
/// <summary> /// <para>Wait for the specified indexes on this table to be ready, or for all /// indexes on this table to be ready if no indexes are specified.</para> /// </summary> /// <example><para>Example: Wait for all indexes on the table <code>test</code> to be ready:</para> /// <code>r.table('test').indexWait().run(conn, callback) /// </code></example> public IndexWait(Arguments args, OptArgs optargs) : base(TermType.INDEX_WAIT, args, optargs) { }
/// <summary> /// <para>Add a several values to an array and return it as a set (an array with distinct values).</para> /// </summary> /// <example><para>Example: Retrieve Iron Man's equipment list with the addition of some new boots and an arc reactor.</para> /// <code>r.table('marvel').get('IronMan')('equipment').setUnion(['newBoots', 'arc_reactor']).run(conn, callback) /// </code></example> public SetUnion(Arguments args, OptArgs optargs) : base(TermType.SET_UNION, args, optargs) { }
///<summary> /// "emit": "T_FUNC3", /// "final_emit": "T_FUNC1" ///</summary> public Fold OptArg(string key, object val) { var newOptArgs = OptArgs.FromMap(this.OptArgs).With(key, val); return(new Fold(this.Args, newOptArgs)); }
/// <summary> /// <para>Apply a function to a sequence in order, maintaining state via an accumulator. The <code>fold</code> command returns either a single value or a new sequence.</para> /// </summary> /// <example><para>Example: Concatenate words from a list.</para> /// <code>r.table('words').orderBy('id').fold('', function (acc, word) { /// return acc.add(r.branch(acc.eq(''), '', ', ')).add(word); /// }).run(conn, callback); /// </code> /// <para>(This example could be implemented with <code>reduce</code>, but <code>fold</code> will preserve the order when <code>words</code> is a RethinkDB table or other stream, which is not guaranteed with <code>reduce</code>.)</para></example> public Fold(Arguments args, OptArgs optargs) : base(TermType.FOLD, args, optargs) { }
Task <T> IConnection.RunResultAsync <T>(ReqlAst term, object globalOpts, CancellationToken cancelToken) { Query q = PrepareQuery(term, OptArgs.FromAnonType(globalOpts)); return(RunQueryResultAsync <T>(q, cancelToken)); }
/// <summary> /// <para>Return the year of a time object.</para> /// </summary> /// <example><para>Example: Retrieve all the users born in 1986.</para> /// <code>r.table("users").filter(function(user) { /// return user("birthdate").year().eq(1986) /// }).run(conn, callback) /// </code></example> public Year(Arguments args, OptArgs optargs) : base(TermType.YEAR, args, optargs) { }
/// <summary> /// <para>Creates an object from a list of key-value pairs, where the keys must /// be strings. <code>r.object(A, B, C, D)</code> is equivalent to /// <code>r.expr([[A, B], [C, D]]).coerce_to('OBJECT')</code>.</para> /// </summary> /// <example><para>Example: Create a simple object.</para> /// <code>r.object('id', 5, 'data', ['foo', 'bar']).run(conn, callback) /// </code> /// <para>Result:</para> /// <code>{data: ["foo", "bar"], id: 5} /// </code></example> public ReqlObject(Arguments args, OptArgs optargs) : base(TermType.OBJECT, args, optargs) { }
public September (Arguments args, OptArgs optargs) : base(TermType.SEPTEMBER, args, optargs) { }
/// <summary> /// <para>Generate a random number between given (or implied) bounds. <code>random</code> takes zero, one or two arguments.</para> /// </summary> /// <example><para>Example: Generate a random number in the range <code>[0,1)</code></para> /// <code>r.random().run(conn, callback) /// </code></example> public Random (Arguments args, OptArgs optargs) : base(TermType.RANDOM, args, optargs) { }
/// <summary> /// <para>Compute the logical "and" of two or more values.</para> /// </summary> /// <example><para>Example: Return whether both <code>a</code> and <code>b</code> evaluate to true.</para> /// <code>var a = true, b = false; /// r.expr(a).and(b).run(conn, callback); /// // result passed to callback /// false /// </code></example> public And (Arguments args, OptArgs optargs) : this(TermType.AND, args, optargs) { }
protected Binary (TermType termType, Arguments args, OptArgs optargs) : base(termType, args, optargs){ }
/// <summary> /// <para>Update JSON documents in a table. Accepts a JSON document, a ReQL expression, or a /// combination of the two. You can pass options like <code>returnChanges</code> that will return the old /// and new values of the row you have modified.</para> /// </summary> /// <example><para>Example: Update the status of the post with <code>id</code> of <code>1</code> to <code>published</code>.</para> /// <code>r.table("posts").get(1).update({status: "published"}).run(conn, callback) /// </code></example> public Update (Arguments args, OptArgs optargs) : base(TermType.UPDATE, args, optargs) { }
/// <summary> /// <para>The opposite of pluck; takes an object or a sequence of objects, and returns them with /// the specified paths removed.</para> /// </summary> /// <example><para>Example: Since we don't need it for this computation we'll save bandwidth and leave /// out the list of IronMan's romantic conquests.</para> /// <code>r.table('marvel').get('IronMan').without('personalVictoriesList').run(conn, callback) /// </code></example> public Without (Arguments args, OptArgs optargs) : this(TermType.WITHOUT, args, optargs) { }
/// <summary> /// <para>Rename an existing secondary index on a table. If the optional argument <code>overwrite</code> is specified as <code>true</code>, a previously existing index with the new name will be deleted and the index will be renamed. If <code>overwrite</code> is <code>false</code> (the default) an error will be raised if the new index name already exists.</para> /// </summary> /// <example><para>Example: Rename an index on the comments table.</para> /// <code>r.table('comments').indexRename('postId', 'messageId').run(conn, callback) /// </code></example> public IndexRename (Arguments args, OptArgs optargs) : this(TermType.INDEX_RENAME, args, optargs) { }
/// <summary> /// <para>Intersect two arrays returning values that occur in both of them as a set (an array with /// distinct values).</para> /// </summary> /// <example><para>Example: Check which pieces of equipment Iron Man has from a fixed list.</para> /// <code>r.table('marvel').get('IronMan')('equipment').setIntersection(['newBoots', 'arc_reactor']).run(conn, callback) /// </code></example> public SetIntersection(Arguments args, OptArgs optargs) : base(TermType.SET_INTERSECTION, args, optargs) { }
public January (Arguments args, OptArgs optargs) : this(TermType.JANUARY, args, optargs) { }
/// <summary> /// <para>Select a given number of elements from a sequence with uniform random distribution. Selection is done without replacement.</para> /// </summary> /// <example><para>Example: Select 3 random heroes.</para> /// <code>r.table('marvel').sample(3).run(conn, callback) /// </code></example> public Sample (Arguments args, OptArgs optargs) : base(TermType.SAMPLE, args, optargs) { }
/// <summary> /// <para>Convert a time object to a string in ISO 8601 format.</para> /// </summary> /// <example><para>Example: Return the current ISO 8601 time.</para> /// <code>r.now().toISO8601().run(conn, callback) /// // Result passed to callback /// "2015-04-20T18:37:52.690+00:00" /// </code></example> public ToIso8601 (Arguments args, OptArgs optargs) : base(TermType.TO_ISO8601, args, optargs) { }
/// <summary> /// <para>Reference a database.</para> /// </summary> /// <example><para>Example: Explicitly specify a database for a query.</para> /// <code>r.db('heroes').table('marvel').run(conn, callback) /// </code></example> public Db(Arguments args, OptArgs optargs) : base(TermType.DB, args, optargs) { }
public Binary (Arguments args, OptArgs optargs) : this(TermType.BINARY, args, optargs) { }
/// <summary> /// <para>Construct a circular line or polygon. A circle in RethinkDB is a polygon or line <em>approximating</em> a circle of a given radius around a given center, consisting of a specified number of vertices (default 32).</para> /// </summary> /// <example><para>Example: Define a circle.</para> /// <code>r.table('geo').insert({ /// id: 300, /// name: 'Hayes Valley', /// neighborhood: r.circle([-122.423246,37.779388], 1000) /// }).run(conn, callback); /// </code></example> public Circle (Arguments args, OptArgs optargs) : this(TermType.CIRCLE, args, optargs) { }
public June (Arguments args, OptArgs optargs) : this(TermType.JUNE, args, optargs) { }
public Sunday(Arguments args, OptArgs optargs) : base(TermType.SUNDAY, args, optargs) { }
protected Without (TermType termType, Arguments args, OptArgs optargs) : base(termType, args, optargs) { }
/// <summary> /// <para>Compute the logical "and" of one or more values.</para> /// </summary> /// <example><para>Example: Return whether both <code>a</code> and <code>b</code> evaluate to true.</para> /// <code>var a = true, b = false; /// r.expr(a).and(b).run(conn, callback); /// // result passed to callback /// false /// </code></example> public And(Arguments args, OptArgs optargs) : base(TermType.AND, args, optargs) { }
protected Circle (TermType termType, Arguments args, OptArgs optargs) : base(termType, args, optargs) { }
public August(Arguments args, OptArgs optargs) : base(TermType.AUGUST, args, optargs) { }