2025-01-29 11:52:37 +00:00
|
|
|
package resultprocessor
|
2025-01-03 13:41:07 +00:00
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
|
|
|
|
|
"github.com/google/uuid"
|
|
|
|
|
)
|
|
|
|
|
|
2025-01-29 11:52:37 +00:00
|
|
|
type Value interface {
|
|
|
|
|
GetValue(ctx context.Context) (string, error)
|
|
|
|
|
GetStoreValue() string
|
|
|
|
|
}
|
|
|
|
|
|
2025-01-03 13:41:07 +00:00
|
|
|
type Type int
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
TypeJsonExtractor = iota
|
|
|
|
|
TypeContextFull
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type Create struct {
|
|
|
|
|
Type Type
|
2025-01-20 13:31:48 +00:00
|
|
|
RequiredQueryIDs *[]uuid.UUID
|
|
|
|
|
Config *string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (s *Create) GetConfig() *string {
|
|
|
|
|
return s.Config
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (s *Create) SetConfig(cfg *string) {
|
|
|
|
|
s.Config = cfg
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (s *Create) GetRequiredQueryIDs() *[]uuid.UUID {
|
|
|
|
|
return s.RequiredQueryIDs
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (s *Create) SetRequiredQueryIDs(ids *[]uuid.UUID) {
|
|
|
|
|
s.RequiredQueryIDs = ids
|
2025-01-03 13:41:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type Update struct {
|
|
|
|
|
ID uuid.UUID
|
2025-01-20 13:31:48 +00:00
|
|
|
ActiveVersion *int32
|
|
|
|
|
RequiredQueryIDs *[]uuid.UUID
|
|
|
|
|
Config *string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (s *Update) GetConfig() *string {
|
|
|
|
|
return s.Config
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (s *Update) SetConfig(cfg *string) {
|
|
|
|
|
s.Config = cfg
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (s *Update) GetRequiredQueryIDs() *[]uuid.UUID {
|
|
|
|
|
return s.RequiredQueryIDs
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (s *Update) SetRequiredQueryIDs(ids *[]uuid.UUID) {
|
|
|
|
|
s.RequiredQueryIDs = ids
|
2025-01-03 13:41:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type Query struct {
|
|
|
|
|
ID uuid.UUID
|
|
|
|
|
Type Type
|
|
|
|
|
Version int32
|
2025-01-20 13:31:48 +00:00
|
|
|
RequiredQueryIDs *[]uuid.UUID
|
|
|
|
|
Config *string
|
2025-01-03 13:41:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type Creator interface {
|
|
|
|
|
Validate(ctx context.Context, entity *Create) error
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type Updator interface {
|
2025-01-03 16:00:36 +00:00
|
|
|
Validate(ctx context.Context, current *Query, entity *Update) error
|
2025-01-03 13:41:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type Processor interface {
|
2025-02-14 10:56:24 +00:00
|
|
|
Process(ctx context.Context, query *Query, values []Value) (string, error)
|
2025-01-03 13:41:07 +00:00
|
|
|
}
|