// NewUserRepository create an user repository based on the database
NewUserRepository create an user repository based on the database
// NewUserRepository create an user repository based on the database
func NewUserRepository(user models.User) UserRepository {
	if database.SD_TYPE == "mongo" {
		session, db := database.GetSessionAndDB(database.MONGO_DB)
		collection := db.C(USERS_COLLECTION)
		return &UserMongoRepository{
			Session:    session,
			Db:         db,
			Collection: collection,
		}
	}
	if database.SD_TYPE == "oracle" {
		db, err := database.ConnectToOracle(database.ORACLE_CONNECTION_STRING)
		if err != nil {
			return nil
		}
		return &UserOracleRepository{
			Db:      db,
			DbError: err,
		}
	}
	return nil
}
func NewUserRepository ( user models . User ) UserRepository { if database . SD_TYPE == " " { session , db := database . GetSessionAndDB ( database . MONGO_DB ) collection := db . C ( USERS_COLLECTION ) return & UserMongoRepository { Session : session , Db : db , Collection : collection , } } if database . SD_TYPE == " " { db , err := database . ConnectToOracle ( database . ORACLE_CONNECTION_STRING ) if err != nil { return nil } return & UserOracleRepository { Db : db , DbError : err , } } return nil }
NewUserRepository create an user repository based on the database
NewUserRepository create an user repository based on the database