Documentation ¶
Index ¶
- Constants
- Variables
- func ForEachStructField(structType *types.Struct, ...)
- func ParseEnum(doc string) (string, bool)
- func ParseStringFormat(doc string) (string, string)
- func ParseType(typeExpr ast.Expr) (keyType, pkgName string, pointer bool)
- func RetrievePackageName(path string) string
- func StringifyCommentGroup(commentGroupList ...*ast.CommentGroup) (comments string)
- type ByCommentPos
- type CommentScanner
- type DefinitionScanner
- type Enum
- type EnumScanner
- type Keys
- type ModelScanner
- func (m *ModelScanner) IsScanned() bool
- func (m *ModelScanner) Scan(modelName *types.TypeName, comments string)
- func (m *ModelScanner) WriteRepository(repository *codegen.File, parameter *codegen.File)
- func (m *ModelScanner) WriteRouters(controllerPkgPath string, errorPkgPath string) map[string]*codegen.File
- type ModelScannerConfig
- type Operator
- type OperatorScanner
- type OperatorWithTypeName
- type Route
- type Router
- func (router *Router) AppendOperators(operators ...*OperatorWithTypeName)
- func (router *Router) Name() string
- func (router *Router) Register(r *Router)
- func (router *Router) Route() *Route
- func (router *Router) Routes() (routes []*Route)
- func (router *Router) String() string
- func (router *Router) With(operators ...*OperatorWithTypeName)
- type RouterScanner
- func (scanner *RouterScanner) OperatorScanner() *OperatorScanner
- func (scanner *RouterScanner) OperatorTypeNameFromType(typ types.Type) *OperatorWithTypeName
- func (scanner *RouterScanner) OperatorTypeNamesFromArgs(pkg *packagex.Package, args ...ast.Expr) []*OperatorWithTypeName
- func (scanner *RouterScanner) Router(typeName *types.Var) *Router
- type SchemaRefer
- type StatusErrScanner
- type StructFieldUniqueChecker
- type VendorExtensible
Constants ¶
View Source
const ( XID = `x-id` XGoVendorType = `x-go-vendor-type` XGoStarLevel = `x-go-star-level` XGoFieldName = `x-go-field-name` XTagValidate = `x-tag-validate` XTagMime = `x-tag-mime` XTagJSON = `x-tag-json` XTagXML = `x-tag-xml` XTagName = `x-tag-name` XEnumOptions = `x-enum-options` XStatusErrs = `x-status-errors` XAnnotationRevert = `x-annotation-revert` )
Variables ¶
View Source
var ( PkgImportPathClient = reflectx.ImportGoPath(reflect.TypeOf(client.Client{}).PkgPath()) PkgImportPathStatusErr = reflectx.ImportGoPath(reflect.TypeOf(status_error.StatusErrorCode(0)).PkgPath()) )
Functions ¶
func ForEachStructField ¶ added in v1.3.1
func ParseStringFormat ¶
func RetrievePackageName ¶
func StringifyCommentGroup ¶
func StringifyCommentGroup(commentGroupList ...*ast.CommentGroup) (comments string)
Types ¶
type ByCommentPos ¶
type ByCommentPos []*ast.CommentGroup
func (ByCommentPos) Len ¶
func (a ByCommentPos) Len() int
func (ByCommentPos) Less ¶
func (a ByCommentPos) Less(i, j int) bool
func (ByCommentPos) Swap ¶
func (a ByCommentPos) Swap(i, j int)
type CommentScanner ¶
type CommentScanner struct { CommentMap ast.CommentMap // contains filtered or unexported fields }
func NewCommentScanner ¶
func NewCommentScanner(fileSet *token.FileSet, file *ast.File) *CommentScanner
func (*CommentScanner) CommentGroupListOf ¶
func (scanner *CommentScanner) CommentGroupListOf(targetNode ast.Node) (commentGroupList []*ast.CommentGroup)
func (*CommentScanner) CommentsOf ¶
func (scanner *CommentScanner) CommentsOf(targetNode ast.Node) string
type DefinitionScanner ¶
type DefinitionScanner struct {
// contains filtered or unexported fields
}
func NewDefinitionScanner ¶
func NewDefinitionScanner(pkg *packagex.Package) *DefinitionScanner
func (*DefinitionScanner) BindSchemas ¶
func (scanner *DefinitionScanner) BindSchemas(openapi *oas.OpenAPI)
func (*DefinitionScanner) Def ¶
func (scanner *DefinitionScanner) Def(typeName *types.TypeName) *oas.Schema
func (*DefinitionScanner) GetSchemaByType ¶
func (scanner *DefinitionScanner) GetSchemaByType(typ types.Type) *oas.Schema
type Enum ¶
type Enum enumeration.Enum
type EnumScanner ¶
type EnumScanner struct { EnumSet map[*types.TypeName][]enumeration.EnumOption // contains filtered or unexported fields }
func NewEnumScanner ¶
func NewEnumScanner(pkg *packagex.Package) *EnumScanner
func (*EnumScanner) Enum ¶
func (scanner *EnumScanner) Enum(typeName *types.TypeName) []enumeration.EnumOption
type Keys ¶ added in v1.3.1
func (*Keys) PatchUniqueIndexesWithSoftDelete ¶ added in v1.3.1
type ModelScanner ¶ added in v1.3.1
type ModelScanner struct { *types.TypeName *ModelScannerConfig *Keys *builder.Table Fields map[string]*types.Var FieldKeyAutoIncrement string HasDeletedAt bool HasCreatedAt bool HasUpdatedAt bool HasAutoIncrement bool // contains filtered or unexported fields }
func NewModelScanner ¶ added in v1.3.1
func NewModelScanner(pkg *packagex.Package, cfg *ModelScannerConfig) *ModelScanner
func (*ModelScanner) IsScanned ¶ added in v1.3.1
func (m *ModelScanner) IsScanned() bool
func (*ModelScanner) Scan ¶ added in v1.3.1
func (m *ModelScanner) Scan(modelName *types.TypeName, comments string)
func (*ModelScanner) WriteRepository ¶ added in v1.4.1
func (m *ModelScanner) WriteRepository(repository *codegen.File, parameter *codegen.File)
func (*ModelScanner) WriteRouters ¶ added in v1.3.1
type ModelScannerConfig ¶ added in v1.3.1
type ModelScannerConfig struct { StructName string TableName string WithIDClient *bool WithReadPagination *bool FieldKeyUniqueID string FieldKeyDeletedAt string FieldKeyCreatedAt string FieldKeyUpdatedAt string ControllerPath string ErrorPath string }
func (*ModelScannerConfig) SetDefaults ¶ added in v1.3.1
func (g *ModelScannerConfig) SetDefaults()
type Operator ¶
type Operator struct { transport_http.RouteMeta Tag string Description string Annotation map[string]string NonBodyParameters map[string]*oas.Parameter RequestBody *oas.RequestBody StatusErrors []*status_error.StatusError StatusErrorSchema *oas.Schema SuccessStatus int SuccessType types.Type SuccessResponse *oas.Response }
func (*Operator) AddNonBodyParameter ¶
func (*Operator) BindOperation ¶
func (*Operator) SetRequestBody ¶
func (operator *Operator) SetRequestBody(requestBody *oas.RequestBody)
type OperatorScanner ¶
type OperatorScanner struct { *DefinitionScanner *StatusErrScanner // contains filtered or unexported fields }
func NewOperatorScanner ¶
func NewOperatorScanner(pkg *packagex.Package) *OperatorScanner
type OperatorWithTypeName ¶
func (*OperatorWithTypeName) String ¶
func (operator *OperatorWithTypeName) String() string
type Route ¶
type Route struct { Operators []*OperatorWithTypeName // contains filtered or unexported fields }
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
func (*Router) AppendOperators ¶
func (router *Router) AppendOperators(operators ...*OperatorWithTypeName)
func (*Router) With ¶
func (router *Router) With(operators ...*OperatorWithTypeName)
type RouterScanner ¶
type RouterScanner struct {
// contains filtered or unexported fields
}
func NewRouterScanner ¶
func NewRouterScanner(pkg *packagex.Package) *RouterScanner
func (*RouterScanner) OperatorScanner ¶
func (scanner *RouterScanner) OperatorScanner() *OperatorScanner
func (*RouterScanner) OperatorTypeNameFromType ¶
func (scanner *RouterScanner) OperatorTypeNameFromType(typ types.Type) *OperatorWithTypeName
func (*RouterScanner) OperatorTypeNamesFromArgs ¶
func (scanner *RouterScanner) OperatorTypeNamesFromArgs(pkg *packagex.Package, args ...ast.Expr) []*OperatorWithTypeName
type SchemaRefer ¶
func NewSchemaRefer ¶
func NewSchemaRefer(s *oas.Schema) *SchemaRefer
func (SchemaRefer) RefString ¶
func (r SchemaRefer) RefString() string
type StatusErrScanner ¶
type StatusErrScanner struct { StatusErrType *types.Named // contains filtered or unexported fields }
func NewStatusErrScanner ¶
func NewStatusErrScanner(pkg *packagex.Package) *StatusErrScanner
func (*StatusErrScanner) StatusErrorsInFunc ¶
func (scanner *StatusErrScanner) StatusErrorsInFunc(typeFunc *types.Func) []*status_error.StatusError
type VendorExtensible ¶
type VendorExtensible interface {
AddExtension(key string, value interface{})
}
Click to show internal directories.
Click to hide internal directories.