generator

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2021 License: Apache-2.0 Imports: 48 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 ParseStatusErrorDesc added in v1.1.7

func ParseStatusErrorDesc(str string) (msg string, desc string, canBeErrTalk bool)

func PathExist

func PathExist(p string) bool

func WriteFile

func WriteFile(filename string, content string)

Types

type ClientGenerator

type ClientGenerator struct {
	Api *oas.OpenAPI
	// contains filtered or unexported fields
}

func NewClientGenerator

func NewClientGenerator(pkgName string) *ClientGenerator

func (*ClientGenerator) Finally added in v1.2.0

func (c *ClientGenerator) Finally()

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 Config added in v1.0.17

type Config struct {
	StructName string
	TableName  string
	Database   string

	WithComments        bool
	WithTableName       bool
	WithTableInterfaces bool
	WithMethods         bool

	FieldPrimaryKey   string
	FieldKeyDeletedAt string
	FieldKeyCreatedAt string
	FieldKeyUpdatedAt string
}

func (*Config) SetDefaults added in v1.0.17

func (g *Config) SetDefaults()

type DockerGenerator

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

func NewDockerGenerator

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

func (*DockerGenerator) Finally added in v1.2.0

func (d *DockerGenerator) Finally()

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 EnumGenerator

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

func NewEnumGenerator

func NewEnumGenerator(typeName string) *EnumGenerator

func (*EnumGenerator) Finally added in v1.2.0

func (e *EnumGenerator) Finally()

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 Generator

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

type K8sGenerator

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

func NewK8sGenerator

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

func (*K8sGenerator) Finally added in v1.2.0

func (d *K8sGenerator) Finally()

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 ModelGenerator added in v1.1.7

type ModelGenerator struct {
	generator.Config
	// contains filtered or unexported fields
}

func NewModelGenerator added in v1.1.7

func NewModelGenerator() *ModelGenerator

func (*ModelGenerator) Finally added in v1.2.0

func (g *ModelGenerator) Finally()

func (*ModelGenerator) Load added in v1.1.7

func (g *ModelGenerator) Load(cwd string)

func (*ModelGenerator) Output added in v1.1.7

func (g *ModelGenerator) Output(outputPath string) Outputs

func (*ModelGenerator) Pick added in v1.1.7

func (g *ModelGenerator) Pick()

type OpenApiGenerator

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

func NewOpenApiGenerator

func NewOpenApiGenerator() *OpenApiGenerator

func (*OpenApiGenerator) Finally added in v1.2.0

func (a *OpenApiGenerator) Finally()

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 PluginDetail added in v1.0.14

type PluginDetail struct {
	RepoFullName string
	PackageName  string
	PackagePath  string
	Version      string
	Tag          repo.Tag
}

type ProjectGenerator

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

func NewProjectGenerator

func NewProjectGenerator(opt ProjectOption) *ProjectGenerator

func (*ProjectGenerator) Finally added in v1.2.0

func (p *ProjectGenerator) Finally()

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) Finally added in v1.2.0

func (s *ServiceGenerator) Finally()

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"`
	Plugins          []string
	PluginDetails    []PluginDetail `survey:"-"`

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

func (ServiceOption) GetPluginDetailByPackageName added in v1.0.14

func (opt ServiceOption) GetPluginDetailByPackageName(pkgName string) *PluginDetail

type StatusErrGenerator added in v1.1.7

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

func NewStatusErrGenerator added in v1.1.7

func NewStatusErrGenerator() *StatusErrGenerator

func (*StatusErrGenerator) Finally added in v1.2.2

func (s *StatusErrGenerator) Finally()

func (*StatusErrGenerator) Load added in v1.1.7

func (s *StatusErrGenerator) Load(path string)

func (*StatusErrGenerator) Output added in v1.1.7

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

func (*StatusErrGenerator) Pick added in v1.1.7

func (s *StatusErrGenerator) Pick()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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