public MapObject GetProfileToDb(RethinkDB r, bool censorAchievements = false) { return(r.HashMap("id", _id.ToString()) .With("Visibility", (int)_visibility) .With("Username", _username) .With("Discriminator", _discriminator) .With("Friends", string.Join(",", _friends)) .With("Description", _description) .With("Achievements", string.Join("|", _achievements.Select(x => (int)x.Key + "," + x.Value.ToString(censorAchievements)))) .With("CreationDate", _creationDate.ToString("yyMMddHHmmss")) .With("BackgroundColor", _backgroundColor.R + "," + _backgroundColor.G + "," + _backgroundColor.B)); }
public virtual dynamic getConnection() { RethinkDB R = RethinkDB.R; var conn = R.Connection() .Hostname(this.hostname) .Port(this.port) .AuthKey(this.password) .Timeout(60) .Connect(); return(conn); }
{ //shermaine calling restful api of ReThinkDB to connect to gamedatabase to update coins in real mmo game public bool Update(string GameUsername, int Gold) { try { RethinkDB R = new RethinkDB(); Connection conn = R.Connection() .Hostname("localhost") .Port(28015) .Db("mmorpg") //.User("admin", "admin") .Timeout(60) .Connect(); Console.WriteLine(R.Db("mmorpg").TableList().Run(conn)); var results = R.Table("users").Filter(g => g["username"].Eq(GameUsername)).Run(conn); string id = ""; foreach (var result in results) { id = result["id"]; } var results2 = R.Table("users").GetAll(id).G("stats").G("gold").Run(conn); string gold2 = ""; foreach (var resultd in results2) { gold2 = resultd.ToString(); } Console.WriteLine(id); int gold3 = Convert.ToInt32(gold2); if (id == "") { return(false); } R.Table("users").Get(id).Update(R.HashMap("stats", R.HashMap("gold", gold3 + Gold))).Run(conn); return(true); } catch (Exception e) { return(false); } }
public MapObject ToReQLHashMap() { RethinkDB r = RethinkDB.R; MapObject hashmap = r.HashMap(); foreach (PropertyInfo prop in typeof(SearchParameters).GetProperties()) { if (prop.GetValue(this) != null && !prop.GetValue(this).Equals(0.0)) { hashmap = hashmap.With(prop.Name, prop.GetValue(this)); } } return(hashmap); }
public virtual void Save(RethinkDB r, ConnectionPool pool) { throw new NotImplementedException(); }
public DbSystem() { R1 = RethinkDB.R; }
public ConnectionFactory(RethinkDB dbDriver, IConfiguration config) { this._config = config; this._dbDriver = dbDriver; }
public CounterRepo(IConnectionFactory conFac) { _con = conFac.CreateConnection(); _rDB = new RethinkDB(); }