migrate
This commit is contained in:
@@ -11,6 +11,7 @@ type Function interface {
|
||||
Types() []string
|
||||
Definition() string
|
||||
IsAsync() bool
|
||||
Arguments() []reflect.Type
|
||||
Call(context.Context, []any) (any, error)
|
||||
}
|
||||
|
||||
@@ -48,6 +49,17 @@ func (b *functionImpl[A, R]) Function() any {
|
||||
return b.fn
|
||||
}
|
||||
|
||||
func (b *functionImpl[A, R]) Arguments() []reflect.Type {
|
||||
var allTypes []reflect.Type
|
||||
|
||||
rType := reflect.TypeFor[A]()
|
||||
for i := range rType.NumField() {
|
||||
allTypes = append(allTypes, rType.Field(i).Type)
|
||||
}
|
||||
|
||||
return allTypes
|
||||
}
|
||||
|
||||
func (b *functionImpl[A, R]) Call(ctx context.Context, allArgs []any) (any, error) {
|
||||
return b.CallGeneric(ctx, allArgs)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user