30 lines
671 B
Go
30 lines
671 B
Go
package repository
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/SamuelTariku/FortuneBet-Backend/internal/domain"
|
|
"github.com/jackc/pgx/v5/pgtype"
|
|
)
|
|
|
|
|
|
func (s *Store) GetAllBranchLocations (ctx context.Context, query domain.ValidString) ([]domain.BranchLocation, error) {
|
|
locations, err := s.queries.GetAllBranchLocations(ctx, pgtype.Text{
|
|
String: query.Value,
|
|
Valid: query.Valid,
|
|
})
|
|
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
var result []domain.BranchLocation = make([]domain.BranchLocation, 0, len(locations))
|
|
|
|
for _, location := range locations {
|
|
result = append(result, domain.BranchLocation{
|
|
Key: location.Key,
|
|
Name: location.Value,
|
|
})
|
|
}
|
|
return result, nil
|
|
} |