0ac5ff9e15
Test Query * depstextandclean * startedcleaningresult * resulttidyup * roundone * cleaning * unsyncedquery * startedtestsandsimplification * api * querytests * resultprocessortests * unittests * cleanup
41 lines
986 B
Go
41 lines
986 B
Go
package query
|
|
|
|
import (
|
|
"context"
|
|
"queryorchestration/internal/database"
|
|
"queryorchestration/internal/database/repository"
|
|
resultprocessor "queryorchestration/internal/query/result/processor"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
type Query struct {
|
|
ID uuid.UUID
|
|
Type resultprocessor.Type
|
|
ActiveVersion int32
|
|
LatestVersion int32
|
|
RequiredQueryIDs *[]uuid.UUID
|
|
Config *string
|
|
}
|
|
|
|
func (s *Service) GetWithVersion(ctx context.Context, id uuid.UUID, version int32) (*Query, error) {
|
|
query, err := s.db.Queries.GetQueryWithVersion(ctx, &repository.GetQueryWithVersionParams{
|
|
ID: database.MustToDBUUID(id),
|
|
Addedversion: version,
|
|
})
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return ParseQueryWithVersion(query)
|
|
}
|
|
|
|
func (s *Service) Get(ctx context.Context, id uuid.UUID) (*Query, error) {
|
|
query, err := s.db.Queries.GetQuery(ctx, database.MustToDBUUID(id))
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return ParseFullActiveQuery(query)
|
|
}
|