Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( SingleBiz = `package biz import ( "context" "github.com/vine-io/apimachinery/inject" "github.com/vine-io/vine" ) func init() { inject.ProvidePanic(new({{.Name}})) } type {{title .Name}} interface { Init() 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() 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") } ` ClusterBiz = `package biz import ( "context" "github.com/vine-io/apimachinery/inject" "github.com/vine-io/vine" ) func init() { inject.ProvidePanic(new({{.Name}})) } type {{title .Name}} interface { Init() 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() 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 ( 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] SERVER_NAME="{{.Name}}" SERVER_ADDRESS="localhost:11401" ` ConfGateway = `#[server] SERVER_NAME="{{.Name}}" SERVER_ADDRESS="localhost:80" ` )
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 = `` /* 1170-byte string literal not displayed */ SimpleBuiltin = `package pkg import ( _ "{{.Dir}}/pkg/biz" _ "{{.Dir}}/pkg/service" ) ` ClusterEntry = `` /* 1176-byte string literal not displayed */ ClusterBuiltin = `package {{.Name}} import ( _ "{{.Dir}}/pkg/{{.Name}}/biz" _ "{{.Dir}}/pkg/{{.Name}}/service" ) ` GatewayEntry = `` /* 3310-byte string literal not displayed */ )
View Source
var ( StorageHandler = `` /* 178-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 = `` /* 620-byte string literal not displayed */ ProtoSRV = `` /* 787-byte string literal not displayed */ ProtoNew = `` /* 571-byte string literal not displayed */ Register = `` /* 665-byte string literal not displayed */ )
View Source
var ( SingleINF = `package service import ( "github.com/vine-io/apimachinery/inject" "github.com/vine-io/vine" "github.com/vine-io/vine/core/server" verrs "github.com/vine-io/vine/lib/errors" log "github.com/vine-io/vine/lib/logger" "{{.Dir}}/pkg/biz" "{{.Dir}}/pkg/version" pb "{{.Dir}}/api/services/{{.Group}}/{{.Version}}" ) func init() { inject.ProvidePanic(new(service)) } type service struct{ H biz.{{title .Name}} ` + "`inject:\"\"`" + ` } // Call is a single request handler called via client.Call or the generated client code func (s *service) Call(ctx *vine.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 *service) Stream(ctx *vine.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 *service) PingPong(ctx *vine.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 *service) Register(svc server.Server) error { return pb.Register{{title .Name}}ServiceHandler(svc, s) } ` SingleINFWithAPI = `package service import ( "github.com/vine-io/apimachinery/inject" "github.com/vine-io/vine" verrs "github.com/vine-io/vine/lib/errors" log "github.com/vine-io/vine/lib/logger" "{{.Dir}}/pkg/biz" "{{.Dir}}/pkg/version" pb "{{.Dir}}/api/services/{{.Group}}/{{.Version}}" ) func init() { inject.ProvidePanic(new(service)) } type service struct{ H biz.{{title .Name}} ` + "`inject:\"\"`" + ` } // Call is a single request handler called via client.Call or the generated client code func (s *service) Call(ctx *vine.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 *service) Stream(ctx *vine.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 *service) PingPong(ctx *vine.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 *service) Register(svc server.Server) error { return pb.Register{{title .Name}}ServiceHandler(svc, s) } ` ClusterINF = `package service import ( "github.com/vine-io/apimachinery/inject" "github.com/vine-io/vine" 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(service)) } type service struct{ H biz.{{title .Name}} ` + "`inject:\"\"`" + ` } // Call is a single request handler called via client.Call or the generated client code func (s *service) Call(ctx *vine.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 *service) Stream(ctx *vine.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 *service) PingPong(ctx *vine.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 *service) Register(svc server.Server) error { return pb.Register{{title .Name}}ServiceHandler(svc, s) } ` ClusterINFWithAPI = `package service import ( "github.com/vine-io/apimachinery/inject" "github.com/vine-io/vine" 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(service)) } type service struct{ H biz.{{title .Name}} ` + "`inject:\"\"`" + ` } // Call is a single request handler called via client.Call or the generated client code func (s *service) Call(ctx *vine.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 *service) Stream(ctx *vine.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 *service) PingPong(ctx *vine.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 *service) Register(svc server.Server) error { return pb.Register{{title .Name}}ServiceHandler(svc, s) } ` )
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 = `` /* 389-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.