Documentation
¶
Index ¶
- Constants
- func SetDefaultTemplateConfig()
- type ClientConfig
- type ClientFile
- type ClientGenerator
- type ClientMethod
- type CustomizedFileForIDL
- type CustomizedFileForMethod
- type CustomizedFileForService
- type ErrorFile
- type FilePathRenderInfo
- type Generator
- type HttpMethod
- type HttpPackageGenerator
- type IDLPackageRenderInfo
- type Layout
- type LayoutGenerator
- type ModelBackend
- type Option
- type PackageDescription
- type Service
Constants ¶
View Source
const ServiceSuffix = "Service"
Variables ¶
This section is empty.
Functions ¶
func SetDefaultTemplateConfig ¶
func SetDefaultTemplateConfig()
Types ¶
type ClientConfig ¶
type ClientConfig struct {
QueryEnumAsInt bool
}
type ClientFile ¶
type ClientFile struct {
Config ClientConfig
FilePath string
PackageName string
ServiceName string
BaseDomain string
Imports map[string]*model.Model
ClientMethods []*ClientMethod
}
type ClientGenerator ¶
type ClientGenerator interface {
}
type ClientMethod ¶
type CustomizedFileForIDL ¶
type CustomizedFileForIDL struct {
*IDLPackageRenderInfo
FilePath string
FilePackage string
}
type CustomizedFileForMethod ¶
type CustomizedFileForMethod struct {
*HttpMethod
FilePath string
FilePackage string
ServiceInfo *Service // service info for this method
IDLPackageInfo *IDLPackageRenderInfo // IDL info for this service
}
type CustomizedFileForService ¶
type CustomizedFileForService struct {
*Service
FilePath string
FilePackage string
IDLPackageInfo *IDLPackageRenderInfo // IDL info for this service
}
type FilePathRenderInfo ¶
type FilePathRenderInfo struct {
MasterIDLName string // master IDL name
GenPackage string // master IDL generate code package
HandlerDir string // handler generate dir
ModelDir string // model generate dir
RouterDir string // router generate dir
ProjectDir string // projectDir
GoModule string // go module
ServiceName string // service name, changed as services are traversed
MethodName string // method name, changed as methods are traversed
HandlerGenPath string // "api.gen_path" value
}
type HttpMethod ¶
type HttpMethod struct {
Name string
HTTPMethod string
Comment string
Path string
Serializer string
OutputDir string
RefPackage string // handler import dir
RefPackageAlias string // handler import alias
RequestTypeName string
RequestTypePackage string
RequestTypeRawName string
ReturnTypeName string
ReturnTypePackage string
ReturnTypeRawName string
ModelPackage map[string]string
GenHandler bool // Whether to generate one handler, when an idl interface corresponds to multiple http method
// Annotations map[string]string
Models map[string]*model.Model
}
type HttpPackageGenerator ¶
type HttpPackageGenerator struct {
ServiceGroup string
ConfigPath string // package template path
CmdType string
Backend meta.Backend // model template
Options []Option
ProjPackage string // go module for project
ModelDir string
UseDir string // model dir for third repo
ClientDir string // client dir for "new"/"update" command
IdlClientDir string // client dir for "client" command
ForceClientDir string // client dir without namespace for "client" command
BaseDomain string // request domain for "client" command
QueryEnumAsInt bool // client code use number for query parameter
ServiceGenDir string
NeedModel bool
SnakeStyleMiddleware bool // use snake name style for middleware
ForceUpdateClient bool // force update 'crafter_client.go'
tpl.TemplateGenerator
// contains filtered or unexported fields
}
HttpPackageGenerator is used to record the configuration related to generating crafter http code.
func (*HttpPackageGenerator) GenModel ¶
func (pkgGen *HttpPackageGenerator) GenModel(data *model.Model, gen bool) error
func (*HttpPackageGenerator) GeneratePackage ¶
func (pkgGen *HttpPackageGenerator) GeneratePackage(pkg *PackageDescription) error
func (*HttpPackageGenerator) Init ¶
func (pkgGen *HttpPackageGenerator) Init() error
func (*HttpPackageGenerator) LoadBackend ¶
func (pkgGen *HttpPackageGenerator) LoadBackend(backend meta.Backend) error
type IDLPackageRenderInfo ¶
type IDLPackageRenderInfo struct {
FilePathRenderInfo
ServiceInfos *PackageDescription
}
type Layout ¶
type Layout struct {
OutDir string
GoModule string
ServiceName string
HasIdl bool
NeedGoMod bool
ModelDir string
HandlerDir string
RouterDir string
}
Layout contains the basic information of idl
type LayoutGenerator ¶
type LayoutGenerator struct {
ConfigPath string
tpl.TemplateGenerator
}
LayoutGenerator contains the information generated by generating the layout template
func (*LayoutGenerator) Degenerate ¶
func (lg *LayoutGenerator) Degenerate() error
func (*LayoutGenerator) Generate ¶
func (lg *LayoutGenerator) Generate(data map[string]interface{}) error
func (*LayoutGenerator) GenerateByConfig ¶
func (lg *LayoutGenerator) GenerateByConfig(configPath string) error
func (*LayoutGenerator) GenerateByService ¶
func (lg *LayoutGenerator) GenerateByService(service Layout) error
func (*LayoutGenerator) Init ¶
func (lg *LayoutGenerator) Init() error
type ModelBackend ¶
type PackageDescription ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.