github.com/voedger/voedger@v0.0.0-20240520144910-273e84102129/pkg/sys/builtin/impl_echo.go (about) 1 /* 2 * Copyright (c) 2021-present unTill Pro, Ltd. 3 */ 4 5 package builtin 6 7 import ( 8 "context" 9 10 "github.com/voedger/voedger/pkg/appdef" 11 "github.com/voedger/voedger/pkg/istructs" 12 "github.com/voedger/voedger/pkg/istructsmem" 13 ) 14 15 func (e *echoRR) AsString(string) string { return e.text } 16 17 func provideQryEcho(cfg *istructsmem.AppConfigType) { 18 cfg.Resources.Add(istructsmem.NewQueryFunction( 19 appdef.NewQName(appdef.SysPackage, "Echo"), 20 func(_ context.Context, args istructs.ExecQueryArgs, callback istructs.ExecQueryCallback) (err error) { 21 text := args.ArgumentObject.AsString("Text") 22 return callback(&echoRR{text: text}) 23 }, 24 )) 25 }