Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Doc = `` /* 681-byte string literal not displayed */ Inject = `` /* 1154-byte string literal not displayed */ SinglePlugin = `package pkg {{if .Plugins}} import ({{range .Plugins}} _ "github.com/lack-io/plugins/{{.}}"{{end}} ){{end}} ` ClusterPlugin = `package {{.Name}} {{if .Plugins}} import ({{range .Plugins}} _ "github.com/lack-io/plugins/{{.}}"{{end}} ){{end}} ` SingleApp = `` /* 233-byte string literal not displayed */ ClusterApp = `` /* 255-byte string literal not displayed */ GatewayApp = `` /* 3308-byte string literal not displayed */ SingleWebSRV = `` /* 559-byte string literal not displayed */ ClusterWebSRV = `` /* 565-byte string literal not displayed */ DaoHandler = `` /* 173-byte string literal not displayed */ )
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 = `FROM alpine ADD {{.Name}} /{{.Name}} ENTRYPOINT [ "/{{.Name}}" ] ` DockerWEB = `FROM alpine ADD html /html ADD {{.Name}} /{{.Name}} WORKDIR / ENTRYPOINT [ "/{{.Name}}" ] ` )
View Source
var ( SingleMakefile = `` /* 666-byte string literal not displayed */ ClusterMakefile = `` /* 666-byte string literal not displayed */ GenerateFile = `package main //go:generate make proto ` )
View Source
var ( ProtoType = `` /* 236-byte string literal not displayed */ ProtoSRV = `` /* 683-byte string literal not displayed */ ProtoNew = `` /* 467-byte string literal not displayed */ )
View Source
var ( SubscriberSRV = `` /* 437-byte string literal not displayed */ HandlerAPI = `` /* 1208-byte string literal not displayed */ SingleSRV = `package server import ( "context" "github.com/vine-io/vine" log "github.com/vine-io/vine/lib/logger" "{{.Dir}}/pkg/runtime" "{{.Dir}}/pkg/runtime/inject" "{{.Dir}}/pkg/service" pb "{{.Dir}}/proto/service/{{.Group}}/{{.Version}}" ) type server struct{ vine.Service 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) error { // TODO: Validate s.H.Call() // FIXME: fix call method log.Info("Received {{title .Alias}}.Call request") rsp.Msg = "Hello " + req.Name return nil } // 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) Init() error { var err error opts := []vine.Option{ vine.Name(runtime.{{title .Name}}Name), vine.Id(runtime.{{title .Name}}Id), vine.Version(runtime.GetVersion()), vine.Metadata(map[string]string{ "namespace": runtime.Namespace, }), } s.Service.Init(opts...) if err = inject.Provide(s.Service, s.Client(), s); err != nil { return err } // TODO: inject more objects if err = inject.Populate(); err != nil { return err } if err = s.H.Init(); err != nil { return err } if err = pb.Register{{title .Name}}ServiceHandler(s.Service.Server(), s); err != nil { return err } return err } func New() *server { srv := vine.NewService() return &server{ Service: srv, } } ` SingleSRVWithAPI = `package server import ( "context" "github.com/vine-io/vine" log "github.com/vine-io/vine/lib/logger" "{{.Dir}}/pkg/runtime" "{{.Dir}}/pkg/runtime/inject" "{{.Dir}}/pkg/service" pb "{{.Dir}}/proto/service/{{.Group}}/{{.Version}}" ) type server struct{ vine.Service 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) error { // TODO: Validate s.H.Call() // FIXME: fix call method log.Info("Received {{title .Alias}}.Call request") rsp.Msg = "Hello " + req.Name return nil } // 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) Init() error { var err error opts := []vine.Option{ vine.Name(runtime.{{title .Name}}Name), vine.Id(runtime.{{title .Name}}Id), vine.Version(runtime.GetVersion()), vine.Metadata(map[string]string{ "namespace": runtime.Namespace, }), } s.Service.Init(opts...) if err = inject.Provide(s.Service, s.Client(), s); err != nil { return err } // TODO: inject more objects if err = inject.Populate(); err != nil { return err } if err = s.H.Init(); err != nil { return err } if err = pb.Register{{title .Name}}ServiceHandler(s.Service.Server(), s); err != nil { return err } return err } func New() *server { srv := vine.NewService() return &server{ Service: srv, } } ` ClusterSRV = `package server import ( "context" "github.com/vine-io/vine" log "github.com/vine-io/vine/lib/logger" "{{.Dir}}/pkg/runtime" "{{.Dir}}/pkg/{{.Name}}/service" "{{.Dir}}/pkg/runtime/inject" pb "{{.Dir}}/proto/service/{{.Group}}/{{.Version}}" ) type server struct{ vine.Service 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) error { // TODO: Validate s.H.Call() // FIXME: fix call method log.Info("Received {{title .Name}}.Call request") rsp.Msg = "Hello " + req.Name return nil } // 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) Init() error { var err error opts := []vine.Option{ vine.Name(runtime.{{title .Name}}Name), vine.Id(runtime.{{title .Name}}Id), vine.Version(runtime.GetVersion()), vine.Metadata(map[string]string{ "namespace": runtime.Namespace, }), } s.Service.Init(opts...) if err = inject.Provide(s.Service, s.Client(), s); err != nil { return err } // TODO: inject more objects if err = inject.Populate(); err != nil { return err } if err = s.H.Init(); err != nil { return err } if err = pb.Register{{title .Name}}ServiceHandler(s.Service.Server(), s); err != nil { return err } return err } func New() *server { srv := vine.NewService() return &server{ Service: srv, } } ` ClusterSRVWithAPI = `package server import ( "context" "github.com/vine-io/vine" log "github.com/vine-io/vine/lib/logger" "{{.Dir}}/pkg/runtime" "{{.Dir}}/pkg/{{.Name}}/service" "{{.Dir}}/pkg/runtime/inject" pb "{{.Dir}}/proto/service/{{.Group}}/{{.Version}}" ) type server struct{ vine.Service 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) error { // TODO: Validate s.H.Call() // FIXME: fix call method log.Info("Received {{title .Name}}.Call request") rsp.Msg = "Hello " + req.Name return nil } // 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) Init() error { var err error opts := []vine.Option{ vine.Name(runtime.{{title .Name}}Name), vine.Id(runtime.{{title .Name}}Id), vine.Version(runtime.GetVersion()), vine.Metadata(map[string]string{ "namespace": runtime.Namespace, }), } s.Service.Init(opts...) if err = inject.Provide(s.Service, s.Client(), s); err != nil { return err } // TODO: inject more objects if err = inject.Populate(); err != nil { return err } if err = s.H.Init(); err != nil { return err } if err = pb.Register{{title .Name}}ServiceHandler(s.Service.Server(), s); err != nil { return err } return err } func New() *server { srv := vine.NewService() return &server{ Service: srv, } } ` )
View Source
var (
GitIgnore = `.idea
.DS_Store
testdata
*.db
_output
.vscode
`
)
View Source
var (
HTMLWEB = `` /* 2930-byte string literal not displayed */
)
View Source
var (
Module = `` /* 156-byte string literal not displayed */
)
View Source
var (
Readme = `README`
)
View Source
var (
ServiceSRV = `package service
import (
"{{.Dir}}/pkg/runtime/inject"
"github.com/vine-io/vine"
)
func init() {
inject.ProvidePanic(new({{.Name}}))
}
type {{title .Name}} interface {
Init() error
Call()
Stream()
PingPong()
}
var _ {{title .Name}} = (*{{.Name}})(nil)
type {{.Name}} struct {
vine.Service ` + "`inject:\"\"`" + `
}
func (s *{{.Name}}) Init() error {
return nil
}
func (s *{{.Name}}) Call() {
// FIXME: modify method
panic("implement me")
}
func (s *{{.Name}}) Stream() {
panic("implement me")
}
func (s *{{.Name}}) PingPong() {
panic("implement me")
}
`
)
View Source
var (
SystemedSRV = `` /* 389-byte string literal not displayed */
)
View Source
var (
TOML = `` /* 893-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.