main.go 428 B

1234567891011121314151617181920212223242526272829
  1. package main
  2. import (
  3. "fmt"
  4. "git.nspix.com/micro/internal/micro"
  5. )
  6. type (
  7. Math struct {
  8. }
  9. MathRequest struct {
  10. Num int
  11. Num2 int
  12. }
  13. MathResponse struct {
  14. Val int
  15. }
  16. )
  17. func (m *Math) Add(req *MathRequest, res *MathResponse) error {
  18. res.Val = req.Num + req.Num2
  19. return nil
  20. }
  21. func main() {
  22. svr := micro.New(micro.WithName("test.server", "1.0.0"))
  23. fmt.Println(svr.HandleFunc(new(Math)))
  24. fmt.Println(svr.Run())
  25. }