Documentation
¶
Overview ¶
Package docplan compiles native SysML v2 document definitions into immutable document plans that reference compiled query programs.
Index ¶
- func IsDocumentDefinition(index *symbols.Index, model *semantics.Model, sym *symbols.Symbol) bool
- func QueryTarget(index *symbols.Index, model *semantics.Model, resolver *resolve.Resolver, ...) *symbols.Symbol
- type Binding
- type BindingKind
- type BindingValue
- func (v BindingValue) Boolean() (bool, bool)
- func (v BindingValue) Element() (*symbols.Symbol, bool)
- func (v BindingValue) Integer() (int64, bool)
- func (v BindingValue) Kind() BindingKind
- func (v BindingValue) Origin() provenance.Origin
- func (v BindingValue) Real() (float64, bool)
- func (v BindingValue) String() (string, bool)
- type ColumnRun
- type Content
- func (c Content) Caption() string
- func (c Content) Children() []Content
- func (c Content) ColumnRuns() []ColumnRun
- func (c Content) Diagram() *DiagramRef
- func (c Content) GroupBy() string
- func (c Content) Kind() ContentKind
- func (c Content) Name() string
- func (c Content) Origin() provenance.Origin
- func (c Content) Query() *QueryRef
- func (c Content) Runs() []Run
- func (c Content) Style() ListStyle
- func (c Content) Text() string
- func (c Content) Title() string
- type ContentKind
- type DiagramRef
- type Error
- type ErrorKind
- type ListStyle
- type Plan
- type QueryRef
- type Run
- type RunKind
- type RunStyle
- type TemplateKind
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsDocumentDefinition ¶
IsDocumentDefinition reports whether sym specializes DocumentQueries::Document.
Types ¶
type Binding ¶
type Binding struct {
// contains filtered or unexported fields
}
Binding supplies planned values to one parameter of a referenced query.
func (Binding) Origin ¶
func (b Binding) Origin() provenance.Origin
Origin returns the source declaration behind the binding.
func (Binding) Values ¶
func (b Binding) Values() []BindingValue
Values returns the planned values in declaration order.
type BindingKind ¶
type BindingKind string
BindingKind classifies one planned binding value.
const ( BindingElement BindingKind = "element" BindingString BindingKind = "string" BindingInteger BindingKind = "integer" BindingReal BindingKind = "real" BindingBoolean BindingKind = "boolean" )
type BindingValue ¶
type BindingValue struct {
// contains filtered or unexported fields
}
BindingValue is one statically planned value for a query parameter.
func (BindingValue) Boolean ¶
func (v BindingValue) Boolean() (bool, bool)
Boolean returns the bound boolean when the value is a boolean.
func (BindingValue) Element ¶
func (v BindingValue) Element() (*symbols.Symbol, bool)
Element returns the bound model element when the value is an element.
func (BindingValue) Integer ¶
func (v BindingValue) Integer() (int64, bool)
Integer returns the bound integer when the value is an integer.
func (BindingValue) Kind ¶
func (v BindingValue) Kind() BindingKind
Kind returns the classification of the value.
func (BindingValue) Origin ¶
func (v BindingValue) Origin() provenance.Origin
Origin returns the source declaration behind the value.
func (BindingValue) Real ¶
func (v BindingValue) Real() (float64, bool)
Real returns the bound real when the value is a real.
func (BindingValue) String ¶
func (v BindingValue) String() (string, bool)
String returns the bound text when the value is a string.
type ColumnRun ¶
type ColumnRun struct {
// contains filtered or unexported fields
}
ColumnRun maps one projected column of a query-backed paragraph or list to a styled run per result row.
func (ColumnRun) Kind ¶
func (r ColumnRun) Kind() TemplateKind
Kind returns the classification of the column run.
func (ColumnRun) Origin ¶
func (r ColumnRun) Origin() provenance.Origin
Origin returns the source declaration behind the column run.
func (ColumnRun) StyleColumn ¶
StyleColumn returns the projected column supplying each row's style, empty when the style is fixed.
func (ColumnRun) TargetColumn ¶
TargetColumn returns the projected column supplying each row's link destination.
type Content ¶
type Content struct {
// contains filtered or unexported fields
}
Content is one planned content node: a section, paragraph, table, list, or diagram.
func (Content) ColumnRuns ¶
ColumnRuns returns the planned column runs of a query-backed paragraph or list in declaration order.
func (Content) Diagram ¶
func (c Content) Diagram() *DiagramRef
Diagram returns the planned view reference of a diagram node, or nil.
func (Content) GroupBy ¶
GroupBy returns the projected column a table groups its rows by, empty when ungrouped.
func (Content) Kind ¶
func (c Content) Kind() ContentKind
Kind returns the classification of the node.
func (Content) Origin ¶
func (c Content) Origin() provenance.Origin
Origin returns the source declaration behind the node.
type ContentKind ¶
type ContentKind string
ContentKind classifies one planned content node.
const ( ContentSection ContentKind = "section" ContentParagraph ContentKind = "paragraph" ContentTable ContentKind = "table" ContentList ContentKind = "list" ContentDiagram ContentKind = "diagram" )
type DiagramRef ¶
type DiagramRef struct {
// contains filtered or unexported fields
}
DiagramRef is a planned reference to what a diagram renders: a declared view usage, or a plain element with the rendering kind the diagram states.
func (*DiagramRef) Direction ¶
func (d *DiagramRef) Direction() view.Direction
Direction returns the stated flow direction, empty for the kind's default.
func (*DiagramRef) Kind ¶
func (d *DiagramRef) Kind() view.Kind
Kind returns the resolved rendering kind.
func (*DiagramRef) Origin ¶
func (d *DiagramRef) Origin() provenance.Origin
Origin returns the source declaration behind the reference.
func (*DiagramRef) Stated ¶
func (d *DiagramRef) Stated() string
Stated returns how the kind was decided, the way a rendering reports it.
type Error ¶
type Error struct {
Kind ErrorKind
Document string
Content string
Query string
Parameter string
Expected string
Actual string
Origin provenance.Origin
Err error
}
Error is a typed document-planning failure with its source location.
type ErrorKind ¶
type ErrorKind string
ErrorKind classifies a document-planning failure.
const ( ErrorInvalidContext ErrorKind = "invalid-context" ErrorNotDocumentDefinition ErrorKind = "not-document-definition" ErrorMissingTitle ErrorKind = "missing-title" ErrorInvalidAttribute ErrorKind = "invalid-attribute" ErrorInvalidContent ErrorKind = "invalid-content" ErrorNestedDocument ErrorKind = "nested-document" ErrorMissingText ErrorKind = "missing-text" ErrorConflictingText ErrorKind = "conflicting-text" ErrorMissingQuery ErrorKind = "missing-query" ErrorConflictingQuery ErrorKind = "conflicting-query" ErrorUnknownQuery ErrorKind = "unknown-query" ErrorQueryPlanning ErrorKind = "query-planning" ErrorInvalidStyle ErrorKind = "invalid-style" ErrorUnknownParameter ErrorKind = "unknown-parameter" ErrorDuplicateBinding ErrorKind = "duplicate-binding" ErrorMissingBinding ErrorKind = "missing-binding" ErrorUnsupportedBinding ErrorKind = "unsupported-binding" ErrorBindingType ErrorKind = "binding-type" ErrorBindingMultiplicity ErrorKind = "binding-multiplicity" ErrorMissingViewSource ErrorKind = "missing-view-source" ErrorInvalidViewSource ErrorKind = "invalid-view-source" ErrorUnknownViewSource ErrorKind = "unknown-view-source" ErrorMissingDiagramKind ErrorKind = "missing-diagram-kind" ErrorConflictingKind ErrorKind = "conflicting-diagram-kind" ErrorUnsupportedKind ErrorKind = "unsupported-diagram-kind" ErrorInvalidDirection ErrorKind = "invalid-direction" ErrorUnsupportedDirection ErrorKind = "unsupported-direction" ErrorConflictingRuns ErrorKind = "conflicting-runs" ErrorAmbiguousRun ErrorKind = "ambiguous-run" ErrorMissingRunText ErrorKind = "missing-run-text" ErrorInvalidRunStyle ErrorKind = "invalid-run-style" ErrorMissingLinkTarget ErrorKind = "missing-link-target" ErrorMissingRefTarget ErrorKind = "missing-ref-target" ErrorUnknownRefTarget ErrorKind = "unknown-ref-target" ErrorInvalidRefTarget ErrorKind = "invalid-ref-target" ErrorAmbiguousRefTarget ErrorKind = "ambiguous-ref-target" ErrorUnknownGroupColumn ErrorKind = "unknown-group-column" ErrorColumnRunWithoutQuery ErrorKind = "column-run-without-query" ErrorConflictingColumnRuns ErrorKind = "conflicting-column-runs" ErrorMissingRunColumn ErrorKind = "missing-run-column" ErrorConflictingRunStyle ErrorKind = "conflicting-run-style" ErrorUnknownRunColumn ErrorKind = "unknown-run-column" )
type Plan ¶
type Plan struct {
// contains filtered or unexported fields
}
Plan is an immutable compiled document definition.
func Compile ¶
func Compile(index *symbols.Index, model *semantics.Model, resolver *resolve.Resolver, entry *symbols.Symbol) (*Plan, error)
Compile compiles a document definition into an immutable document plan.
func (*Plan) Origin ¶
func (p *Plan) Origin() provenance.Origin
Origin returns the source declaration behind the document.
type QueryRef ¶
type QueryRef struct {
// contains filtered or unexported fields
}
QueryRef is a planned reference to a compiled query with its bindings.
func (*QueryRef) Origin ¶
func (q *QueryRef) Origin() provenance.Origin
Origin returns the source declaration behind the reference.
type Run ¶
type Run struct {
// contains filtered or unexported fields
}
Run is one planned inline run: a styled span, a link, or a reference to a content block of this or another document, or another document's root.
func (Run) Origin ¶
func (r Run) Origin() provenance.Origin
Origin returns the source declaration behind the run.
func (Run) RefDocument ¶
RefDocument returns the fully-qualified name of the document a reference run targets, or "" when it targets the document being planned.
type TemplateKind ¶
type TemplateKind string
TemplateKind classifies one planned column run of a query-backed node.
const ( TemplateSpan TemplateKind = "span" TemplateLink TemplateKind = "link" )