コード例 #1
0
 public void DropById()
 {
     RethinkQuery.RunQuery((R, connection) =>
     {
         String id      = RethinkQuery.GetIds(R, connection)[0];
         dynamic result = R.Db(DatabaseName).Table(TableName).Get(id).Delete().Run(connection);
         return(result);
     });
 }
コード例 #2
0
 public void DoAggregation()
 {
     RethinkQuery.RunQuery((R, connection) =>
     {
         String id  = RethinkQuery.GetIds(R, connection)[0];
         var result = R.Db(DatabaseName).Table(TableName).Get(id)["_reports"]["FBA Base"]
                      .Group("Period").Avg("OutstandingBal").Round().Run(connection);
         return(result);
     });
 }
コード例 #3
0
 public void GetReports()
 {
     RethinkQuery.RunQuery((R, connection) =>
     {
         String id     = RethinkQuery.GetIds(R, connection)[0];
         JArray result = R.Db(DatabaseName).Table(TableName).Get(id)["_reports"]["FBA Base"]
                         .Run <JObject>(connection);
         return(result);
     });
 }
コード例 #4
0
 public void GetIds()
 {
     RethinkQuery.RunQuery((R, connection) =>
     {
         String json = "[";
         RethinkQuery.GetIds(R, connection).ForEach(item => json += item + ",");
         json = json.TrimEnd(',');
         return(json + "]");
     });
 }
コード例 #5
0
        public void GetOrderedByOutstandingBal()
        {
            RethinkQuery.RunQuery((R, connection) =>
            {
                String id      = RethinkQuery.GetIds(R, connection)[0];
                dynamic result = R.Db(DatabaseName).Table(TableName).Get(id)["_reports"]["FBA Base"]
                                 .Filter(x => x.G("OutstandingBal").Gt(0))
                                 .OrderBy(R.Desc("OutstandingBal")).Run(connection);

                return(result);
            });
        }
コード例 #6
0
 public void SetPropVal()
 {
     RethinkQuery.RunQuery((R, connection) =>
     {
         String id               = RethinkQuery.GetIds(R, connection)[0];
         JArray reports          = R.Db(DatabaseName).Table(TableName).Get(id)["_reports"]["FBA Base"].Run <JObject>(connection);
         List <JObject> _reports = new List <JObject>(reports.Values <JObject>());
         _reports.ForEach(report => report["PropertyValue"] = 200000);
         dynamic result = R.Db(DatabaseName).Table(TableName).Get(id)
                          .Update(R.HashMap("_reports",
                                            R.HashMap("FBA Base", _reports))).Run(connection);
         return(result);
     });
 }
コード例 #7
0
        public void DoStatFunctions()
        {
            RethinkQuery.RunQuery((R, connection) =>
            {
                String id    = RethinkQuery.GetIds(R, connection)[0];
                var balances = R.Db(DatabaseName).Table(TableName).Get(id)["_reports"]["FBA Base"]["OutstandingBal"];

                var min = balances.Min().Round().Run(connection);
                var max = balances.Max().Round().Run(connection);
                var avg = balances.Avg().Round().Run(connection);

                return("[" + min + "," + max + "," + avg + "]");
            });
        }
コード例 #8
0
        public void CountReports()
        {
            const string DatabaseName = RethinkQuery.DatabaseName;
            const string TableName    = RethinkQuery.TableName;

            RethinkQuery.RunQuery((R, connection) =>
            {
                String id      = RethinkQuery.GetIds(R, connection)[0];
                dynamic result = R.Db(DatabaseName).Table(TableName)
                                 .Count().Run(connection);

                return(result);
            });
        }