// GetUser allows to retrieve a user by its characteristics
GetUser allows to retrieve a user by its characteristics
// GetUser allows to retrieve a user by its characteristics
func (db *Postgres) GetUser(params params.M) (*models.User, error) {
	session := db.New()
	var user models.User
	for key, value := range params {
		session = session.Where(key+" = ?", value)
	}
	if err := session.First(&user).Error; err != nil {
		return nil, helpers.NewError(http.StatusNotFound, "user_not_found", "could not find the user", err)
	}
	return &user, nil
}
func ( db * Postgres ) GetUser ( params params . M ) ( * models . User , error ) { session := db . New ( ) var user models . User for key , value := range params { session = session . Where ( key + " " , value ) } if err := session . First ( & user ) . Error ; err != nil { return nil , helpers . NewError ( http . StatusNotFound , " " , " " , err ) } return & user , nil }
GetUser allows to retrieve a user by its characteristics
GetUser allows to retrieve a user by its characteristics