20 lines
456 B
Go
20 lines
456 B
Go
|
// Copyright (c) 2024 Celestino Amoroso (celestino.amoroso@gmail.com).
|
||
|
// All rights reserved.
|
||
|
|
||
|
// bind-go-function.go
|
||
|
package expr
|
||
|
|
||
|
// ---- Linking with Go functions
|
||
|
type golangFunctor struct {
|
||
|
baseFunctor
|
||
|
f FuncTemplate
|
||
|
}
|
||
|
|
||
|
func NewGolangFunctor(f FuncTemplate) *golangFunctor {
|
||
|
return &golangFunctor{f: f}
|
||
|
}
|
||
|
|
||
|
func (functor *golangFunctor) Invoke(ctx ExprContext, name string, args []any) (result any, err error) {
|
||
|
return functor.f(ctx, name, args)
|
||
|
}
|