mirror of
https://github.com/grafana/grafana.git
synced 2025-02-11 16:15:42 -06:00
* New pfs impl * Reached codegen parity with old system * Update all models.cue inputs * Rename all models.cue files * Remove unused prefixfs * Changes Queries->DataQuery schema interface * Recodegen * All tests passing, nearly good now * Add SchemaInterface to kindsys props * Add pascal name deriver * Relocate plugin cue files again * Clarify use of injected fields * Remove unnecessary aliasing * Move DataQuery into mudball * Allow forcing ExpandReferences on go type generation * Move DataQuery def into kindsys, add generator to copy it to common * Fix copy generator to replace package name correctly * Fix duplicate type, test failure * Fix linting issues
49 lines
953 B
Go
49 lines
953 B
Go
package kindsys
|
|
|
|
import (
|
|
"github.com/grafana/thema"
|
|
)
|
|
|
|
var _ Composable = genericComposable{}
|
|
|
|
type genericComposable struct {
|
|
decl Decl[ComposableProperties]
|
|
lin thema.Lineage
|
|
}
|
|
|
|
func (k genericComposable) Props() SomeKindProperties {
|
|
return k.decl.Properties
|
|
}
|
|
|
|
func (k genericComposable) Name() string {
|
|
return k.decl.Properties.Name
|
|
}
|
|
|
|
func (k genericComposable) MachineName() string {
|
|
return k.decl.Properties.MachineName
|
|
}
|
|
|
|
func (k genericComposable) Maturity() Maturity {
|
|
return k.decl.Properties.Maturity
|
|
}
|
|
|
|
func (k genericComposable) Decl() Decl[ComposableProperties] {
|
|
return k.decl
|
|
}
|
|
|
|
func (k genericComposable) Lineage() thema.Lineage {
|
|
return k.lin
|
|
}
|
|
|
|
func BindComposable(rt *thema.Runtime, decl Decl[ComposableProperties], opts ...thema.BindOption) (Composable, error) {
|
|
lin, err := decl.Some().BindKindLineage(rt, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return genericComposable{
|
|
decl: decl,
|
|
lin: lin,
|
|
}, nil
|
|
}
|