github.com/ovechkin-dm/go-dyno@v0.0.23/cmd/arm/hello.go (about)

     1  package main
     2  
     3  import (
     4  	"fmt"
     5  	"github.com/ovechkin-dm/go-dyno/pkg/dyno"
     6  	"reflect"
     7  )
     8  
     9  type Iface interface {
    10  	Test(i int, j int, a [2]int, f [2]float64) int
    11  }
    12  
    13  type Handler struct {
    14  }
    15  
    16  func (h *Handler) Handle(m *dyno.Method, values []reflect.Value) []reflect.Value {
    17  	for i := range values {
    18  		fmt.Println(values[i].Interface())
    19  	}
    20  	return []reflect.Value{reflect.ValueOf(values[0].Interface().(int) + 1)}
    21  }
    22  
    23  func main() {
    24  	fmt.Println("hello, ARM")
    25  	h := Handler{}
    26  	p, err := dyno.Dynamic[Iface](&h)
    27  	if err != nil {
    28  		panic(err)
    29  	}
    30  	result := p.Test(10, 20, [2]int{123, 124}, [2]float64{123.1, 124.2})
    31  	fmt.Println(result)
    32  }