generator

package
v1.0.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 24, 2020 License: Apache-2.0 Imports: 42 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Image     = "${PROFZONE_DOCKER_REGISTRY}/${PROJECT_GROUP}/${PROJECT_NAME}:${PROJECT_VERSION}"
	FromImage = "${PROFZONE_DOCKER_REGISTRY}/profzone/golang-runtime:1.14"
)

Variables

This section is empty.

Functions

func EachFieldValue

func EachFieldValue(val reflect.Value, walker func(value reflect.Value) bool)

func Generate

func Generate(generator Generator, inputPath, outputPath string)

func GeneratedSuffix

func GeneratedSuffix(filename string) string

func GetServiceName

func GetServiceName(projectName string) string

func IsGoFile

func IsGoFile(filename string) bool

func IsGoTextFile

func IsGoTextFile(filename string) bool

func PathExist

func PathExist(p string) bool

func WriteFile

func WriteFile(filename string, content string)

Types

type ClientGenerator

type ClientGenerator struct {
	Api api.Api
	// contains filtered or unexported fields
}

func NewClientGenerator

func NewClientGenerator(pkgName string) *ClientGenerator

func (*ClientGenerator) Load

func (c *ClientGenerator) Load(path string)

func (*ClientGenerator) Output

func (c *ClientGenerator) Output(outputPath string) Outputs

func (*ClientGenerator) Pick

func (c *ClientGenerator) Pick()

type DockerGenerator

type DockerGenerator struct {
	ServiceName string
	EnvVars     []envconfig.EnvVar
}

func NewDockerGenerator

func NewDockerGenerator(serviceName string, envVars []envconfig.EnvVar) *DockerGenerator

func (*DockerGenerator) Load

func (d *DockerGenerator) Load(path string)

func (*DockerGenerator) Output

func (d *DockerGenerator) Output(outputPath string) Outputs

func (*DockerGenerator) Pick

func (d *DockerGenerator) Pick()

type EntryPointPlugins

type EntryPointPlugins interface {
	GenerateEntryPoint(opt ServiceOption, cwd string) string
}

type EnumGenerator

type EnumGenerator struct {
	TypeName string
	// contains filtered or unexported fields
}

func NewEnumGenerator

func NewEnumGenerator(typeName string) *EnumGenerator

func (*EnumGenerator) Load

func (e *EnumGenerator) Load(cwd string)

func (*EnumGenerator) Output

func (e *EnumGenerator) Output(outputPath string) Outputs

func (*EnumGenerator) Pick

func (e *EnumGenerator) Pick()

type FilePlugins

type FilePlugins interface {
	GenerateFilePoint(opt ServiceOption, cwd string) []*files.GoFile
}

type Generator

type Generator interface {
	Load(path string)
	Pick()
	Output(outputPath string) Outputs
}

type K8sGenerator

type K8sGenerator struct {
	// contains filtered or unexported fields
}

func NewK8sGenerator

func NewK8sGenerator(config []interface{}) *K8sGenerator

func (*K8sGenerator) Load

func (d *K8sGenerator) Load(cwd string)

func (*K8sGenerator) Output

func (d *K8sGenerator) Output(outputPath string) Outputs

func (*K8sGenerator) Pick

func (d *K8sGenerator) Pick()

type OpenApiGenerator

type OpenApiGenerator struct {
	// contains filtered or unexported fields
}

func NewOpenApiGenerator

func NewOpenApiGenerator() *OpenApiGenerator

func (*OpenApiGenerator) Load

func (a *OpenApiGenerator) Load(cwd string)

func (*OpenApiGenerator) OperationByOperatorTypes

func (a *OpenApiGenerator) OperationByOperatorTypes(method string, operatorTypes ...*scanner.OperatorWithTypeName) *oas.Operation

func (*OpenApiGenerator) Output

func (a *OpenApiGenerator) Output(outputPath string) Outputs

func (*OpenApiGenerator) Pick

func (a *OpenApiGenerator) Pick()

type Outputs

type Outputs map[string]string

func (Outputs) Add

func (outputs Outputs) Add(filename string, content string)

func (Outputs) WriteFile

func (outputs Outputs) WriteFile(filename string, content string)

func (Outputs) WriteFiles

func (outputs Outputs) WriteFiles()

type ProjectGenerator

type ProjectGenerator struct {
	// contains filtered or unexported fields
}

func NewProjectGenerator

func NewProjectGenerator(opt ProjectOption) *ProjectGenerator

func (*ProjectGenerator) Load

func (p *ProjectGenerator) Load(path string)

func (*ProjectGenerator) Output

func (p *ProjectGenerator) Output(outputPath string) Outputs

func (*ProjectGenerator) Pick

func (p *ProjectGenerator) Pick()

type ProjectOption

type ProjectOption struct {
	Name            string
	Group           string
	Owner           string
	Desc            string
	Version         string
	ProgramLanguage string `survey:"project_language"`
	Workflow        string
	ApolloSupport   expressBool `survey:"apollo_support"`
}

type ServiceGenerator

type ServiceGenerator struct {
	// contains filtered or unexported fields
}

func NewServiceGenerator

func NewServiceGenerator(opt ServiceOption) *ServiceGenerator

func (*ServiceGenerator) Load

func (s *ServiceGenerator) Load(path string)

func (*ServiceGenerator) Output

func (s *ServiceGenerator) Output(outputPath string) Outputs

func (*ServiceGenerator) Pick

func (s *ServiceGenerator) Pick()

type ServiceOption

type ServiceOption struct {
	FrameworkVersion string `survey:"framework_version"`
	Name             string
	PackageName      string      `survey:"package_name"`
	DatabaseSupport  expressBool `survey:"database_support"`
	ApolloSupport    expressBool `survey:"apollo_support"`

	Group           string
	Owner           string
	Desc            string
	Version         string
	ProgramLanguage string `survey:"project_language"`
	Workflow        string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL