Documentation
¶
Overview ¶
Package commands provides the CLI command implementations for mink.
Package commands provides the CLI command implementations for mink.
Index ¶
- Variables
- func Execute() error
- func NewDiagnoseCommand() *cobra.Command
- func NewGenerateCommand() *cobra.Command
- func NewInitCommand() *cobra.Command
- func NewMigrateCommand() *cobra.Command
- func NewProjectionCommand() *cobra.Command
- func NewRootCommand() *cobra.Command
- func NewSchemaCommand() *cobra.Command
- func NewStreamCommand() *cobra.Command
- func NewVersionCommand(version, commit, date string) *cobra.Command
- func SetupDiagnosticEnv(ctx context.Context) (*DiagnosticEnv, DiagnosticSkipReason, error)
- func Splash()
- type AdapterFactory
- type AggregateData
- type AnimatedVersionModel
- type CLIAdapter
- type CheckResult
- type CheckStatus
- type CommandData
- type DiagnosticCheck
- type DiagnosticEnv
- type DiagnosticSkipReason
- type EventData
- type EventFileData
- type Migration
- type MigrationEnv
- type ProjectionData
- type SingleEventData
- type StreamEvent
Constants ¶
This section is empty.
Variables ¶
var ( // Version information (set at build time) Version = "dev" Commit = "none" BuildDate = "unknown" )
Functions ¶
func NewDiagnoseCommand ¶
NewDiagnoseCommand creates the diagnose command
func NewGenerateCommand ¶
NewGenerateCommand creates the generate command
func NewMigrateCommand ¶
NewMigrateCommand creates the migrate command
func NewProjectionCommand ¶
NewProjectionCommand creates the projection command
func NewRootCommand ¶
NewRootCommand creates the root command for the mink CLI
func NewSchemaCommand ¶
NewSchemaCommand creates the schema command
func NewStreamCommand ¶
NewStreamCommand creates the stream command
func NewVersionCommand ¶
NewVersionCommand creates the version command
func SetupDiagnosticEnv ¶
func SetupDiagnosticEnv(ctx context.Context) (*DiagnosticEnv, DiagnosticSkipReason, error)
SetupDiagnosticEnv creates a DiagnosticEnv for diagnostic checks. Returns (env, skipReason, error). If skipReason != DiagnosticNotSkipped, the check should be skipped.
Types ¶
type AdapterFactory ¶
type AdapterFactory struct {
// contains filtered or unexported fields
}
AdapterFactory creates the appropriate adapter based on configuration.
func NewAdapterFactory ¶
func NewAdapterFactory(cfg *config.Config) (*AdapterFactory, error)
NewAdapterFactory creates a new adapter factory.
func (*AdapterFactory) CreateAdapter ¶
func (f *AdapterFactory) CreateAdapter(ctx context.Context) (CLIAdapter, error)
CreateAdapter creates the appropriate adapter based on the driver configuration. For PostgreSQL, it validates the connection with a short timeout to fail fast on invalid URLs.
func (*AdapterFactory) GetDatabaseURL ¶
func (f *AdapterFactory) GetDatabaseURL() string
GetDatabaseURL returns the resolved database URL.
func (*AdapterFactory) IsMemoryDriver ¶
func (f *AdapterFactory) IsMemoryDriver() bool
IsMemoryDriver returns true if using the memory driver.
type AggregateData ¶
type AnimatedVersionModel ¶
type AnimatedVersionModel struct {
// contains filtered or unexported fields
}
AnimatedVersion shows an animated version display
func NewAnimatedVersion ¶
func NewAnimatedVersion(version string) AnimatedVersionModel
func (AnimatedVersionModel) Init ¶
func (m AnimatedVersionModel) Init() tea.Cmd
func (AnimatedVersionModel) View ¶
func (m AnimatedVersionModel) View() string
type CLIAdapter ¶
type CLIAdapter interface {
adapters.EventStoreAdapter
adapters.StreamQueryAdapter
adapters.ProjectionQueryAdapter
adapters.MigrationAdapter
adapters.SchemaProvider
adapters.DiagnosticAdapter
}
CLIAdapter combines all adapter interfaces needed by CLI commands.
type CheckResult ¶
type CheckResult struct {
Name string
Status CheckStatus
Message string
Recommendation string
}
CheckResult represents the result of a diagnostic check
type CheckStatus ¶
type CheckStatus int
CheckStatus represents the status of a diagnostic check
const ( StatusOK CheckStatus = iota StatusWarning StatusError )
type CommandData ¶
type DiagnosticCheck ¶
type DiagnosticCheck struct {
Name string
Check func() CheckResult
}
DiagnosticCheck represents a diagnostic check function
type DiagnosticEnv ¶
type DiagnosticEnv struct {
Adapter CLIAdapter
Config *config.Config
// contains filtered or unexported fields
}
DiagnosticEnv holds the environment for diagnostic checks that need database access. This consolidates the repeated pattern of checking config, memory driver, and DB URL.
func (*DiagnosticEnv) Close ¶
func (e *DiagnosticEnv) Close()
Close cleans up the DiagnosticEnv resources.
type DiagnosticSkipReason ¶
type DiagnosticSkipReason int
DiagnosticSkipReason represents why a diagnostic check was skipped.
const ( // DiagnosticNotSkipped means the diagnostic should proceed. DiagnosticNotSkipped DiagnosticSkipReason = iota // DiagnosticSkipNoConfig means no configuration was found. DiagnosticSkipNoConfig // DiagnosticSkipMemoryDriver means the memory driver is being used. DiagnosticSkipMemoryDriver // DiagnosticSkipNoDBURL means the database URL is not set. DiagnosticSkipNoDBURL )
type EventFileData ¶
type MigrationEnv ¶
type MigrationEnv struct {
Adapter CLIAdapter
Config *config.Config
Cwd string
MigrationsDir string
// contains filtered or unexported fields
}
MigrationEnv holds the environment for migration-related commands. This consolidates the repeated pattern of loading config, checking for memory driver, and creating the adapter used across migrate up/down/status commands.
func SetupMigrationEnv ¶
func SetupMigrationEnv(ctx context.Context) (*MigrationEnv, bool, error)
SetupMigrationEnv creates a MigrationEnv for migration commands. Returns (env, isMemory, error). If isMemory is true, migrations are not needed.
func (*MigrationEnv) Close ¶
func (e *MigrationEnv) Close()
Close cleans up the MigrationEnv resources.
type ProjectionData ¶
type SingleEventData ¶
type StreamEvent ¶
type StreamEvent struct {
ID string `json:"id"`
StreamID string `json:"stream_id"`
Version int64 `json:"version"`
Type string `json:"type"`
Data string `json:"data"`
Metadata string `json:"metadata,omitempty"`
Timestamp time.Time `json:"timestamp"`
}
StreamEvent represents an event in a stream (for export)