Documentation
¶
Overview ¶
Package workflow provides shared YAML schema processing pipelines used by multiple CLI commands (generate, diff, dump-sql, schema2diagram, find-includes).
Index ¶
- func ExecuteDumpSQL(cmd *cobra.Command, databaseType string, pending bool, verbose bool, ...) error
- func ExecuteFindIncludes(cmd *cobra.Command, configFile, schemaPath string, ...) error
- func MergeAndValidateSchemas(components *YAMLComponents, allSchemas []*yamlpkg.Schema, ...) (*yamlpkg.Schema, error)
- func ScanAndParseSchemas(components *YAMLComponents, verbose bool) ([]*yamlpkg.Schema, error)
- type DAGQuerier
- type DiscoveredSchema
- type FindIncludesCallbacks
- type LocalSchemaFile
- type YAMLComponents
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExecuteDumpSQL ¶
func ExecuteDumpSQL(cmd *cobra.Command, databaseType string, pending bool, verbose bool, configFile string, dagQuerier *DAGQuerier) error
ExecuteDumpSQL handles the complete dump SQL process. When pending is true, it shows only the SQL for pending schema changes (what the next migration would do). When false, it dumps the full schema.
func ExecuteFindIncludes ¶
func ExecuteFindIncludes(cmd *cobra.Command, configFile, schemaPath string, interactive, includeWorkspace bool, callbacks *FindIncludesCallbacks) error
ExecuteFindIncludes handles the complete find includes process
func MergeAndValidateSchemas ¶
func MergeAndValidateSchemas(components *YAMLComponents, allSchemas []*yamlpkg.Schema, dbType yamlpkg.DatabaseType, verbose bool) (*yamlpkg.Schema, error)
MergeAndValidateSchemas merges schemas and validates the result
func ScanAndParseSchemas ¶
func ScanAndParseSchemas(components *YAMLComponents, verbose bool) ([]*yamlpkg.Schema, error)
ScanAndParseSchemas scans for YAML schema files and parses them with include support
Types ¶
type DAGQuerier ¶
type DAGQuerier struct {
// QueryDAG loads migrations from the given directory and returns the
// previous schema as a *yamlpkg.Schema (or nil if no migrations exist).
QueryPreviousSchema func(migrationsDir string, dbType string, verbose bool) (*yamlpkg.Schema, error)
}
DAGQuerier provides the callback functions needed by ExecuteDumpSQL to query the migration DAG without depending on the migrate or interp packages.
type DiscoveredSchema ¶
type DiscoveredSchema struct {
ModulePath string
RelativePath string
FullPath string
IsWorkspace bool
Schema *yamlpkg.Schema
TableCount int
DatabaseName string
DatabaseType string
}
DiscoveredSchema represents a schema found during discovery
type FindIncludesCallbacks ¶
type FindIncludesCallbacks struct {
FindLocalSchemaFiles func() ([]LocalSchemaFile, error)
SelectLocalSchemaFile func([]LocalSchemaFile) (string, error)
DiscoverSchemas func() ([]DiscoveredSchema, error)
SelectSchemasInteractively func([]DiscoveredSchema) ([]DiscoveredSchema, error)
LoadExistingSchema func(string) (*yamlpkg.Schema, error)
FilterNewSchemas func([]DiscoveredSchema, *yamlpkg.Schema) []DiscoveredSchema
UpdateSchemaWithIncludes func(string, *yamlpkg.Schema, []DiscoveredSchema) error
}
FindIncludesCallbacks holds the callback functions needed by ExecuteFindIncludes to interact with the file system and user without depending on cmd-internal types.
type LocalSchemaFile ¶
LocalSchemaFile represents a local schema.yaml file found in the current directory
type YAMLComponents ¶
type YAMLComponents struct {
StateManager *yamlpkg.StateManager
Scanner *scanner.Scanner
Parser *yamlpkg.Parser
Merger *yamlpkg.Merger
DiffEngine *yamlpkg.DiffEngine
}
YAMLComponents holds the initialized YAML processing components
func InitializeYAMLComponents ¶
func InitializeYAMLComponents(dbType yamlpkg.DatabaseType, verbose bool) *YAMLComponents
InitializeYAMLComponents creates and initializes all YAML processing components