mirror of
https://github.com/linka-cloud/grpc.git
synced 2024-11-22 10:56:26 +00:00
[wip] renamed base package grpc
This commit is contained in:
parent
8197d933f8
commit
d2ee153290
@ -5,7 +5,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
service2 "gitlab.bertha.cloud/partitio/grpc-service/service"
|
"gitlab.bertha.cloud/partitio/grpc/service"
|
||||||
)
|
)
|
||||||
|
|
||||||
type GreeterHandler struct{}
|
type GreeterHandler struct{}
|
||||||
@ -30,16 +30,16 @@ func (g *GreeterHandler) SayHelloStream(req *HelloStreamRequest, s Greeter_SayHe
|
|||||||
func main() {
|
func main() {
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
var svc service2.Service
|
var svc service.Service
|
||||||
var err error
|
var err error
|
||||||
svc, err = service2.New(
|
svc, err = service.New(
|
||||||
service2.WithContext(ctx),
|
service.WithContext(ctx),
|
||||||
service2.WithName("Greeting"),
|
service.WithName("Greeting"),
|
||||||
service2.WithAfterStart(func() error {
|
service.WithAfterStart(func() error {
|
||||||
fmt.Println("Server listening on", svc.Options().Address())
|
fmt.Println("Server listening on", svc.Options().Address())
|
||||||
return nil
|
return nil
|
||||||
}),
|
}),
|
||||||
service2.WithAfterStop(func() error {
|
service.WithAfterStop(func() error {
|
||||||
fmt.Println("Stopping server")
|
fmt.Println("Stopping server")
|
||||||
return nil
|
return nil
|
||||||
}),
|
}),
|
||||||
|
Loading…
Reference in New Issue
Block a user