mirror of
https://github.com/jwetzell/showbridge-go.git
synced 2026-04-26 21:05:30 +00:00
actually use value template in Set
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package processor
|
package processor
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
@@ -38,7 +39,15 @@ func (kvs *KVSet) Process(ctx context.Context, wrappedPayload common.WrappedPayl
|
|||||||
return wrappedPayload, fmt.Errorf("kv.set module with id %s is not a KeyValueModule", kvs.ModuleId)
|
return wrappedPayload, fmt.Errorf("kv.set module with id %s is not a KeyValueModule", kvs.ModuleId)
|
||||||
}
|
}
|
||||||
|
|
||||||
err := kvModule.Set(kvs.Key, wrappedPayload.Payload)
|
var valueBuffer bytes.Buffer
|
||||||
|
err := kvs.Value.Execute(&valueBuffer, wrappedPayload)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
wrappedPayload.End = true
|
||||||
|
return wrappedPayload, err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = kvModule.Set(kvs.Key, valueBuffer.String())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
wrappedPayload.End = true
|
wrappedPayload.End = true
|
||||||
return wrappedPayload, fmt.Errorf("kv.set error setting key: %w", err)
|
return wrappedPayload, fmt.Errorf("kv.set error setting key: %w", err)
|
||||||
|
|||||||
Reference in New Issue
Block a user