0df3d16976
Query Version Sync Runner * testing * queryversiosyncworking * update * tests * fixtests
85 lines
1.5 KiB
Go
85 lines
1.5 KiB
Go
package resultprocessor
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
type Value interface {
|
|
GetValue(ctx context.Context) (string, error)
|
|
GetStoreValue() string
|
|
}
|
|
|
|
type Type int
|
|
|
|
const (
|
|
TypeJsonExtractor = iota
|
|
TypeContextFull
|
|
)
|
|
|
|
type Create struct {
|
|
Type Type
|
|
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
|
|
}
|
|
|
|
type Update struct {
|
|
ID uuid.UUID
|
|
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
|
|
}
|
|
|
|
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 []Value) (string, error)
|
|
}
|