Documentation
¶
Index ¶
- Constants
- func PrintSpec(siteSpec SiteSpec)
- func SetServiceName(spec *SiteSpec) (string, error)
- type Annotation
- type ArrayType
- type Doc
- type DocNode
- type Field
- type Handler
- type InterfaceType
- type MapType
- type MenuEntry
- type Method
- type Module
- type Page
- type PointerType
- type PrimitiveType
- type PubSubNode
- type RequestType
- type Server
- type Service
- type SiteSpec
- type SocketNode
- type StructType
- type TopicNode
- type Type
Constants ¶
const RoutePrefixKey = "prefix"
Define the constants used in the spec
Variables ¶
This section is empty.
Functions ¶
func SetServiceName ¶
Types ¶
type Annotation ¶
type Annotation struct {
Properties map[string]interface{}
}
Annotation defines key-value properties for annotations
func NewAnnotation ¶
func NewAnnotation(properties map[string]interface{}) Annotation
NewAnnotation creates a new annotation
type ArrayType ¶
ArrayType describes an array type
func (*ArrayType) GetComments ¶
func (*ArrayType) GetDocuments ¶
type DocNode ¶
type DocNode struct {
Annotation Annotation
}
DocNode represents a doc block in a handler
type Field ¶
Field describes the field of a structure
func (*Field) GetComments ¶
func (*Field) GetDocuments ¶
type Handler ¶
Handler describes a Site handler
func NewHandler ¶
NewHandler creates a new handler node
type InterfaceType ¶
type InterfaceType struct {
Name string
}
InterfaceType describes an interface type
func NewInterfaceType ¶
func NewInterfaceType(name string) *InterfaceType
NewInterfaceType creates a new interface type
func (*InterfaceType) GetComments ¶
func (t *InterfaceType) GetComments() []string
func (*InterfaceType) GetDocuments ¶
func (t *InterfaceType) GetDocuments() []string
func (*InterfaceType) GetFields ¶
func (t *InterfaceType) GetFields() []Field
func (*InterfaceType) GetName ¶
func (t *InterfaceType) GetName() string
Methods to implement the Type interface for InterfaceType
type MapType ¶
MapType describes a map type
func NewMapType ¶
NewMapType creates a new map type
func (*MapType) GetComments ¶
func (*MapType) GetDocuments ¶
type MenuEntry ¶
type MenuEntry struct { Title string Weight int Icon string URL string Subtitle string MobileTitle string Lead string InMobile bool IsAtEnd bool IsDropdown bool HxDisable bool Parent string Children []MenuEntry Attributes map[string]string IsButton bool }
Define the types used in the spec
func NewMenuEntries ¶
func NewMenuEntry ¶
type Method ¶
type Method struct { Method string Prefix string Route string StaticRouteRewrite string Request string RequestType Type Response string ResponseType Type Page *Page Doc *DocNode HandlerDoc Doc HandlerComment Doc DocAnnotation Annotation SocketNode *SocketNode PubSubNode *PubSubNode HasRequestType bool HasResponseType bool HasPage bool ReturnsPartial bool ReturnsPlainText bool ReturnsJson bool ReturnsRedirect bool RedirectURL string IsStatic bool IsStaticEmbed bool IsSocket bool IsDownload bool IsPubSub bool IsSSE bool IsVideoStream bool IsAudioStream bool IsFullHTMLPage bool NoOutput bool }
Define the types used in the spec
func NewMethod ¶
func NewMethod(m ast.MethodNode, page *Page, doc *DocNode, socketNode *SocketNode, pubSubNode *PubSubNode) Method
NewMethod creates a new method for a handler. m, buildPage(m.Page), buildDoc(m.Doc), buildSocketNode(m.SocketNode)
func (*Method) GetComments ¶
func (*Method) GetDocuments ¶
type PointerType ¶
PointerType describes a pointer type
func NewPointerType ¶
func NewPointerType(t Type) *PointerType
NewPointerType creates a new pointer type
func (*PointerType) GetComments ¶
func (t *PointerType) GetComments() []string
func (*PointerType) GetDocuments ¶
func (t *PointerType) GetDocuments() []string
func (*PointerType) GetFields ¶
func (t *PointerType) GetFields() []Field
func (*PointerType) GetName ¶
func (t *PointerType) GetName() string
Methods to implement the Type interface for PointerType
type PrimitiveType ¶
type PrimitiveType struct {
Name string
}
PrimitiveType describes a primitive type
func NewPrimitiveType ¶
func NewPrimitiveType(name string) *PrimitiveType
NewPrimitiveType creates a new primitive type
func (*PrimitiveType) GetComments ¶
func (t *PrimitiveType) GetComments() []string
func (*PrimitiveType) GetDocuments ¶
func (t *PrimitiveType) GetDocuments() []string
func (*PrimitiveType) GetFields ¶
func (t *PrimitiveType) GetFields() []Field
func (*PrimitiveType) GetName ¶
func (t *PrimitiveType) GetName() string
Methods to implement the Type interface for PrimitiveType
type PubSubNode ¶
Define the types used in the spec
func NewPubSubNode ¶
func NewPubSubNode(method, route string, topicNode ast.TopicNode) *PubSubNode
type RequestType ¶
type RequestType int
const ( FullHTMLPage RequestType = iota PartialHTML JSONOutput NoOutput FormSubmission // Includes both regular form data and file uploads WebSocket SSEStream VideoStream AudioStream )
func DetermineRequestType ¶
func DetermineRequestType(method *ast.MethodNode) RequestType
type Server ¶
type Server struct { Annotation Annotation Services []Service }
Server describes a server block with its services
func (Server) GetAnnotation ¶
annotation methods GetAnnotation returns the value by specified key from @server
type SiteSpec ¶
type SiteSpec struct { Name string Types []Type Servers []Server Modules []Module Menus map[string][]MenuEntry }
SiteSpec describes a Site file
func BuildSiteSpec ¶
type SocketNode ¶
Define the types used in the spec
func NewSocketNode ¶
func NewSocketNode(method, route string, topicNodes []ast.TopicNode) *SocketNode
type StructType ¶
StructType describes a structure type
func NewStructType ¶
func NewStructType(name string, fields []Field, docs, comment Doc) *StructType
NewStructType creates a new struct type
func (*StructType) GetComments ¶
func (t *StructType) GetComments() []string
func (*StructType) GetDocuments ¶
func (t *StructType) GetDocuments() []string
func (*StructType) GetFields ¶
func (t *StructType) GetFields() []Field
func (*StructType) GetName ¶
func (t *StructType) GetName() string
Methods to implement the Type interface for StructType
type TopicNode ¶
type TopicNode struct { Topic string ResponseTopic string InitiatedByClient bool RequestType Type ResponseType Type }
Define the types used in the spec