Skip to content

Commit 380ce9b

Browse files
- Better atom.
1 parent 40b16fc commit 380ce9b

File tree

1 file changed

+133
-14
lines changed

1 file changed

+133
-14
lines changed

internal/stackql/primitivebuilder/mono_valent_execution.go

Lines changed: 133 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -712,27 +712,45 @@ func agnosticate(
712712
reqParams := armoury.GetRequestParams()
713713
logging.GetLogger().Infof("monoValentExecution.Execute() req param count = %d", len(reqParams))
714714
for _, rc := range reqParams {
715-
processErr := process(
716-
rc,
717-
elider,
718-
provider,
719-
method,
720-
tableName,
721-
runtimeCtx,
722-
authCtx,
723-
outErrFile,
724-
polyHandler,
725-
selectItemsKey,
726-
insertPreparator,
715+
rq := rc
716+
processor := newProcessor(
717+
newProcessorPayload(
718+
rq,
719+
elider,
720+
provider,
721+
method,
722+
tableName,
723+
runtimeCtx,
724+
authCtx,
725+
outErrFile,
726+
polyHandler,
727+
selectItemsKey,
728+
insertPreparator,
729+
),
727730
)
731+
processErr := processor.Process()
728732
if processErr != nil {
729733
return processErr
730734
}
731735
}
732736
return nil
733737
}
734738

735-
func process(
739+
type ProcessorPayload interface {
740+
GetArmouryParams() anysdk.HTTPArmouryParameters
741+
GetElider() methodElider
742+
GetProvider() anysdk.Provider
743+
GetMethod() anysdk.OperationStore
744+
GetTableName() string
745+
GetRuntimeCtx() dto.RuntimeCtx
746+
GetAuthCtx() *dto.AuthCtx
747+
GetOutErrFile() io.Writer
748+
GetPolyHandler() PolyHandler
749+
GetSelectItemsKey() string
750+
GetInsertPreparator() InsertPreparator
751+
}
752+
753+
func newProcessorPayload(
736754
armouryParams anysdk.HTTPArmouryParameters,
737755
elider methodElider,
738756
provider anysdk.Provider,
@@ -744,7 +762,108 @@ func process(
744762
polyHandler PolyHandler,
745763
selectItemsKey string,
746764
insertPreparator InsertPreparator,
747-
) error {
765+
) ProcessorPayload {
766+
return &standardProcessorPayload{
767+
armouryParams: armouryParams,
768+
elider: elider,
769+
provider: provider,
770+
method: method,
771+
tableName: tableName,
772+
runtimeCtx: runtimeCtx,
773+
authCtx: authCtx,
774+
outErrFile: outErrFile,
775+
polyHandler: polyHandler,
776+
selectItemsKey: selectItemsKey,
777+
insertPreparator: insertPreparator,
778+
}
779+
}
780+
781+
type standardProcessorPayload struct {
782+
armouryParams anysdk.HTTPArmouryParameters
783+
elider methodElider
784+
provider anysdk.Provider
785+
method anysdk.OperationStore
786+
tableName string
787+
runtimeCtx dto.RuntimeCtx
788+
authCtx *dto.AuthCtx
789+
outErrFile io.Writer
790+
polyHandler PolyHandler
791+
selectItemsKey string
792+
insertPreparator InsertPreparator
793+
}
794+
795+
func (pp *standardProcessorPayload) GetArmouryParams() anysdk.HTTPArmouryParameters {
796+
return pp.armouryParams
797+
}
798+
799+
func (pp *standardProcessorPayload) GetElider() methodElider {
800+
return pp.elider
801+
}
802+
803+
func (pp *standardProcessorPayload) GetProvider() anysdk.Provider {
804+
return pp.provider
805+
}
806+
807+
func (pp *standardProcessorPayload) GetMethod() anysdk.OperationStore {
808+
return pp.method
809+
}
810+
811+
func (pp *standardProcessorPayload) GetTableName() string {
812+
return pp.tableName
813+
}
814+
815+
func (pp *standardProcessorPayload) GetRuntimeCtx() dto.RuntimeCtx {
816+
return pp.runtimeCtx
817+
}
818+
819+
func (pp *standardProcessorPayload) GetAuthCtx() *dto.AuthCtx {
820+
return pp.authCtx
821+
}
822+
823+
func (pp *standardProcessorPayload) GetOutErrFile() io.Writer {
824+
return pp.outErrFile
825+
}
826+
827+
func (pp *standardProcessorPayload) GetPolyHandler() PolyHandler {
828+
return pp.polyHandler
829+
}
830+
831+
func (pp *standardProcessorPayload) GetSelectItemsKey() string {
832+
return pp.selectItemsKey
833+
}
834+
835+
func (pp *standardProcessorPayload) GetInsertPreparator() InsertPreparator {
836+
return pp.insertPreparator
837+
}
838+
839+
type Processor interface {
840+
Process() error
841+
}
842+
843+
type standardProcessor struct {
844+
payload ProcessorPayload
845+
}
846+
847+
func newProcessor(payload ProcessorPayload) Processor {
848+
return &standardProcessor{
849+
payload: payload,
850+
}
851+
}
852+
853+
func (sp *standardProcessor) Process() error {
854+
processorPayload := sp.payload
855+
armouryParams := processorPayload.GetArmouryParams()
856+
elider := processorPayload.GetElider()
857+
provider := processorPayload.GetProvider()
858+
method := processorPayload.GetMethod()
859+
tableName := processorPayload.GetTableName()
860+
runtimeCtx := processorPayload.GetRuntimeCtx()
861+
authCtx := processorPayload.GetAuthCtx()
862+
outErrFile := processorPayload.GetOutErrFile()
863+
polyHandler := processorPayload.GetPolyHandler()
864+
selectItemsKey := processorPayload.GetSelectItemsKey()
865+
insertPreparator := processorPayload.GetInsertPreparator()
866+
748867
reqCtx := armouryParams
749868
paramsUsed, paramErr := reqCtx.ToFlatMap()
750869
if paramErr != nil {

0 commit comments

Comments
 (0)