예제 #1
0
func (m *gameReleaseRepo) GetLatestWithState(gameId string, testGroup string, rs apipb.ReleaseState) (*apipb.GameRelease, error) {
	collection := m.driver.Session.DB("").C(GameReleaseCollection)
	gr := modelpb.GameRelease{}
	err := collection.
		Find(bson.M{
			"game_id":               parseID(gameId),
			"release_state":         rs,
			"game_manifest.ab_test": testGroup}).
		Sort("-int_version").
		One(&gr)
	if err != nil {
		return nil, toOtsimoError(err)
	}
	return gr.To(), nil
}
예제 #2
0
func (m *gameReleaseRepo) GetLatest(gameId string, testGroup string) (*apipb.GameRelease, error) {
	collection := m.driver.Session.DB("").C(GameReleaseCollection)
	gr := modelpb.GameRelease{}
	err := collection.
		Find(bson.M{
			"game_id":               parseID(gameId),
			"game_manifest.ab_test": testGroup}).
		Sort("-int_version").
		One(&gr)
	if err != nil {
		if err == mgo.ErrNotFound {
			return nil, models.ErrorNotFound
		}
		return nil, err
	}
	return gr.To(), nil
}