mirror of
https://github.com/grafana/grafana.git
synced 2025-08-02 22:24:31 +08:00
Kindsys: Replace DefForGen
with kindsys.Kind
(#62642)
* Kindsys: Replace DeclForGen with kindsys.Kind DeclForGen was always unnecessary - it just wasn't obvious on initial implementation, when we were focused on generating unique types for each core kind. This removes it, considerably simplifying interactions with kindsys - virtually everything now just relies on kindsys.Kind and its derived interfaces. * Removed unused jenny * Rename params in jennies
This commit is contained in:
@ -23,16 +23,21 @@ import (
|
||||
"github.com/grafana/thema"
|
||||
)
|
||||
|
||||
// Base is a registry of kindsys.Interface. It provides two modes for accessing
|
||||
// kinds: individually via literal named methods, or as a slice returned from
|
||||
// an All*() method.
|
||||
// Base is a registry of all Grafana core kinds. It is designed for use both inside
|
||||
// of Grafana itself, and for import by external Go programs wanting to work with Grafana's
|
||||
// kind system.
|
||||
//
|
||||
// The registry provides two modes for accessing core kinds:
|
||||
// - Per-kind methods, which return the kind-specific type, e.g. Dashboard() returns [dashboard.Dashboard].
|
||||
// - All(), which returns a slice of [kindsys.Core].
|
||||
//
|
||||
// Prefer the individual named methods for use cases where the particular kind(s) that
|
||||
// are needed are known to the caller. For example, a dashboard linter can know that it
|
||||
// specifically wants the dashboard kind.
|
||||
//
|
||||
// Prefer All*() methods when performing operations generically across all kinds.
|
||||
// For example, a validation HTTP middleware for any kind-schematized object type.
|
||||
// Prefer All() when performing operations generically across all kinds. For example,
|
||||
// a generic HTTP middleware for validating request bodies expected to contain some
|
||||
// kind-schematized type.
|
||||
type Base struct {
|
||||
all []kindsys.Core
|
||||
dashboard *dashboard.Kind
|
||||
|
Reference in New Issue
Block a user