// FindUserByUsername finds and returns a user if it exists
FindUserByUsername finds and returns a user if it exists
// FindUserByUsername finds and returns a user if it exists
func (r repository) FindUserByUsername(username string) (*entities.User, error) {
	var result = entities.User{}
	findOneErr := r.Collection.FindOne(context.TODO(), bson.M{
		"username": username,
	}).Decode(&result)
	if findOneErr != nil {
		return nil, findOneErr
	}
	return &result, nil
}
func ( r repository ) FindUserByUsername ( username string ) ( * entities . User , error ) { var result = entities . User { } findOneErr := r . Collection . FindOne ( context . TODO ( ) , bson . M { " " : username , } ) . Decode ( & result ) if findOneErr != nil { return nil , findOneErr } return & result , nil }
FindUserByUsername finds and returns a user if it exists
FindUserByUsername finds and returns a user if it exists