15adaebfcd
DRAFT PR : WIP working through ideas for integration * movearound * attempttwo * openapi * further sanding * fix * start on tests * runthroughsingleconfig * somechanges * reflectissue * removeerrs * mostlyremovepanic * removeenv * noncfgtests * go * repo * fix service config test * add PWD to all * test fix * fix lint * todo for later * passingunittests * alltests * testlogger * testloggername * clean
37 lines
716 B
Go
37 lines
716 B
Go
package query
|
|
|
|
import (
|
|
"context"
|
|
"queryorchestration/internal/database"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
func (s *Service) List(ctx context.Context) ([]*Query, error) {
|
|
dbQueries, err := s.cfg.GetDBQueries().ListQueries(ctx)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
queries, err := ParseFullActiveQueryArray(dbQueries)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return queries, nil
|
|
}
|
|
|
|
func (s *Service) ListById(ctx context.Context, ids []uuid.UUID) ([]*Query, error) {
|
|
dbQueries, err := s.cfg.GetDBQueries().ListQueriesById(ctx, database.MustToDBUUIDArray(ids))
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
queries, err := ParseFullActiveQueryArray(dbQueries)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return queries, nil
|
|
}
|