Files
query-orchestration/internal/query/result/set.go
T
Jay Brown 15adaebfcd Merged in feature/serviceconfig-integration (pull request #38)
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
2025-01-31 13:43:55 +00:00

46 lines
1.1 KiB
Go

package result
import (
"context"
"queryorchestration/internal/database"
"queryorchestration/internal/database/repository"
resultprocessor "queryorchestration/internal/query/result/processor"
"github.com/google/uuid"
)
type Set struct {
DocumentID uuid.UUID
CleanVersion int32
TextVersion int32
Query *resultprocessor.Query
}
func (s *Service) Set(ctx context.Context, params *Set) (uuid.UUID, error) {
value, err := s.Process(ctx, &Process{
DocumentID: params.DocumentID,
MinCleanVersion: params.CleanVersion,
MinTextVersion: params.TextVersion,
Query: params.Query,
})
if err != nil {
return uuid.Nil, err
}
dbId, err := s.cfg.GetDBQueries().SetResult(ctx, &repository.SetResultParams{
Queryid: database.MustToDBUUID(params.Query.ID),
Documentid: database.MustToDBUUID(params.DocumentID),
Value: value.GetStoreValue(),
Cleanversion: params.CleanVersion,
Textversion: params.TextVersion,
Queryversion: params.Query.Version,
})
if err != nil {
return uuid.Nil, err
}
id := database.MustToUUID(dbId)
return id, nil
}