Esempio n. 1
0
	    public Query(QueryType type, long token, ReqlAst term, OptArgs globalOptions)
		{
			this.Type = type;
			this.Token = token;
			this.Term = term;
			this.GlobalOptions = globalOptions;
		}
Esempio n. 2
0
///<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);
        }
    }
Esempio n. 3
0
///<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);
        }
    }
Esempio n. 4
0
///<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);
        }
    }
Esempio n. 6
0
///<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);
        }
    }
Esempio n. 7
0
///<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);
        }
    }
Esempio n. 8
0
///<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;
        }
Esempio n. 10
0
/// <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) {
        }
Esempio n. 11
0
 public Maxval(Arguments args, OptArgs optargs)
     : base(TermType.MAXVAL, args, optargs)
 {
 }
Esempio n. 12
0
/// <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) {
        }
Esempio n. 13
0
 protected IndexRename (TermType termType, Arguments args, OptArgs optargs) : base(termType, args, optargs)
 {
 }
Esempio n. 14
0
/// <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) {
        }
Esempio n. 15
0
/// <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) {
        }
Esempio n. 16
0
/// <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) {
        }
Esempio n. 17
0
/// <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)
        {
        }
Esempio n. 18
0
/// <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)
        {
        }
Esempio n. 19
0
///<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));
        }
Esempio n. 20
0
/// <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)
        {
        }
Esempio n. 21
0
        Task <T> IConnection.RunResultAsync <T>(ReqlAst term, object globalOpts, CancellationToken cancelToken)
        {
            Query q = PrepareQuery(term, OptArgs.FromAnonType(globalOpts));

            return(RunQueryResultAsync <T>(q, cancelToken));
        }
Esempio n. 22
0
/// <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)
        {
        }
Esempio n. 23
0
/// <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)
        {
        }
Esempio n. 24
0
 public September (Arguments args, OptArgs optargs)
  : base(TermType.SEPTEMBER, args, optargs) {
 }
Esempio n. 25
0
/// <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) {
        }
Esempio n. 26
0
/// <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) {
        }
Esempio n. 27
0
 protected Binary (TermType termType, Arguments args, OptArgs optargs) : base(termType, args, optargs){
     
 }
Esempio n. 28
0
/// <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) {
        }
Esempio n. 29
0
/// <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) {
        }
Esempio n. 30
0
/// <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)
        {
        }
Esempio n. 32
0
 public January (Arguments args, OptArgs optargs)
      : this(TermType.JANUARY, args, optargs) {
 }
Esempio n. 33
0
/// <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) {
        }
Esempio n. 34
0
/// <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) {
        }
Esempio n. 35
0
/// <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)
        {
        }
Esempio n. 36
0
 public Binary (Arguments args, OptArgs optargs) : this(TermType.BINARY, args, optargs) {
     
 }
Esempio n. 37
0
/// <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) {
        }
Esempio n. 38
0
 public June (Arguments args, OptArgs optargs)
      : this(TermType.JUNE, args, optargs) {
 }
Esempio n. 39
0
 public Sunday(Arguments args, OptArgs optargs)
     : base(TermType.SUNDAY, args, optargs)
 {
 }
Esempio n. 40
0
 protected Without (TermType termType, Arguments args, OptArgs optargs) : base(termType, args, optargs)
 {
 }
Esempio n. 41
0
/// <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)
        {
        }
Esempio n. 42
0
 protected Circle (TermType termType, Arguments args, OptArgs optargs) : base(termType, args, optargs)
 {
 }
Esempio n. 43
0
 public August(Arguments args, OptArgs optargs)
     : base(TermType.AUGUST, args, optargs)
 {
 }