creatorupdatordeprecate
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
package jsonextractor
|
||||
|
||||
import (
|
||||
"context"
|
||||
"queryorchestration/internal/database/repository"
|
||||
queryprocessor "queryorchestration/internal/queryProcessor"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
type Creator struct {
|
||||
db *repository.Queries
|
||||
}
|
||||
|
||||
func NewCreator(db *repository.Queries) Creator {
|
||||
return Creator{db}
|
||||
}
|
||||
|
||||
func (s Creator) Validate(ctx context.Context, entity *queryprocessor.Create) error {
|
||||
// TODO
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s Creator) Create(ctx context.Context, entity *queryprocessor.Create) (uuid.UUID, error) {
|
||||
err := s.Validate(ctx, entity)
|
||||
if err != nil {
|
||||
return uuid.Nil, err
|
||||
}
|
||||
|
||||
// TODO
|
||||
return uuid.Nil, nil
|
||||
}
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"fmt"
|
||||
"queryorchestration/internal/database"
|
||||
"queryorchestration/internal/database/repository"
|
||||
"queryorchestration/internal/query"
|
||||
queryprocessor "queryorchestration/internal/queryProcessor"
|
||||
"queryorchestration/internal/result"
|
||||
|
||||
"github.com/tidwall/gjson"
|
||||
@@ -20,11 +20,11 @@ type Config struct {
|
||||
Path string `json:"path"`
|
||||
}
|
||||
|
||||
func New(db *repository.Queries) *Extractor {
|
||||
return &Extractor{db}
|
||||
func NewExtractor(db *repository.Queries) Extractor {
|
||||
return Extractor{db}
|
||||
}
|
||||
|
||||
func (e *Extractor) Process(ctx context.Context, query query.QueryRow, values *[]result.Value) (string, error) {
|
||||
func (e Extractor) Process(ctx context.Context, query queryprocessor.Query, values *[]result.Value) (string, error) {
|
||||
if len(*values) != 1 {
|
||||
return "", fmt.Errorf("JSON Extraction requires 1 result")
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package jsonextractor
|
||||
|
||||
import (
|
||||
"context"
|
||||
"queryorchestration/internal/database/repository"
|
||||
queryprocessor "queryorchestration/internal/queryProcessor"
|
||||
)
|
||||
|
||||
type Updator struct {
|
||||
db *repository.Queries
|
||||
}
|
||||
|
||||
func NewUpdator(db *repository.Queries) Updator {
|
||||
return Updator{db}
|
||||
}
|
||||
|
||||
func (s Updator) Validate(ctx context.Context, entity *queryprocessor.Update) error {
|
||||
// TODO
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s Updator) Update(ctx context.Context, entity *queryprocessor.Update) error {
|
||||
err := s.Validate(ctx, entity)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// TODO
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user