Documentation ¶
Index ¶
- func ComposableLatestMajorsOrXJenny(parentdir string, inner codejen.OneToOne[SchemaForGen]) codejen.OneToMany[kindsys.Composable]
- func PostprocessGoFile(cfg GenGoFile) ([]byte, error)
- func PrefixDropper(prefix string) dstutil.ApplyFunc
- func PrefixReplacer(prefix, replace string) dstutil.ApplyFunc
- func Prefixer(prefix string) codejen.FileMapper
- func SlashHeaderMapper(maingen string) codejen.FileMapper
- type GenGoFile
- type GenTest
- func (genTest GenTest) ModuleToCoreKind(modulePath string) (kindsys.Core, error)
- func (genTest GenTest) Run(inner func(t *testing.T) codejen.Files)
- func (genTest GenTest) RunManyToOneFromModule(modulePath string, jenny ManyToOne)
- func (genTest GenTest) RunOneToManyFromModule(modulePath string, jenny OneToMany)
- func (genTest GenTest) RunOneToOneFromModule(modulePath string, jenny OneToOne)
- type GenTestConfig
- type GoTypesJenny
- type JsonSchemaJenny
- type ManyToMany
- type ManyToOne
- type OneToMany
- type OneToOne
- type SchemaForGen
- type TSResourceJenny
- type TSTypesJenny
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComposableLatestMajorsOrXJenny ¶
func ComposableLatestMajorsOrXJenny(parentdir string, inner codejen.OneToOne[SchemaForGen]) codejen.OneToMany[kindsys.Composable]
TODO remove this once there's a standard jenny for this...somewhere in core
func PostprocessGoFile ¶
func PrefixDropper ¶
PrefixDropper returns a dstutil.ApplyFunc that removes the provided prefix string when it appears as a leading sequence in type names, var names, and comments in a generated Go file.
func PrefixReplacer ¶
PrefixReplacer returns a dstutil.ApplyFunc that removes the provided prefix string when it appears as a leading sequence in type names, var names, and comments in a generated Go file.
When an exact match for prefix is found, the provided replace string is substituted.
func Prefixer ¶
func Prefixer(prefix string) codejen.FileMapper
Prefixer returns a FileMapper that injects the provided path prefix to files passed through it.
func SlashHeaderMapper ¶
func SlashHeaderMapper(maingen string) codejen.FileMapper
SlashHeaderMapper produces a FileMapper that injects a comment header onto a codejen.File indicating the main generator that produced it (via the provided maingen, which should be a path) and the jenny or jennies that constructed the file.
Types ¶
type GenTest ¶
type GenTest struct {
// contains filtered or unexported fields
}
func NewGenTest ¶
func NewGenTest(t *testing.T, config GenTestConfig) GenTest
func (GenTest) ModuleToCoreKind ¶
func (GenTest) RunManyToOneFromModule ¶
func (GenTest) RunOneToManyFromModule ¶
func (GenTest) RunOneToOneFromModule ¶
type GenTestConfig ¶
type GenTestConfig struct {
OutputDir string
}
type GoTypesJenny ¶
GoTypesJenny is a OneToOne that produces Go types for the provided thema.Schema.
func (GoTypesJenny) Generate ¶
func (j GoTypesJenny) Generate(sfg SchemaForGen) (*codejen.File, error)
func (GoTypesJenny) JennyName ¶
func (j GoTypesJenny) JennyName() string
type JsonSchemaJenny ¶
type JsonSchemaJenny struct{}
func (JsonSchemaJenny) Generate ¶
func (j JsonSchemaJenny) Generate(sfg SchemaForGen) (*codejen.File, error)
func (JsonSchemaJenny) JennyName ¶
func (j JsonSchemaJenny) JennyName() string
type ManyToMany ¶
type ManyToMany codejen.ManyToMany[kindsys.Kind]
type OneToMany ¶
func LatestMajorsOrXJenny ¶
func LatestMajorsOrXJenny(parentdir string, forceGroup bool, inner codejen.OneToOne[SchemaForGen]) OneToMany
LatestMajorsOrXJenny returns a jenny that repeats the input for the latest in each major version.
TODO remove forceGroup option, it's a temporary hack to accommodate core kinds
type OneToOne ¶
func LatestJenny ¶
func LatestJenny(parentdir string, inner codejen.OneToOne[SchemaForGen]) OneToOne
LatestJenny returns a jenny that runs another jenny for only the latest schema in a DefForGen, and prefixes the resulting file with the provided parentdir (e.g. "pkg/kinds/") and with a directory based on the kind's machine name (e.g. "dashboard/").
type SchemaForGen ¶
type SchemaForGen struct { // The PascalCase name of the schematized type. Name string // The schema to be rendered for the type itself. Schema thema.Schema // Whether the schema is grouped. See https://github.com/grafana/thema/issues/62 IsGroup bool }
SchemaForGen is an intermediate values type for jennies that holds both a thema.Schema, and values relevant to generating the schema that should properly, eventually, be in thema itself.
TODO this will be replaced by thema-native constructs
func ForLatestSchema ¶
func ForLatestSchema(k kindsys.Kind) SchemaForGen
ForLatestSchema returns a SchemaForGen for the latest schema in the provided kindsys.Kind's lineage.
TODO this will be replaced by thema-native constructs
type TSResourceJenny ¶
type TSResourceJenny struct {
ImportMapper cuetsy.ImportMapper
}
TSResourceJenny is a OneToOne that produces TypeScript types and defaults for a Thema schema.
Thema's generic TS jenny will be able to replace this one once https://github.com/grafana/thema/issues/89 is complete.
func (TSResourceJenny) Generate ¶
func (j TSResourceJenny) Generate(sfg SchemaForGen) (*codejen.File, error)
func (TSResourceJenny) JennyName ¶
func (j TSResourceJenny) JennyName() string
type TSTypesJenny ¶
type TSTypesJenny struct {
ImportMapper cuetsy.ImportMapper
}
TSTypesJenny is a OneToOne that produces TypeScript types and defaults for a Thema schema.
Thema's generic TS jenny will be able to replace this one once https://github.com/grafana/thema/issues/89 is complete.
func (TSTypesJenny) Generate ¶
func (j TSTypesJenny) Generate(sfg SchemaForGen) (*codejen.File, error)
func (TSTypesJenny) JennyName ¶
func (j TSTypesJenny) JennyName() string