// 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) TypeName() string {
	return "GoFunctor"
}

func (functor *golangFunctor) InvokeNamed(ctx ExprContext, name string, args map[string]any) (result any, err error) {
	return functor.f(ctx, name, args)
}
