3
0

Implement email sending wf functions

This commit is contained in:
Denis Arh
2021-03-15 22:26:39 +01:00
parent fe23867965
commit 8ce11a3376
10 changed files with 1504 additions and 6 deletions
+6
View File
@@ -168,6 +168,9 @@ func expandAutomationFunctionTypes(ff []*aFuncDefs, tt []*exprTypesDef) {
if t.GoType == "" {
t.GoType = ti[t.WorkflowType].As
if "[]TypedValue" == t.GoType {
t.GoType = "[]expr.TypedValue"
}
}
if t.Suffix == "" && len(p.Types) > 1 {
@@ -183,6 +186,9 @@ func expandAutomationFunctionTypes(ff []*aFuncDefs, tt []*exprTypesDef) {
if r.GoType == "" {
r.GoType = ti[r.WorkflowType].As
if "[]TypedValue" == r.GoType {
r.GoType = "[]expr.TypedValue"
}
}
}
}
+4 -2
View File
@@ -75,7 +75,8 @@ type (
{{ range .Params }}
{{- if gt (len .Types) 1 }}
{{ $name := .Name }}
func (a {{ $ARGS }}) {{ export "get" $name }}() (bool, {{ range .Types }}{{ .GoType }},{{ end }}) {
{{ $isArray := .IsArray }}
func (a {{ $ARGS }}) {{ export "get" $name }}() (bool, {{ range .Types }}{{ if $isArray }}[]{{ end }}{{ .GoType }},{{ end }}) {
return a.has{{ export $name }}{{ range .Types }}, a.{{ $name }}{{ export .Suffix }}{{ end }}
}
{{- end }}
@@ -250,6 +251,7 @@ func (h {{ $.Name }}Handler) {{ export .Name }}() *atypes.Function {
{{ range . }}
{{ $name := .Name }}
{{ $isArray := .IsArray }}
{{ if gt (len .Types) 1 }}
// Converting {{ export .Name }} argument
if args.has{{ export .Name }} {
@@ -257,7 +259,7 @@ func (h {{ $.Name }}Handler) {{ export .Name }}() *atypes.Function {
switch aux.Type() {
{{- range .Types }}
case h.reg.Type({{ printf "%q" .WorkflowType }}).Type():
args.{{ $name }}{{ export .Suffix }} = aux.Get().({{ .GoType }})
args.{{ $name }}{{ export .Suffix }} = aux.Get().({{ if $isArray }}[]{{ end }}{{ .GoType }})
{{- end -}}
}
}
-4
View File
@@ -8,7 +8,6 @@ package {{ .Package }}
// Definitions file that controls how this file is generated:
// {{ .Source }}
{{ if .Imports }}
import (
"context"
"fmt"
@@ -19,13 +18,10 @@ import (
. "github.com/cortezaproject/corteza-server/pkg/expr"
{{- end }}
)
{{ end }}
var _ = context.Background
var _ = fmt.Errorf
{{ range $exprType, $def := .Types }}
// {{ $exprType }} is an expression type, wrapper for {{ $def.As }} type
type {{ $exprType }} struct{ value {{ $def.As }} }