1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-01-05 10:20:53 +02:00
go-micro/examples/filter/main.go
Asim Aslam 62801c3d68 update
2021-10-13 13:31:23 +01:00

33 lines
562 B
Go

package main
import (
"context"
"fmt"
"github.com/asim/go-micro/examples/v4/filter/version"
proto "github.com/asim/go-micro/examples/v4/service/proto"
"go-micro.dev/v4"
)
func main() {
service := micro.NewService()
service.Init()
greeter := proto.NewGreeterService("greeter", service.Client())
rsp, err := greeter.Hello(
// provide a context
context.TODO(),
// provide the request
&proto.Request{Name: "John"},
// set the filter
version.Filter("latest"),
)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(rsp.Greeting)
}