Documentation ¶
Index ¶
- Constants
- Variables
- type BaseGenerator
- func (b *BaseGenerator) AddImportsToFile(imp []parser.NamedTypeValue, src string) (string, error)
- func (b *BaseGenerator) CreateFolderStructure(path string) error
- func (b *BaseGenerator) EnsureThatWeUseQualifierIfNeeded(tp string, imp []parser.NamedTypeValue) string
- func (b *BaseGenerator) GenerateNameBySample(sample string, exclude []parser.NamedTypeValue) string
- func (b *BaseGenerator) InitPg()
- type BuildService
- type DockerCompose
- type DockerService
- type Gen
- func NewGenerateClient(name string, transport, pbImportPath string) Gen
- func NewGenerateDocker(glide bool) Gen
- func NewGenerateMiddleware(name, serviceName string, ep bool) Gen
- func NewGenerateService(name, transport, pbPath, pbImportPath string, ...) Gen
- func NewGenerateTransport(name string, gorillaMux bool, transport, pbPath, pbImportPath string, ...) Gen
- func NewNewService(name string) Gen
- type GenerateClient
- type GenerateDocker
- type GenerateMiddleware
- type GenerateService
- type GenerateTransport
- type NewService
- type PartialGenerator
Constants ¶
const DEFAULT_KIT_PROTO_FILE_INDENT_CHAR = " "
const ENV_NAME_KIT_PROTO_FILE_INDENT_CHAR = "KIT_PROTO_FILE_INDENT_CHAR"
Variables ¶
var SupportedTransports = []string{"http", "grpc"}
SupportedTransports is an array containing the supported transport types.
Functions ¶
This section is empty.
Types ¶
type BaseGenerator ¶
type BaseGenerator struct {
// contains filtered or unexported fields
}
BaseGenerator implements some basic generator functionality used by all generators.
func (*BaseGenerator) AddImportsToFile ¶
func (b *BaseGenerator) AddImportsToFile(imp []parser.NamedTypeValue, src string) (string, error)
AddImportsToFile adds missing imports toa file that we edit with the generator
func (*BaseGenerator) CreateFolderStructure ¶
func (b *BaseGenerator) CreateFolderStructure(path string) error
CreateFolderStructure create folder structure of path
func (*BaseGenerator) EnsureThatWeUseQualifierIfNeeded ¶
func (b *BaseGenerator) EnsureThatWeUseQualifierIfNeeded(tp string, imp []parser.NamedTypeValue) string
EnsureThatWeUseQualifierIfNeeded is used to see if we need to import a path of a given type.
func (*BaseGenerator) GenerateNameBySample ¶
func (b *BaseGenerator) GenerateNameBySample(sample string, exclude []parser.NamedTypeValue) string
GenerateNameBySample is used to generate a variable name using a sample.
The exclude parameter represents the names that it can not use.
E.x sample = "hello" this will return the name "h" if it is not in any NamedTypeValue name.
func (*BaseGenerator) InitPg ¶
func (b *BaseGenerator) InitPg()
InitPg initiates the partial generator (used when we don't want to generate the full source only portions)
type BuildService ¶
BuildService represents one docker service build.
type DockerCompose ¶
type DockerCompose struct { Version string `yaml:"version"` Services map[string]interface{} `yaml:"services"` }
DockerCompose represents the docker-compose.yml
type DockerService ¶
type DockerService struct { Build BuildService `yaml:"build"` Restart string `yaml:"restart"` Volumes []string ContainerName string `yaml:"container_name"` Ports []string `yaml:"ports"` }
DockerService represents one docker service.
type Gen ¶
type Gen interface {
Generate() error
}
Gen represents a generator.
func NewGenerateClient ¶
NewGenerateClient returns a client generator.
func NewGenerateDocker ¶
NewGenerateDocker returns a new docker generator.
func NewGenerateMiddleware ¶
NewGenerateMiddleware returns a initialized and ready generator.
func NewGenerateService ¶
func NewGenerateService(name, transport, pbPath, pbImportPath string, sMiddleware, gorillaMux, eMiddleware bool, methods []string) Gen
NewGenerateService returns a initialized and ready generator.
func NewGenerateTransport ¶
func NewGenerateTransport(name string, gorillaMux bool, transport, pbPath, pbImportPath string, methods []string) Gen
NewGenerateTransport returns a transport generator.
func NewNewService ¶
NewNewService returns a initialized and ready generator.
The name parameter is the name of the service that will be created this name should be without the `Service` suffix
type GenerateClient ¶
type GenerateClient struct { BaseGenerator // contains filtered or unexported fields }
GenerateClient implements Gen and it is used to generate the client lib of the service/
func (*GenerateClient) Generate ¶
func (g *GenerateClient) Generate() (err error)
Generate generates the client lib.
type GenerateDocker ¶
type GenerateDocker struct { BaseGenerator // contains filtered or unexported fields }
GenerateDocker implements Gen and is used to generate docker files for services.
func (*GenerateDocker) Generate ¶
func (g *GenerateDocker) Generate() (err error)
Generate generates the docker configurations.
type GenerateMiddleware ¶
type GenerateMiddleware struct { BaseGenerator // contains filtered or unexported fields }
GenerateMiddleware implements Gen and is used to generate middleware.
func (*GenerateMiddleware) Generate ¶
func (g *GenerateMiddleware) Generate() (err error)
Generate generates a new service middleware
type GenerateService ¶
type GenerateService struct { BaseGenerator // contains filtered or unexported fields }
GenerateService implements Gen and is used to generate the service.
func (*GenerateService) Generate ¶
func (g *GenerateService) Generate() (err error)
Generate generates the service.
type GenerateTransport ¶
type GenerateTransport struct { BaseGenerator // contains filtered or unexported fields }
GenerateTransport implement Gen, is used to generate a service transport
func (*GenerateTransport) Generate ¶
func (g *GenerateTransport) Generate() (err error)
Generate generates the transport.
type NewService ¶
type NewService struct { BaseGenerator // contains filtered or unexported fields }
NewService implements Gen and is used to create a new service.
func (*NewService) Generate ¶
func (g *NewService) Generate() error
Generate will run the generator.
type PartialGenerator ¶
type PartialGenerator struct {
// contains filtered or unexported fields
}
PartialGenerator wraps a jen statement
func NewPartialGenerator ¶
func NewPartialGenerator(st *jen.Statement) *PartialGenerator
NewPartialGenerator returns a partial generator
func (*PartialGenerator) NewLine ¶
func (p *PartialGenerator) NewLine()
NewLine insert a new line in code.
func (*PartialGenerator) Raw ¶
func (p *PartialGenerator) Raw() *jen.Statement
Raw returns the jen statement.
func (*PartialGenerator) String ¶
func (p *PartialGenerator) String() string
String returns the source code string