50 lines
932 B
Go
50 lines
932 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
|
|
Create(ctx context.Context, entity *Create) (uuid.UUID, error)
|
|
}
|
|
|
|
type Updator interface {
|
|
Validate(ctx context.Context, entity *Update) error
|
|
Update(ctx context.Context, entity *Update) error
|
|
}
|
|
|
|
type Processor interface {
|
|
Process(ctx context.Context, query Query, values *[]result.Value) (string, error)
|
|
}
|