Documentation
¶
Index ¶
- Constants
- func ParseSQLSchema(app *apps.Instance, schema string) (*daemon.SQLCPlugin_Catalog, error)
- type AINotification
- type AINotifier
- type AISessionID
- type AIStreamMessage
- type AIStreamUpdate
- type AIUpdateType
- type BaseAIUpdateType
- type CodeType
- type Endpoint
- type EndpointUpdate
- type Error
- type ErrorUpdate
- type LazySubClient
- type LocalEndpointUpdate
- type Manager
- func (m *Manager) DefineEndpoints(ctx context.Context, appSlug string, sessionID AISessionID, prompt string, ...) (string, error)
- func (m *Manager) ModifySystemDesign(ctx context.Context, appSlug string, sessionID AISessionID, ...) (string, error)
- func (m *Manager) ParseCode(ctx context.Context, services []Service, app *apps.Instance) (*SyncResult, error)
- func (m *Manager) PreviewFiles(ctx context.Context, services []Service, app *apps.Instance) (*PreviewFilesResponse, error)
- func (m *Manager) ProposeSystemDesign(ctx context.Context, appSlug, prompt string, md *meta.Data, ...) (string, error)
- func (m *Manager) Unsubscribe(id string) error
- func (m *Manager) UpdateCode(ctx context.Context, services []Service, app *apps.Instance, overwrite bool) (*SyncResult, error)
- func (m *Manager) WriteFiles(ctx context.Context, services []Service, app *apps.Instance) (*WriteFilesResponse, error)
- type PathParamUpdate
- type PathSegment
- type PathSegments
- type Pos
- type PreviewFile
- type PreviewFilesResponse
- type Result
- type SegmentType
- type SegmentValueType
- type Service
- type ServiceInput
- type ServiceUpdate
- type SessionUpdate
- type SyncResult
- type TaskMessage
- type TitleUpdate
- type Type
- type TypeField
- type TypeFieldUpdate
- type TypeUpdate
- type ValidationError
- type VisibilityType
- type WriteFilesResponse
Constants ¶
const ( PathDocPrefix = "Path Parameters" ErrDocPrefix = "Errors" )
Variables ¶
This section is empty.
Functions ¶
func ParseSQLSchema ¶
ParseSQLSchema uses SQLC to parse the migration files for an encore database and returns the parsed catalog
Types ¶
type AINotification ¶
type AINotification struct {
SubscriptionID string `json:"subscriptionId,omitempty"`
Value any `json:"value,omitempty"`
Error string `json:"error,omitempty"`
Finished bool `json:"finished,omitempty"`
}
AINotification is a wrapper around messages and errors from the encore platform ai service
type AINotifier ¶
type AINotifier func(context.Context, *AINotification) error
type AISessionID ¶
type AISessionID string
type AIStreamMessage ¶
type AIStreamMessage struct {
Value TaskMessage
Error string
Finished bool
}
type AIStreamUpdate ¶
type AIStreamUpdate = Result[AIUpdateType]
type AIUpdateType ¶
type AIUpdateType interface {
IsAIUpdateType()
}
type BaseAIUpdateType ¶
type BaseAIUpdateType struct {
Type string `graphql:"__typename" json:"type"`
}
func (BaseAIUpdateType) IsAIUpdateType ¶
func (b BaseAIUpdateType) IsAIUpdateType()
type Endpoint ¶
type Endpoint struct {
ID string `json:"id,omitempty"`
Name string `json:"name"`
Doc string `json:"doc"`
Method string `json:"method"`
Visibility VisibilityType `json:"visibility"`
Path PathSegments `json:"path"`
RequestType string `json:"requestType,omitempty"`
ResponseType string `json:"responseType,omitempty"`
Errors []*Error `json:"errors,omitempty"`
Types []*Type `json:"types,omitempty"`
Language string `json:"language,omitempty"`
TypeSource string `json:"typeSource,omitempty"`
EndpointSource string `json:"endpointSource,omitempty"`
}
type EndpointUpdate ¶
type EndpointUpdate struct {
BaseAIUpdateType
Service string `json:"service,omitempty"`
Name string `json:"name,omitempty"`
Doc string `json:"doc,omitempty"`
Method string `json:"method,omitempty"`
Visibility VisibilityType `json:"visibility,omitempty"`
Path []PathSegment `json:"path,omitempty"`
RequestType string `json:"requestType,omitempty"`
ResponseType string `json:"responseType,omitempty"`
Errors []string `json:"errors,omitempty"`
}
type ErrorUpdate ¶
type ErrorUpdate struct {
BaseAIUpdateType
Code string `json:"code,omitempty"`
Doc string `json:"doc,omitempty"`
Service string `json:"service,omitempty"`
Endpoint string `json:"endpoint,omitempty"`
}
type LazySubClient ¶
type LazySubClient struct {
*graphql.SubscriptionClient
// contains filtered or unexported fields
}
LazySubClient is a wrapper around graphql.SubscriptionClient that starts the client when the first subscription is made. It also stops the client when the last subscription is removed and reconnects when a subscription is added.
type LocalEndpointUpdate ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager exposes the ai functionality to the local dashboard
func NewAIManager ¶
func NewAIManager(client *graphql.SubscriptionClient) *Manager
func (*Manager) DefineEndpoints ¶
func (*Manager) ModifySystemDesign ¶
func (*Manager) PreviewFiles ¶
func (*Manager) ProposeSystemDesign ¶
func (*Manager) Unsubscribe ¶
func (*Manager) UpdateCode ¶
func (*Manager) WriteFiles ¶
type PathParamUpdate ¶
type PathParamUpdate struct {
BaseAIUpdateType
Service string `json:"service,omitempty"`
Endpoint string `json:"endpoint,omitempty"`
Param string `json:"param,omitempty"`
Doc string `json:"doc,omitempty"`
}
type PathSegment ¶
type PathSegment struct {
Type SegmentType `json:"type,omitempty"`
Value *string `json:"value,omitempty"`
ValueType *SegmentValueType `json:"valueType,omitempty"`
Doc string `graphql:"-" json:"doc,omitempty"`
}
func (PathSegment) DocItem ¶
func (p PathSegment) DocItem() (string, string)
type PathSegments ¶
type PathSegments []PathSegment
func (PathSegments) Render ¶
func (p PathSegments) Render() (docPath string, goParams []string)
type PreviewFile ¶
type PreviewFilesResponse ¶
type PreviewFilesResponse struct {
Files []PreviewFile `json:"files"`
}
type SegmentType ¶
type SegmentType string
const ( SegmentTypeLiteral SegmentType = "literal" SegmentTypeParam SegmentType = "param" SegmentTypeWildcard SegmentType = "wildcard" SegmentTypeFallback SegmentType = "fallback" )
type SegmentValueType ¶
type SegmentValueType string
const SegmentValueTypeString SegmentValueType = "string"
type Service ¶
type Service struct {
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Doc string `json:"doc,omitempty"`
Endpoints []*Endpoint `json:"endpoints,omitempty"`
}
func (Service) GetEndpoints ¶
func (Service) GraphQL ¶
func (s Service) GraphQL() ServiceInput
GraphQL scrubs data that is not needed for the graphql client
type ServiceInput ¶
type ServiceInput Service
ServiceInput is the graphql input type for our queries the graphQL client we use requires the type name to match the graphql type
type ServiceUpdate ¶
type ServiceUpdate struct {
BaseAIUpdateType
Name string `json:"name,omitempty"`
Doc string `json:"doc,omitempty"`
}
type SessionUpdate ¶
type SessionUpdate struct {
BaseAIUpdateType
Id AISessionID
}
type SyncResult ¶
type SyncResult struct {
Services []Service `json:"services"`
Errors []ValidationError `json:"errors"`
}
type TaskMessage ¶
type TaskMessage struct {
Type string `graphql:"__typename"`
ServiceUpdate `graphql:"... on ServiceUpdate"`
TypeUpdate `graphql:"... on TypeUpdate"`
TypeFieldUpdate `graphql:"... on TypeFieldUpdate"`
ErrorUpdate `graphql:"... on ErrorUpdate"`
EndpointUpdate `graphql:"... on EndpointUpdate"`
SessionUpdate `graphql:"... on SessionUpdate"`
TitleUpdate `graphql:"... on TitleUpdate"`
PathParamUpdate `graphql:"... on PathParamUpdate"`
}
func (*TaskMessage) GetValue ¶
func (u *TaskMessage) GetValue() AIUpdateType
type TitleUpdate ¶
type TitleUpdate struct {
BaseAIUpdateType
Title string
}
type Type ¶
type TypeFieldUpdate ¶
type TypeFieldUpdate struct {
BaseAIUpdateType
Service string `json:"service,omitempty"`
Endpoint string `json:"endpoint,omitempty"`
Struct string `json:"struct,omitempty"`
Name string `json:"name,omitempty"`
Type string `json:"type,omitempty"`
Doc string `graphql:"mdoc: doc" json:"doc,omitempty"`
}
type TypeUpdate ¶
type TypeUpdate struct {
BaseAIUpdateType
Service string `json:"service,omitempty"`
Endpoint string `json:"endpoint,omitempty"`
Name string `json:"name,omitempty"`
Doc string `graphql:"mdoc: doc" json:"doc,omitempty"`
}
type ValidationError ¶
type ValidationError struct {
Service string `json:"service"`
Endpoint string `json:"endpoint"`
CodeType CodeType `json:"codeType"`
Message string `json:"message"`
Start *Pos `json:"start,omitempty"`
End *Pos `json:"end,omitempty"`
}
ValidationError is a simplified ErrInSrc to return to the dashboard
type VisibilityType ¶
type VisibilityType string
const ( VisibilityTypePublic VisibilityType = "public" VisibilityTypePrivate VisibilityType = "private" VisibilityTypeAuth VisibilityType = "auth" )