Documentation
¶
Index ¶
- Variables
- func CustomEvalTransform(ctx context.Context, dataCtx MapData, val cty.Value) (res cty.Value, diags diagnostics.Diag)
- type BoolData
- type Content
- type ContentElement
- type ContentEmpty
- type ContentMeta
- type ContentProvider
- type ContentProviders
- type ContentResult
- type ContentSection
- type ConvertibleData
- type CustomEval
- type Data
- type DataPath
- func (p *DataPath) Clone() *DataPath
- func (p *DataPath) Get(data Data) (Data, diagnostics.Diag)
- func (p *DataPath) List(idx int) *DataPath
- func (p *DataPath) Map(key string) *DataPath
- func (p *DataPath) Set(data, val Data) (Data, diagnostics.Diag)
- func (p *DataPath) SetRootName(root string) *DataPath
- func (p *DataPath) String() string
- func (p *DataPath) Truncate(newLen int) *DataPath
- type DataSource
- type DataSources
- type InvocationOrder
- type ListData
- type Location
- type LocationEffect
- type MapData
- type NumberData
- type OutputFormat
- type ProvideContentFunc
- type ProvideContentParams
- type PublishFunc
- type PublishParams
- type Publisher
- type Publishers
- type RetrieveDataFunc
- type RetrieveDataParams
- type Schema
- func (p *Schema) ProvideContent(ctx context.Context, name string, params *ProvideContentParams) (_ *ContentResult, diags diagnostics.Diag)
- func (p *Schema) Publish(ctx context.Context, name string, params *PublishParams) (diags diagnostics.Diag)
- func (p *Schema) RetrieveData(ctx context.Context, name string, params *RetrieveDataParams) (_ Data, diags diagnostics.Diag)
- func (p *Schema) Validate() diagnostics.Diag
- type StringData
Constants ¶
This section is empty.
Variables ¶
View Source
var CustomEvalType = encapsulator.NewDecoder[CustomEval]()
View Source
var EncapsulatedData = encapsulator.NewCodec[Data]("data", nil)
View Source
var ErrContentLocationNotFound = fmt.Errorf("content location not found")
Functions ¶
Types ¶
type Content ¶
type Content interface {
AsData() Data
ID() uint32
AsJQData() Data
Meta() *ContentMeta
// contains filtered or unexported methods
}
func ParseContentData ¶ added in v0.4.1
type ContentElement ¶ added in v0.4.1
type ContentElement struct {
Markdown string
// contains filtered or unexported fields
}
func (*ContentElement) AsData ¶ added in v0.4.1
func (c *ContentElement) AsData() Data
func (*ContentElement) AsJQData ¶ added in v0.4.1
func (c *ContentElement) AsJQData() Data
func (*ContentElement) ID ¶ added in v0.4.1
func (c *ContentElement) ID() uint32
func (*ContentElement) Meta ¶ added in v0.4.1
func (c *ContentElement) Meta() *ContentMeta
type ContentEmpty ¶ added in v0.4.1
type ContentEmpty struct {
// contains filtered or unexported fields
}
func (*ContentEmpty) AsData ¶ added in v0.4.1
func (n *ContentEmpty) AsData() Data
func (*ContentEmpty) AsJQData ¶ added in v0.4.1
func (n *ContentEmpty) AsJQData() Data
func (*ContentEmpty) ID ¶ added in v0.4.1
func (n *ContentEmpty) ID() uint32
func (*ContentEmpty) Meta ¶ added in v0.4.1
func (n *ContentEmpty) Meta() *ContentMeta
type ContentMeta ¶ added in v0.4.1
func ParseContentMeta ¶ added in v0.4.1
func ParseContentMeta(data Data) *ContentMeta
func (*ContentMeta) AsData ¶ added in v0.4.1
func (meta *ContentMeta) AsData() Data
type ContentProvider ¶
type ContentProvider struct {
// first non-empty line is treated as a short description
Doc string
Tags []string
ContentFunc ProvideContentFunc
Args dataspec.RootSpec
Config dataspec.RootSpec
InvocationOrder InvocationOrder
}
func (*ContentProvider) Execute ¶
func (cg *ContentProvider) Execute(ctx context.Context, params *ProvideContentParams) (_ *ContentResult, diags diagnostics.Diag)
func (*ContentProvider) Validate ¶
func (cg *ContentProvider) Validate() diagnostics.Diag
type ContentProviders ¶
type ContentProviders map[string]*ContentProvider
func (ContentProviders) Validate ¶
func (cp ContentProviders) Validate() diagnostics.Diag
type ContentResult ¶ added in v0.4.1
type ContentSection ¶ added in v0.4.1
type ContentSection struct {
Children []Content
// contains filtered or unexported fields
}
func NewSection ¶ added in v0.4.2
func NewSection(contentID uint32) *ContentSection
func (*ContentSection) Add ¶ added in v0.4.1
func (c *ContentSection) Add(content Content, loc *Location) error
Add content to the content tree.
func (*ContentSection) AsData ¶ added in v0.4.1
func (c *ContentSection) AsData() Data
AsData returns the content tree as a map.
func (*ContentSection) AsJQData ¶ added in v0.4.1
func (c *ContentSection) AsJQData() Data
func (*ContentSection) Compact ¶ added in v0.4.1
func (c *ContentSection) Compact()
Compact removes empty sections from the content tree.
func (*ContentSection) ID ¶ added in v0.4.1
func (c *ContentSection) ID() uint32
func (*ContentSection) Meta ¶ added in v0.4.1
func (c *ContentSection) Meta() *ContentMeta
type ConvertibleData ¶ added in v0.4.2
type ConvertibleData interface {
AsJQData() Data
}
type CustomEval ¶ added in v0.4.2
type CustomEval interface {
// Should return a new object, cty values should generally be immutable.
// The returned value must have the same type or it would be ignored.
CustomEval(ctx context.Context, dataCtx MapData) (cty.Value, diagnostics.Diag)
}
If encapsulated type implements this interface, it will be evaluated with data context.
type Data ¶
type Data interface {
Any() any
ConvertibleData
// contains filtered or unexported methods
}
func ParseDataAny ¶
func UnmarshalJSONData ¶
type DataPath ¶ added in v0.4.2
type DataPath struct {
// contains filtered or unexported fields
}
DataPath is a type that represents a path in `Data`.
func NewDataPath ¶ added in v0.4.2
NewDataPath creates a new DataPath. Specified path must not change after creation.
func (*DataPath) Get ¶ added in v0.4.2
func (p *DataPath) Get(data Data) (Data, diagnostics.Diag)
Gets element from the path.
func (*DataPath) List ¶ added in v0.4.2
Appends an index in the ListData, returns self for chaining.
func (*DataPath) Set ¶ added in v0.4.2
func (p *DataPath) Set(data, val Data) (Data, diagnostics.Diag)
func (*DataPath) SetRootName ¶ added in v0.4.2
Clones the path.
type DataSource ¶
type DataSource struct {
// first non-empty line is treated as a short description
Doc string
Tags []string
DataFunc RetrieveDataFunc
Args dataspec.RootSpec
Config dataspec.RootSpec
}
func (*DataSource) Execute ¶
func (ds *DataSource) Execute(ctx context.Context, params *RetrieveDataParams) (_ Data, diags diagnostics.Diag)
func (*DataSource) Validate ¶
func (ds *DataSource) Validate() diagnostics.Diag
type DataSources ¶
type DataSources map[string]*DataSource
func (DataSources) Validate ¶
func (ds DataSources) Validate() hcl.Diagnostics
type InvocationOrder ¶ added in v0.4.1
type InvocationOrder int
const ( InvocationOrderUnspecified InvocationOrder = iota InvocationOrderBegin InvocationOrderEnd )
func (InvocationOrder) Weight ¶ added in v0.4.1
func (order InvocationOrder) Weight() int
type Location ¶ added in v0.4.1
type Location struct {
Index uint32
Effect LocationEffect
}
type LocationEffect ¶ added in v0.4.1
type LocationEffect int
const ( LocationEffectUnspecified LocationEffect = iota LocationEffectBefore LocationEffectAfter )
type NumberData ¶
type NumberData float64
func (NumberData) Any ¶
func (d NumberData) Any() any
func (NumberData) AsJQData ¶
func (d NumberData) AsJQData() Data
type OutputFormat ¶ added in v0.4.2
type OutputFormat int
const ( OutputFormatUnspecified OutputFormat = iota OutputFormatMD OutputFormatHTML OutputFormatPDF )
func (OutputFormat) Ext ¶ added in v0.4.2
func (f OutputFormat) Ext() string
func (OutputFormat) String ¶ added in v0.4.2
func (f OutputFormat) String() string
type ProvideContentFunc ¶
type ProvideContentFunc func(ctx context.Context, params *ProvideContentParams) (*ContentResult, diagnostics.Diag)
type ProvideContentParams ¶
type PublishFunc ¶ added in v0.4.2
type PublishFunc func(ctx context.Context, params *PublishParams) diagnostics.Diag
type PublishParams ¶ added in v0.4.2
type Publisher ¶ added in v0.4.2
type Publisher struct {
Doc string
Tags []string
PublishFunc PublishFunc
Args dataspec.RootSpec
Config dataspec.RootSpec
AllowedFormats []OutputFormat
}
func (*Publisher) Execute ¶ added in v0.4.2
func (pub *Publisher) Execute(ctx context.Context, params *PublishParams) (diags diagnostics.Diag)
func (*Publisher) Validate ¶ added in v0.4.2
func (pub *Publisher) Validate() diagnostics.Diag
type Publishers ¶ added in v0.4.2
func (Publishers) Validate ¶ added in v0.4.2
func (pubs Publishers) Validate() diagnostics.Diag
type RetrieveDataFunc ¶
type RetrieveDataFunc func(ctx context.Context, params *RetrieveDataParams) (Data, diagnostics.Diag)
type Schema ¶
type Schema struct {
Name string
Version string
Doc string
Tags []string
DataSources DataSources
ContentProviders ContentProviders
Publishers Publishers
}
func WithLogging ¶ added in v0.4.2
WithLogging wraps the plugin with logging instrumentation.
func WithTracing ¶ added in v0.4.2
WithTracing wraps a plugin schema with tracing instrumentation.
func (*Schema) ProvideContent ¶
func (p *Schema) ProvideContent(ctx context.Context, name string, params *ProvideContentParams) (_ *ContentResult, diags diagnostics.Diag)
func (*Schema) Publish ¶ added in v0.4.2
func (p *Schema) Publish(ctx context.Context, name string, params *PublishParams) (diags diagnostics.Diag)
func (*Schema) RetrieveData ¶
func (p *Schema) RetrieveData(ctx context.Context, name string, params *RetrieveDataParams) (_ Data, diags diagnostics.Diag)
func (*Schema) Validate ¶
func (p *Schema) Validate() diagnostics.Diag
type StringData ¶
type StringData string
func (StringData) Any ¶
func (d StringData) Any() any
func (StringData) AsJQData ¶
func (d StringData) AsJQData() Data
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Documentable wrapper types form
|
Documentable wrapper types form |
|
pluginapi
|
|
Click to show internal directories.
Click to hide internal directories.