38 lines
721 B
Go
38 lines
721 B
Go
package query
|
|
|
|
import (
|
|
"context"
|
|
"queryorchestration/internal/database"
|
|
"queryorchestration/internal/database/repository"
|
|
queryprocessor "queryorchestration/internal/queryProcessor"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
type ListFilters struct {
|
|
Types []queryprocessor.Type
|
|
}
|
|
|
|
type Test struct {
|
|
QueryID uuid.UUID
|
|
DocumentID uuid.UUID
|
|
QueryVersion int32
|
|
}
|
|
|
|
type Service struct {
|
|
db *repository.Queries
|
|
}
|
|
|
|
func New(db *repository.Queries) *Service {
|
|
return &Service{db}
|
|
}
|
|
|
|
func (s *Service) Get(ctx context.Context, id uuid.UUID) (*queryprocessor.Query, error) {
|
|
query, err := s.db.GetQuery(ctx, database.MustToDBUUID(id))
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return queryprocessor.ParseDBGetQuery(&query)
|
|
}
|