1234567891011121314151617181920212223242526272829 |
- package main
- import (
- "fmt"
- "git.nspix.com/micro/internal/micro"
- )
- type (
- Math struct {
- }
- MathRequest struct {
- Num int
- Num2 int
- }
- MathResponse struct {
- Val int
- }
- )
- func (m *Math) Add(req *MathRequest, res *MathResponse) error {
- res.Val = req.Num + req.Num2
- return nil
- }
- func main() {
- svr := micro.New(micro.WithName("test.server", "1.0.0"))
- fmt.Println(svr.HandleFunc(new(Math)))
- fmt.Println(svr.Run())
- }
|