// GetUsers fetches all the users from the database
GetUsers fetches all the users from the database
// GetUsers fetches all the users from the database
func (r repository) GetUsers() (*[]entities.User, error) {
	var Users []entities.User
	cursor, err := r.Collection.Find(context.Background(), bson.M{})
	if err != nil {
		return nil, err
	}
	for cursor.Next(context.TODO()) {
		var user entities.User
		_ = cursor.Decode(&user)
		Users = append(Users, *user.SanitizedUser())
	}
	return &Users, nil
}
func ( r repository ) GetUsers ( ) ( * [ ] entities . User , error ) { var Users [ ] entities . User cursor , err := r . Collection . Find ( context . Background ( ) , bson . M { } ) if err != nil { return nil , err } for cursor . Next ( context . TODO ( ) ) { var user entities . User _ = cursor . Decode ( & user ) Users = append ( Users , * user . SanitizedUser ( ) ) } return & Users , nil }
GetUsers fetches all the users from the database
GetUsers fetches all the users from the database