Skip to content

Instantly share code, notes, and snippets.

@h1z3y3
Created January 24, 2022 16:12
Show Gist options
  • Save h1z3y3/5071ade541d011e5d608a3415cfc343f to your computer and use it in GitHub Desktop.
Save h1z3y3/5071ade541d011e5d608a3415cfc343f to your computer and use it in GitHub Desktop.
package function
import "strings"
// An input schema
#Input: {
count: int
msg: string
}
// An output schema
#Output: {
val: string
}
#Transform: {
// Input for the caller
X1="in": #Input
// output for the caller
out: #Output
// intermediate fields
_upper: strings.ToUpper(X1.msg)
_msg: strings.Join([_upper]*X1.count, " ")
// set output
out: val: _msg
}
// Call transform
result: #Transform & {in: {msg: "ra", count: 3}}
//
// cue export function.cue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment