Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( SingleCMD = `package main import ( "{{.Dir}}/pkg" ) func main() { pkg.Run() } ` ClusterCMD = `package main import ( "{{.Dir}}/pkg/{{.Name}}" ) func main() { {{.Name}}.Run() } ` )
View Source
var ( ConfSRV = `server: name: {{.Name}} address: "127.0.0.1:11401" ` ConfGateway = `server: name: {{.Name}} address: "127.0.0.1:11401" ` )
View Source
var ( DockerSRV = `` /* 126-byte string literal not displayed */ DockerWEB = `FROM alpine ADD html /html ADD {{.Name}} /{{.Name}} WORKDIR / ENTRYPOINT [ "/{{.Name}}" ] ` )
View Source
var ( SingleEntry = `` /* 1369-byte string literal not displayed */ SimpleBuiltin = `package pkg import ( _ "{{.Dir}}/pkg/server" _ "{{.Dir}}/pkg/service" ) ` ClusterEntry = `` /* 1375-byte string literal not displayed */ ClusterBuiltin = `package {{.Name}} import ( _ "{{.Dir}}/pkg/{{.Name}}/server" _ "{{.Dir}}/pkg/{{.Name}}/service" ) ` GatewayEntry = `` /* 3238-byte string literal not displayed */ )
View Source
var ( StorageHandler = `` /* 227-byte string literal not displayed */ CacheHandler = `package cache ` )
View Source
var ( SingleMakefile = `` /* 671-byte string literal not displayed */ ClusterMakefile = `` /* 671-byte string literal not displayed */ GenerateFile = `package main //go:generate make proto ` )
View Source
var ( ProtoType = `` /* 703-byte string literal not displayed */ ProtoSRV = `` /* 807-byte string literal not displayed */ ProtoNew = `` /* 571-byte string literal not displayed */ Register = `` /* 1015-byte string literal not displayed */ )
View Source
var ( SingleServer = `package server import ( "context" "github.com/vine-io/apimachinery/inject" vserver "github.com/vine-io/vine/core/server" "github.com/vine-io/vine/lib/api/handler/openapi" verrs "github.com/vine-io/vine/lib/errors" log "github.com/vine-io/vine/lib/logger" "{{.Dir}}/pkg/service" "{{.Dir}}/pkg/internal/version" pb "{{.Dir}}/api/services/{{.Group}}/{{.Version}}" ) func init() { inject.ProvidePanic(new(server)) } type server struct{ H service.{{title .Name}} ` + "`inject:\"\"`" + ` } // Call is a single request handler called via client.Call or the generated client code func (s *server) Call(ctx context.Context, req *pb.Request, rsp *pb.Response) (err error) { if err = req.Validate(); err != nil { return verrs.BadRequest(version.{{title .Name}}Name, err.Error()) } rsp.Msg, err = s.H.Call(ctx, req.Name) return } // Stream is a server side stream handler called via client.Stream or the generated client code func (s *server) Stream(ctx context.Context, req *pb.StreamingRequest, stream pb.{{title .Name}}Service_StreamStream) error { log.Infof("Received {{title .Name}}.Stream request with count: %d", req.Count) // TODO: Validate s.H.Stream() // FIXME: fix stream method for i := 0; i < int(req.Count); i++ { log.Infof("Responding: %d", i) if err := stream.Send(&pb.StreamingResponse{ Count: int64(i), }); err != nil { return err } } return nil } // PingPong is a bidirectional stream handler called via client.Stream or the generated client code func (s *server) PingPong(ctx context.Context, stream pb.{{title .Name}}Service_PingPongStream) error { // TODO: Validate s.H.PingPong() // FIXME: fix stream pingpong for { req, err := stream.Recv() if err != nil { return err } log.Infof("Got ping %v", req.Stroke) if err := stream.Send(&pb.Pong{Stroke: req.Stroke}); err != nil { return err } } } func (s *server) Register(svc vserver.Server) error { if err := openapi.RegisterOpenAPIHandler(svc); err != nil { return err } return pb.Register{{title .Name}}ServiceHandler(svc, s) } ` SingleServerWithAPI = `package server import ( "context" "github.com/vine-io/apimachinery/inject" vserver "github.com/vine-io/vine/core/server" "github.com/vine-io/vine/lib/api/handler/openapi" verrs "github.com/vine-io/vine/lib/errors" log "github.com/vine-io/vine/lib/logger" "{{.Dir}}/pkg/service" "{{.Dir}}/pkg/internal/version" pb "{{.Dir}}/api/services/{{.Group}}/{{.Version}}" ) func init() { inject.ProvidePanic(new(server)) } type server struct{ H service.{{title .Name}} ` + "`inject:\"\"`" + ` } // Call is a single request handler called via client.Call or the generated client code func (s *server) Call(ctx context.Context, req *pb.Request, rsp *pb.Response) (err error) { if err = req.Validate(); err != nil { return verrs.BadRequest(version.{{title .Name}}Name, err.Error()) } rsp.Msg, err = s.H.Call(ctx, req.Name) return } // Stream is a server side stream handler called via client.Stream or the generated client code func (s *server) Stream(ctx context.Context, req *pb.StreamingRequest, stream pb.{{title .Name}}Service_StreamStream) error { log.Infof("Received {{title .Name}}.Stream request with count: %d", req.Count) // TODO: Validate s.H.Stream() // FIXME: fix stream method for i := 0; i < int(req.Count); i++ { log.Infof("Responding: %d", i) if err := stream.Send(&pb.StreamingResponse{ Count: int64(i), }); err != nil { return err } } return nil } // PingPong is a bidirectional stream handler called via client.Stream or the generated client code func (s *server) PingPong(ctx context.Context, stream pb.{{title .Name}}Service_PingPongStream) error { // TODO: Validate s.H.PingPong() // FIXME: fix stream pingpong for { req, err := stream.Recv() if err != nil { return err } log.Infof("Got ping %v", req.Stroke) if err := stream.Send(&pb.Pong{Stroke: req.Stroke}); err != nil { return err } } } func (s *server) Register(svc vserver.Server) error { if err := openapi.RegisterOpenAPIHandler(svc); err != nil { return err } return pb.Register{{title .Name}}ServiceHandler(svc, s) } ` ClusterServer = `package server import ( "context" "github.com/vine-io/apimachinery/inject" vserver "github.com/vine-io/vine/core/server" "github.com/vine-io/vine/lib/api/handler/openapi" verrs "github.com/vine-io/vine/lib/errors" log "github.com/vine-io/vine/lib/logger" "{{.Dir}}/pkg/{{.Name}}/service" "{{.Dir}}/pkg/internal/version" pb "{{.Dir}}/api/services/{{.Group}}/{{.Version}}" ) func init() { inject.ProvidePanic(new(server)) } type server struct{ H service.{{title .Name}} ` + "`inject:\"\"`" + ` } // Call is a single request handler called via client.Call or the generated client code func (s *server) Call(ctx context.Context, req *pb.Request, rsp *pb.Response) (err error) { if err = req.Validate(); err != nil { return verrs.BadRequest(version.{{title .Name}}Name, err.Error()) } rsp.Msg, err = s.H.Call(ctx, req.Name) return } // Stream is a server side stream handler called via client.Stream or the generated client code func (s *server) Stream(ctx context.Context, req *pb.StreamingRequest, stream pb.{{title .Name}}Service_StreamStream) error { log.Infof("Received {{title .Name}}.Stream request with count: %d", req.Count) // TODO: Validate s.H.Stream() // FIXME: fix stream method for i := 0; i < int(req.Count); i++ { log.Infof("Responding: %d", i) if err := stream.Send(&pb.StreamingResponse{ Count: int64(i), }); err != nil { return err } } return nil } // PingPong is a bidirectional stream handler called via client.Stream or the generated client code func (s *server) PingPong(ctx context.Context, stream pb.{{title .Name}}Service_PingPongStream) error { // TODO: Validate s.H.PingPong() // FIXME: fix stream pingpong for { req, err := stream.Recv() if err != nil { return err } log.Infof("Got ping %v", req.Stroke) if err := stream.Send(&pb.Pong{Stroke: req.Stroke}); err != nil { return err } } } func (s *server) Register(svc vserver.Server) error { if err := openapi.RegisterOpenAPIHandler(svc); err != nil { return err } return pb.Register{{title .Name}}ServiceHandler(svc, s) } ` ClusterServerWithAPI = `package server import ( "context" "github.com/vine-io/apimachinery/inject" vserver "github.com/vine-io/vine/core/server" "github.com/vine-io/vine/lib/api/handler/openapi" verrs "github.com/vine-io/vine/lib/errors" log "github.com/vine-io/vine/lib/logger" "{{.Dir}}/pkg/{{.Name}}/biz" "{{.Dir}}/pkg/version" pb "{{.Dir}}/api/services/{{.Group}}/{{.Version}}" ) func init() { inject.ProvidePanic(new(server)) } type server struct{ H service.{{title .Name}} ` + "`inject:\"\"`" + ` } // Call is a single request handler called via client.Call or the generated client code func (s *service) Call(ctx context.Context, req *pb.Request, rsp *pb.Response) (err error) { if err = req.Validate(); err != nil { return verrs.BadRequest(version.{{title .Name}}Name, err.Error()) } rsp.Msg, err = s.H.Call(ctx, req.Name) return } // Stream is a server side stream handler called via client.Stream or the generated client code func (s *server) Stream(ctx context.Context, req *pb.StreamingRequest, stream pb.{{title .Name}}Service_StreamStream) error { log.Infof("Received {{title .Name}}.Stream request with count: %d", req.Count) // TODO: Validate s.H.Stream() // FIXME: fix stream method for i := 0; i < int(req.Count); i++ { log.Infof("Responding: %d", i) if err := stream.Send(&pb.StreamingResponse{ Count: int64(i), }); err != nil { return err } } return nil } // PingPong is a bidirectional stream handler called via client.Stream or the generated client code func (s *server) PingPong(ctx context.Context, stream pb.{{title .Name}}Service_PingPongStream) error { // TODO: Validate s.H.PingPong() // FIXME: fix stream pingpong for { req, err := stream.Recv() if err != nil { return err } log.Infof("Got ping %v", req.Stroke) if err := stream.Send(&pb.Pong{Stroke: req.Stroke}); err != nil { return err } } } func (s *server) Register(svc vserver.Server) error { if err := openapi.RegisterOpenAPIHandler(svc); err != nil { return err } return pb.Register{{title .Name}}ServiceHandler(svc, s) } ` )
View Source
var ( SingleService = `package service import ( "context" "github.com/vine-io/apimachinery/inject" "github.com/vine-io/vine" ) func init() { inject.ProvidePanic(new({{.Name}})) } type {{title .Name}} interface { Init(ctx context.Context) error Call(ctx context.Context, name string) (string, error) Stream() PingPong() } var _ {{title .Name}} = (*{{.Name}})(nil) type {{.Name}} struct { vine.Service ` + "`inject:\"\"`" + ` } func (s *{{.Name}}) Init(ctx context.Context) error { return nil } func (s *{{.Name}}) Start() error { return nil } func (s *{{.Name}}) Call(ctx context.Context, name string) (string, error) { return "reply: " + name, nil } func (s *{{.Name}}) Stream() { panic("implement me") } func (s *{{.Name}}) PingPong() { panic("implement me") } ` ClusterService = `package service import ( "context" "github.com/vine-io/apimachinery/inject" "github.com/vine-io/vine" ) func init() { inject.ProvidePanic(new({{.Name}})) } type {{title .Name}} interface { Init(ctx context.Context) error Call(ctx context.Context, name string) (string, error) Stream() PingPong() } var _ {{title .Name}} = (*{{.Name}})(nil) type {{.Name}} struct { vine.Service ` + "`inject:\"\"`" + ` } func (s *{{.Name}}) Init(ctx context.Context) error { return nil } func (s *{{.Name}}) Start() error { return nil } func (s *{{.Name}}) Call(ctx context.Context, name string) (string, error) { return "reply: " + name, nil } func (s *{{.Name}}) Stream() { panic("implement me") } func (s *{{.Name}}) PingPong() { panic("implement me") } ` )
View Source
var (
GitIgnore = `.idea
.DS_Store
testdata
*.db
_output
.vscode
*.pb.*.go
`
)
View Source
var (
HTMLWEB = `` /* 2930-byte string literal not displayed */
)
View Source
var (
Module = `` /* 206-byte string literal not displayed */
)
View Source
var (
Readme = `README`
)
View Source
var (
SystemedSRV = `` /* 361-byte string literal not displayed */
)
View Source
var (
TOML = `` /* 893-byte string literal not displayed */
)
View Source
var (
Version = `` /* 675-byte string literal not displayed */
)
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.