Documentation ¶
Index ¶
- Constants
- func AsCommentLines(comment string) string
- func BasicType(schemaType string, format string, ipt *importer.PackageImporter) string
- func GetEnumByServiceName(serviceName string) map[string]enumeration.Enum
- func PathFromSwaggerPath(str string) string
- func RefName(ref oas.Refer) string
- func RegisterEnum(serviceName string, tpe string, options ...enumeration.EnumOption)
- func RequestOf(id string) string
- func ResponseOf(id string) string
- type Annotation
- type AnnotationRevert
- type Field
- type Op
- type Operation
- func (o *Operation) Annotation() map[string]Annotation
- func (o *Operation) CanRevert() bool
- func (o *Operation) HasRequest() bool
- func (o *Operation) ID() string
- func (o *Operation) Method() string
- func (o *Operation) Path() string
- func (o *Operation) RevertIDField() string
- func (o *Operation) RevertTarget() string
- func (o *Operation) WriteReqType(w io.Writer, ipt *importer.PackageImporter) error
- func (o *Operation) WriteRespBodyType(w io.Writer, ipt *importer.PackageImporter) error
- type Tag
- type Tags
- type TypeGenerator
- func (g *TypeGenerator) FieldFrom(name string, propSchema *oas.Schema, requiredFields ...string) *Field
- func (g *TypeGenerator) PrefixType(tpe string) string
- func (g *TypeGenerator) Type(schema *oas.Schema) (string, bool)
- func (g *TypeGenerator) TypeIndirect(schema *oas.Schema) (string, bool)
- func (g *TypeGenerator) WriteFields(w io.Writer, schema *oas.Schema) error
Constants ¶
View Source
const ( CmdGenerateGetRevertID = "generate_get_revert_id" CmdGenerateInterface = "generate_interface" CmdGenerateImplement = "generate_implement" )
Variables ¶
This section is empty.
Functions ¶
func AsCommentLines ¶
func BasicType ¶
func BasicType(schemaType string, format string, ipt *importer.PackageImporter) string
func GetEnumByServiceName ¶
func GetEnumByServiceName(serviceName string) map[string]enumeration.Enum
func PathFromSwaggerPath ¶
func RegisterEnum ¶
func RegisterEnum(serviceName string, tpe string, options ...enumeration.EnumOption)
func ResponseOf ¶
Types ¶
type Annotation ¶
type Annotation interface { ID() string Extension() string SetArgs(args ...string) Importer() *importer.PackageImporter Run(cmd string, op Op) string }
func NewAnnotationRevert ¶
func NewAnnotationRevert(id, extension string) Annotation
type AnnotationRevert ¶
type AnnotationRevert struct {
// contains filtered or unexported fields
}
func (*AnnotationRevert) Extension ¶
func (a *AnnotationRevert) Extension() string
func (*AnnotationRevert) ID ¶
func (a *AnnotationRevert) ID() string
func (*AnnotationRevert) Importer ¶
func (a *AnnotationRevert) Importer() *importer.PackageImporter
func (*AnnotationRevert) SetArgs ¶
func (a *AnnotationRevert) SetArgs(args ...string)
type Op ¶
type Op interface { ID() string Method() string Path() string HasRequest() bool Annotation() map[string]Annotation WriteReqType(w io.Writer, ipt *importer.PackageImporter) error WriteRespBodyType(w io.Writer, ipt *importer.PackageImporter) error CanRevert() bool RevertIDField() string RevertTarget() string }
type Operation ¶
func NewOperation ¶
func (*Operation) Annotation ¶
func (o *Operation) Annotation() map[string]Annotation
func (*Operation) HasRequest ¶
func (*Operation) RevertIDField ¶
func (*Operation) RevertTarget ¶
func (*Operation) WriteReqType ¶
func (*Operation) WriteRespBodyType ¶
type TypeGenerator ¶
type TypeGenerator struct { ServiceName string Importer *importer.PackageImporter }
func NewTypeGenerator ¶
func NewTypeGenerator(serviceName string, ipt *importer.PackageImporter) *TypeGenerator
func (*TypeGenerator) PrefixType ¶
func (g *TypeGenerator) PrefixType(tpe string) string
func (*TypeGenerator) TypeIndirect ¶
func (g *TypeGenerator) TypeIndirect(schema *oas.Schema) (string, bool)
func (*TypeGenerator) WriteFields ¶
Click to show internal directories.
Click to hide internal directories.