示例#1
0
        public static List <string> GetIds(RethinkDb.Driver.RethinkDB R, RethinkDb.Driver.Net.Connection connection)
        {
            Cursor <object> cursor = R.Db(DatabaseName).Table(TableName).Pluck("id").RunCursor <object>(connection);
            String          json   = "";

            cursor.BufferedItems.ForEach(item => json += item + ",\n");
            json = json.TrimEnd(',', '\n');
            json = "[" + json + "]";

            List <ID>     ids  = new List <ID>(JsonConvert.DeserializeObject <IEnumerable <ID> >(json));
            List <string> _ids = new List <string>();

            ids.ForEach(id => _ids.Add(id.id));
            return(_ids);
        }
示例#2
0
        private List <LogEntry> DoSearch(string query, int limit, RethinkDb.Driver.Net.Connection conn)
        {
            var date = DateTime.UtcNow.AddDays(-1);
            var logs = R.Db(_rethinkDbFactory.GetOptions().Database)
                       .Table("Logs")
                       .OrderBy()[new { index = R.Desc(nameof(LogEntry.Timestamp)) }]
                       .Filter(t => t.CoerceTo("string").Match($"(?i){query}"))
                       .Limit(limit)
                       .RunCursor <LogEntry>(conn);

            var result = logs.ToList();

            logs.Close();

            return(result);
        }
示例#3
0
 public async Task CreateConnectionAsync()
 {
     this.Connection = await RethinkDB.R.Connection().Hostname("rethinkdb-server").Port(28015).Timeout(5).ConnectAsync();
 }
示例#4
0
 public RethinkRepository()
 {
     this.Connection = RethinkDB.R.Connection().Hostname("rethinkdb-server").Port(28015).Timeout(5).Connect();
 }