48 lines
833 B
Go
48 lines
833 B
Go
package queryprocessor
|
|
|
|
import (
|
|
"context"
|
|
"queryorchestration/internal/result"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
type Type int
|
|
|
|
const (
|
|
TypeJsonExtractor = iota
|
|
TypeContextFull
|
|
)
|
|
|
|
type Create struct {
|
|
Type Type
|
|
RequiredQueryIDs []uuid.UUID
|
|
Config string
|
|
}
|
|
|
|
type Update struct {
|
|
ID uuid.UUID
|
|
RequiredQueryIDs []uuid.UUID
|
|
Config string
|
|
}
|
|
|
|
type Query struct {
|
|
ID uuid.UUID
|
|
Type Type
|
|
Version int32
|
|
RequiredQueryIDs []uuid.UUID
|
|
Config string
|
|
}
|
|
|
|
type Creator interface {
|
|
Validate(ctx context.Context, entity *Create) error
|
|
}
|
|
|
|
type Updator interface {
|
|
Validate(ctx context.Context, current *Query, entity *Update) error
|
|
}
|
|
|
|
type Processor interface {
|
|
Process(ctx context.Context, query *Query, values []result.Value) (string, error)
|
|
}
|