Documentation
¶
Index ¶
- Constants
- Variables
- func ExecuteTemplate(name string, data any) (string, error)
- func OperationName(operationID string, path specification.Path, method string) string
- func PrefixTitle(s specification.Prefix) string
- func PrivateFieldName(name string) string
- func PublicFieldName(name string) string
- func Title(s string) string
- type AssignData
- type BoolType
- type Client
- type CustomType
- type CustomTypeParser
- type ErrorRender
- type ExecTemplater
- type FloatType
- type Formatter
- type FormatterFunc
- type GenOption
- type Generator
- type GoFile
- type Handler
- type HandlerOld
- type HandlersFile
- type Header
- type HeaderParameter
- type IntType
- type Operation
- type Optional
- type Options
- type Param
- type Parameter
- type Parser
- type ParserFunc
- type PathDir
- type PathItem
- type PathParameter
- type PathParameters
- type PointerType
- type QueryParameter
- type RawTemplate
- type Render
- type RenderFunc
- type Response
- type RouterFile
- type Schema
- type SchemaFunc
- type SliceType
- type StringConst
- type StringRender
- type StringType
- type StringerType
- type TData
- type Template
- type Templater
- type TemplaterFunc
- type Templaters
Constants ¶
View Source
const ExtTagGoType = "x-goag-go-type"
Variables ¶
View Source
var CustomImports []string
Functions ¶
func OperationName ¶ added in v0.0.2
func OperationName(operationID string, path specification.Path, method string) string
func PrefixTitle ¶ added in v0.0.2
func PrefixTitle(s specification.Prefix) string
func PrivateFieldName ¶
func PublicFieldName ¶
Types ¶
type AssignData ¶ added in v0.0.2
type BoolType ¶ added in v0.0.10
type BoolType struct{}
func (BoolType) RenderFormat ¶ added in v0.0.10
func (BoolType) RenderParser ¶ added in v0.0.10
func (b BoolType) RenderParser(from, to Render, mkErr ErrorRender) (string, error)
type CustomType ¶ added in v0.0.5
type CustomType string
func NewCustomType ¶ added in v0.0.8
func NewCustomType(s string) CustomType
func (CustomType) Parser ¶ added in v0.0.5
func (c CustomType) Parser(from, to string, mkErr source.ErrorWrapper) source.Render
func (CustomType) String ¶ added in v0.0.5
func (c CustomType) String() (string, error)
func (CustomType) TemplateToString ¶ added in v0.0.8
func (c CustomType) TemplateToString(t Templater) Templater
type CustomTypeParser ¶ added in v0.0.5
type CustomTypeParser struct {
Type string
From string
To string
Error source.ErrorWrapper
}
func (CustomTypeParser) String ¶ added in v0.0.5
func (c CustomTypeParser) String() (string, error)
type ErrorRender ¶ added in v0.0.10
type ExecTemplater ¶ added in v0.0.2
type FloatType ¶ added in v0.0.10
type FloatType struct {
BitSize int
}
func (FloatType) RenderFormat ¶ added in v0.0.10
func (FloatType) RenderParser ¶ added in v0.0.10
func (i FloatType) RenderParser(from, to Render, mkErr ErrorRender) (string, error)
type FormatterFunc ¶ added in v0.0.10
func (FormatterFunc) RenderFormat ¶ added in v0.0.10
func (f FormatterFunc) RenderFormat(from Render) (string, error)
type GenOption ¶ added in v0.0.2
type GenOption interface {
// contains filtered or unexported methods
}
func PackageName ¶ added in v0.0.2
func SkipDoNotEdit ¶ added in v0.0.2
func SkipDoNotEdit() GenOption
type Generator ¶ added in v0.0.2
type Generator struct {
Options Options
Spec *specification.Spec
Handlers []Handler
Client Client
Paths []*PathItem
Operations []*Operation
}
func NewGenerator ¶ added in v0.0.2
func NewGenerator(spec *specification.Spec, opts ...GenOption) (*Generator, error)
func (*Generator) ClientFile ¶ added in v0.0.2
func (*Generator) HandlersFile ¶ added in v0.0.2
func (g *Generator) HandlersFile(hs []HandlerOld, isJSON bool) (Templater, error)
func (*Generator) RouterFile ¶ added in v0.0.2
type Handler ¶
type Handler struct {
Name string
Method string
HTTPMethod string
Path specification.Path
PathBuilder []PathDir
HandlerTypeName string
HandlerInputTypeName string
RequestTypeName string
RequestVarName string
Params struct {
Query []QueryParameter
Path PathParameters
Headers []HeaderParameter
}
IsRequestBody bool
ResponseTypeName string
ResponsePrivateFuncName string
DefaultResponse Optional[*Response]
Responses []*Response
// contains filtered or unexported fields
}
func NewHandler ¶
func NewHandler(o *specification.Operation) (zero Handler, _ error)
type HandlerOld ¶ added in v0.0.2
type HandlerOld struct {
// deprecated
Name string
Description string
Summary string
BasePathPrefix string
CanParseError bool
ResponserInterfaceName string
Parameters struct {
Query []Param
Path []Param
Headers []Param
PathParsers []Templater
}
Body struct {
TypeName Templater
}
IsWriteJSONFunc bool
Responses []Templater
}
func (HandlerOld) Execute ¶ added in v0.0.2
func (h HandlerOld) Execute() (string, error)
func (HandlerOld) HandlerFuncName ¶ added in v0.0.2
func (h HandlerOld) HandlerFuncName() string
type HandlersFile ¶ added in v0.0.2
type HandlersFile struct {
Handlers []HandlerOld
IsWriteJSONFunc bool
}
func (HandlersFile) Execute ¶ added in v0.0.2
func (h HandlersFile) Execute() (string, error)
type Header ¶ added in v0.0.2
type Header struct {
Spec specification.Header
FieldName string
Key string
}
func NewHeader ¶ added in v0.0.2
func NewHeader(spec specification.Header) Header
type HeaderParameter ¶ added in v0.0.2
type HeaderParameter struct {
Name string
FieldName string
FieldTypeName string
Type Schema
Required bool
// contains filtered or unexported fields
}
func NewHeaderParameter ¶ added in v0.0.2
func NewHeaderParameter(s *specification.HeaderParameter) HeaderParameter
type IntType ¶ added in v0.0.2
type IntType struct {
BitSize int
}
func (IntType) RenderFormat ¶ added in v0.0.10
func (IntType) RenderParser ¶ added in v0.0.10
func (i IntType) RenderParser(from, to Render, mkErr ErrorRender) (string, error)
type Operation ¶ added in v0.0.2
type Operation struct {
Operation *specification.Operation
Name string
HandlerTypeName string
PathParameters []Parameter[*specification.PathParameter]
QueryParameters []Parameter[specification.QueryParameter]
HeaderParameters []Parameter[*specification.HeaderParameter]
Handler *HandlerOld // Deprecated
}
func NewOperation ¶ added in v0.0.2
func NewOperation(operation *specification.Operation) *Operation
type Parameter ¶ added in v0.0.2
type Parameter[T interface {
*specification.PathParameter | specification.QueryParameter | *specification.HeaderParameter
}] struct {
Spec T
FieldName string
}
type Parser ¶ added in v0.0.10
type Parser interface {
RenderParser(from, to Render, mkErr ErrorRender) (string, error)
}
type ParserFunc ¶ added in v0.0.10
type ParserFunc func(from, to Render, mkErr ErrorRender) (string, error)
func (ParserFunc) RenderParser ¶ added in v0.0.10
func (p ParserFunc) RenderParser(from, to Render, mkErr ErrorRender) (string, error)
type PathDir ¶ added in v0.0.2
type PathDir struct {
V string
Param *PathParameter
}
func (PathDir) FormatTemplater ¶ added in v0.0.2
type PathItem ¶
type PathItem struct {
PathItem *specification.PathItem
Operations []*Operation
}
type PathParameter ¶
type PathParameter struct {
Name string
FieldName string
FieldTypeName string
Type Schema
// contains filtered or unexported fields
}
func NewPathParameter ¶
func NewPathParameter(s *specification.PathParameter) PathParameter
type PathParameters ¶ added in v0.0.2
type PathParameters []PathParameter
func (PathParameters) Get ¶ added in v0.0.2
func (s PathParameters) Get(name string) (zero PathParameter, _ error)
type PointerType ¶ added in v0.0.2
type PointerType struct {
From, T Templater
}
func (PointerType) FormatAssignTemplater ¶ added in v0.0.2
func (_ PointerType) FormatAssignTemplater(from, to Templater, isNew bool) Templater
func (PointerType) TemplateToString ¶ added in v0.0.2
func (_ PointerType) TemplateToString(t Templater) Templater
type QueryParameter ¶ added in v0.0.2
type QueryParameter struct {
Name string
FieldName string
Required bool
Type Schema
// contains filtered or unexported fields
}
func NewQueryParameter ¶ added in v0.0.2
func NewQueryParameter(s specification.QueryParameter) QueryParameter
func (QueryParameter) ExecuteFormat ¶ added in v0.0.2
func (p QueryParameter) ExecuteFormat(from, to string) (string, error)
type RawTemplate ¶ added in v0.0.2
type RawTemplate string
func (RawTemplate) Execute ¶ added in v0.0.2
func (t RawTemplate) Execute() (string, error)
func (RawTemplate) String ¶ added in v0.0.2
func (t RawTemplate) String() (string, error)
type RenderFunc ¶ added in v0.0.10
func (RenderFunc) Render ¶ added in v0.0.10
func (r RenderFunc) Render() (string, error)
type Response ¶
type Response struct {
Name string
StatusCode string
Headers []Header
Body Optional[any]
// contains filtered or unexported fields
}
func NewResponse ¶
func NewResponse(handlerName string, response *specification.Response) *Response
type RouterFile ¶ added in v0.0.2
type RouterFile struct {
BasePath string
BaseSpecFilename string
SpecFileExt string
Handlers []routerHandler
Routes []routeMethod
}
func (RouterFile) Execute ¶ added in v0.0.2
func (r RouterFile) Execute() (string, error)
type SchemaFunc ¶ added in v0.0.10
func (SchemaFunc) TemplateToString ¶ added in v0.0.10
func (s SchemaFunc) TemplateToString(t Templater) Templater
type SliceType ¶ added in v0.0.2
type SliceType struct {
Items Schema
}
func (SliceType) TemplateToString ¶ added in v0.0.2
type StringConst ¶ added in v0.0.2
type StringConst string
func (StringConst) Execute ¶ added in v0.0.2
func (s StringConst) Execute() (string, error)
func (StringConst) String ¶ added in v0.0.2
func (s StringConst) String() (string, error)
type StringRender ¶ added in v0.0.10
type StringRender string
func (StringRender) Render ¶ added in v0.0.10
func (s StringRender) Render() (string, error)
type StringType ¶
type StringType struct{}
func (StringType) FormatAssignTemplater ¶ added in v0.0.2
func (_ StringType) FormatAssignTemplater(from, to Templater, isNew bool) Templater
func (StringType) TemplateToString ¶ added in v0.0.2
func (_ StringType) TemplateToString(t Templater) Templater
type StringerType ¶ added in v0.0.5
type StringerType struct {
T Templater
}
func (StringerType) TemplateToString ¶ added in v0.0.5
func (_ StringerType) TemplateToString(t Templater) Templater
type Template ¶ added in v0.0.2
type Template struct {
// contains filtered or unexported fields
}
func InitTemplate ¶ added in v0.0.2
type Templater ¶ added in v0.0.2
func AssignTemplate ¶ added in v0.0.2
func OldTemplater ¶ added in v0.0.2
func TemplateData ¶ added in v0.0.2
func ToSliceStrings ¶ added in v0.0.2
type TemplaterFunc ¶ added in v0.0.10
func (TemplaterFunc) String ¶ added in v0.0.10
func (t TemplaterFunc) String() (string, error)
type Templaters ¶ added in v0.0.2
type Templaters []Templater
func (Templaters) Execute ¶ added in v0.0.2
func (t Templaters) Execute() (string, error)
func (Templaters) ExecuteArgs ¶ added in v0.0.2
func (t Templaters) ExecuteArgs(args ...any) (string, error)
Click to show internal directories.
Click to hide internal directories.