Exemplo n.º 1
0
func (object *User) Delete() {
	connection := database.GetConnection()
	defer connection.Release()
	logger.Debug("[Database] Deleting User")

	collection := connection.C(object.Collection())
	collection.RemoveId(object.Id)
	key := object.ApplicationId.Hex() + ".users." + object.Id.Hex()
	cache.Clear(key)
}
Exemplo n.º 2
0
func (object *Endpoint) Save() {

	connection := database.GetConnection()
	defer connection.Release()
	logger.Debug("[Database] Saving Endpoint")

	collection := connection.C(object.Collection())

	if object.Id == bson.ObjectId("") {
		object.Id = bson.NewObjectId()
		collection.Insert(object)
	} else {
		collection.UpdateId(object.Id, object)
	}

	key := object.ApplicationId.Hex() + ".endpoints." + object.Id.Hex()
	cache.Clear(key)

}