Documentation
¶
Index ¶
- func NewApp(svc *Service) *tygor.App
- func SetupApp() *tygor.App
- type AppStatus
- type Cmd
- type DiscoverySchema
- type Documentation
- type EndpointDescriptor
- type EnumMember
- type FieldDescriptor
- type GetDiscoveryRequest
- type GetDiscoveryResponse
- type GetSourceRequest
- type GetSourceResponse
- type GetStatusRequest
- type GetStatusResponse
- type GoIdentifier
- type PackageInfo
- type ReloadRequest
- type ReloadResponse
- type Service
- func (s *Service) GetDiscovery(ctx context.Context, req *GetDiscoveryRequest) (*GetDiscoveryResponse, error)
- func (s *Service) GetSource(ctx context.Context, req *GetSourceRequest) (*GetSourceResponse, error)
- func (s *Service) GetStatus(ctx context.Context, req *GetStatusRequest, ...) error
- func (s *Service) Reload(ctx context.Context, req *ReloadRequest) (*ReloadResponse, error)
- func (s *Service) UpdateStatus(ctx context.Context, req *UpdateStatusRequest) (*UpdateStatusResponse, error)
- type ServiceDescriptor
- type SourceLine
- type SourceLocation
- type TypeDescriptor
- type TypeParameter
- type TypeRef
- type UpdateStatusRequest
- type UpdateStatusResponse
- type Warning
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AppStatus ¶
type AppStatus struct {
Status string `json:"status"` // "running", "building", "error", "starting"
Port int `json:"port,omitempty"`
Error string `json:"error,omitempty"`
Phase string `json:"phase,omitempty"` // "prebuild", "build", "runtime"
}
AppStatus represents the status of the user's app as reported by vite plugin.
type Cmd ¶
type DiscoverySchema ¶
type DiscoverySchema struct {
Package PackageInfo `json:"Package"`
Types []TypeDescriptor `json:"Types"`
Services []ServiceDescriptor `json:"Services"`
Warnings []Warning `json:"Warnings,omitempty"`
}
DiscoverySchema is the top-level discovery.json structure.
type Documentation ¶
type Documentation struct {
Summary string `json:"Summary,omitempty"`
Body string `json:"Body,omitempty"`
Deprecated *string `json:"Deprecated,omitempty"`
}
Documentation holds doc comments.
type EndpointDescriptor ¶
type EndpointDescriptor struct {
Name string `json:"name"`
FullName string `json:"fullName"`
Primitive string `json:"primitive"` // "query", "exec", "stream", or "atom"
Path string `json:"path"`
Request *TypeRef `json:"request,omitempty"`
Response *TypeRef `json:"response,omitempty"`
Doc string `json:"doc,omitempty"`
}
EndpointDescriptor describes an RPC endpoint.
type EnumMember ¶
type EnumMember struct {
Name string `json:"name"`
Value any `json:"value"` // string, int64, or float64
Doc string `json:"doc,omitempty"`
}
EnumMember describes a single enum constant.
type FieldDescriptor ¶
type FieldDescriptor struct {
Name string `json:"name"`
Type TypeRef `json:"type"`
JSONName string `json:"jsonName"`
Optional bool `json:"optional,omitempty"`
StringEncoded bool `json:"stringEncoded,omitempty"`
Skip bool `json:"skip,omitempty"`
ValidateTag string `json:"validateTag,omitempty"`
Doc string `json:"doc,omitempty"`
}
FieldDescriptor describes a struct field.
type GetDiscoveryRequest ¶
type GetDiscoveryRequest struct{}
GetDiscoveryRequest is the request for Devtools.GetDiscovery.
type GetDiscoveryResponse ¶
type GetDiscoveryResponse struct {
// Discovery is the parsed discovery schema.
Discovery DiscoverySchema `json:"discovery"`
}
GetDiscoveryResponse returns the discovery.json content.
type GetSourceRequest ¶
type GetSourceRequest struct {
File string `json:"file"`
Line int `json:"line,omitempty"`
Context int `json:"context,omitempty"` // lines of context around Line (default 5)
}
GetSourceRequest is the request for Devtools.GetSource.
type GetSourceResponse ¶
type GetSourceResponse struct {
File string `json:"file"`
Language string `json:"language"`
Lines []SourceLine `json:"lines"`
Context int `json:"context"`
}
GetSourceResponse returns source code with context.
type GetStatusRequest ¶
type GetStatusRequest struct{}
GetStatusRequest is the request for Devtools.GetStatus.
type GetStatusResponse ¶
type GetStatusResponse struct {
Status string `json:"status"`
Port int `json:"port,omitempty"`
Error string `json:"error,omitempty"`
Phase string `json:"phase,omitempty"` // "prebuild", "build", "runtime"
Command *string `json:"command"` // null when not applicable
Cwd string `json:"cwd,omitempty"`
ExitCode *int `json:"exitCode"` // null when not applicable
RawrData []string `json:"rawrData,omitempty"` // sent on initial request
}
GetStatusResponse returns the combined status in flat format for the devtools UI. Status is a discriminated union: "ok", "error", "reloading", "starting", "disconnected".
type GoIdentifier ¶
GoIdentifier is a fully-qualified Go type name.
type PackageInfo ¶
type PackageInfo struct {
Path string `json:"Path"`
Name string `json:"Name"`
Dir string `json:"Dir"`
}
PackageInfo describes the source Go package.
type ReloadRequest ¶
type ReloadRequest struct {
Files []string `json:"files,omitempty"`
Reason string `json:"reason,omitempty"` // "file_change", "manual"
}
ReloadRequest triggers a reload of discovery.json.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service implements the devtools server endpoints.
func (*Service) GetDiscovery ¶
func (s *Service) GetDiscovery(ctx context.Context, req *GetDiscoveryRequest) (*GetDiscoveryResponse, error)
GetDiscovery returns the discovery.json from the rpc-dir.
func (*Service) GetSource ¶
func (s *Service) GetSource(ctx context.Context, req *GetSourceRequest) (*GetSourceResponse, error)
GetSource returns source code with context around a line.
func (*Service) GetStatus ¶
func (s *Service) GetStatus(ctx context.Context, req *GetStatusRequest, stream tygor.StreamWriter[*GetStatusResponse]) error
GetStatus streams status updates for devtools UI consumption. The first message always includes RawrData. Subsequent messages are sent when UpdateStatus is called.
func (*Service) Reload ¶
func (s *Service) Reload(ctx context.Context, req *ReloadRequest) (*ReloadResponse, error)
Reload triggers reloading of discovery.json (called by vite plugin on file changes).
func (*Service) UpdateStatus ¶
func (s *Service) UpdateStatus(ctx context.Context, req *UpdateStatusRequest) (*UpdateStatusResponse, error)
UpdateStatus updates the app status (called by vite plugin). Notifies all connected GetStatus subscribers of the change.
type ServiceDescriptor ¶
type ServiceDescriptor struct {
Name string `json:"name"`
Endpoints []EndpointDescriptor `json:"endpoints"`
Doc string `json:"doc,omitempty"`
}
ServiceDescriptor describes a service and its endpoints.
type SourceLine ¶
type SourceLine struct {
Num int `json:"num"`
Content string `json:"content"`
Highlight bool `json:"highlight,omitempty"`
}
SourceLine represents a single line of source code.
type SourceLocation ¶
type SourceLocation struct {
File string `json:"File"`
Line int `json:"Line"`
Column int `json:"Column"`
}
SourceLocation points to a position in source code.
type TypeDescriptor ¶
type TypeDescriptor struct {
Kind string `json:"kind"` // "struct", "enum", "alias"
Name GoIdentifier `json:"Name"`
TypeParameters []TypeParameter `json:"TypeParameters,omitempty"`
Fields []FieldDescriptor `json:"Fields,omitempty"` // for struct
Members []EnumMember `json:"Members,omitempty"` // for enum
Underlying *TypeRef `json:"Underlying,omitempty"` // for alias
Extends []GoIdentifier `json:"Extends,omitempty"`
Documentation *Documentation `json:"Documentation,omitempty"`
Source *SourceLocation `json:"Source,omitempty"`
}
TypeDescriptor is a named type (struct, enum, or alias). Uses kind discriminator for polymorphism.
type TypeParameter ¶
type TypeParameter struct {
Kind string `json:"kind"` // "typeParameter"
ParamName string `json:"paramName"`
Constraint *TypeRef `json:"constraint,omitempty"`
}
TypeParameter describes a generic type parameter.
type TypeRef ¶
type TypeRef struct {
Kind string `json:"kind"` // "primitive", "reference", "array", "map", "ptr", "union", "typeParameter"
PrimitiveKind string `json:"primitiveKind,omitempty"` // for primitive
BitSize int `json:"bitSize,omitempty"` // for numeric primitives
Name string `json:"name,omitempty"` // for reference
Package string `json:"package,omitempty"` // for reference
Element *TypeRef `json:"element,omitempty"` // for array, ptr
Length int `json:"length,omitempty"` // for array (0 = slice)
Key *TypeRef `json:"key,omitempty"` // for map
Value *TypeRef `json:"value,omitempty"` // for map
Types []TypeRef `json:"types,omitempty"` // for union
ParamName string `json:"paramName,omitempty"` // for typeParameter
Constraint *TypeRef `json:"constraint,omitempty"` // for typeParameter
}
TypeRef is a reference to a type (used in fields, requests, responses). Uses kind discriminator for the various type expression forms.
type UpdateStatusRequest ¶
type UpdateStatusRequest struct {
App AppStatus `json:"app"`
}
UpdateStatusRequest is sent by vite plugin to update app status.
type UpdateStatusResponse ¶
type UpdateStatusResponse struct{}
UpdateStatusResponse is the response for UpdateStatus.