* implement --silent flag to control output verbosity * update error handling to restore stderr after silent mode * enhance progress reporting in PostgreSQL reader
42 lines
1.3 KiB
Go
42 lines
1.3 KiB
Go
package readers
|
|
|
|
import (
|
|
"git.warky.dev/wdevs/relspecgo/pkg/models"
|
|
)
|
|
|
|
// Reader defines the interface for reading database specifications
|
|
// from various input formats at different granularity levels
|
|
type Reader interface {
|
|
// ReadDatabase reads and parses the input, returning a Database model
|
|
ReadDatabase() (*models.Database, error)
|
|
|
|
// ReadSchema reads and parses the input, returning a Schema model
|
|
ReadSchema() (*models.Schema, error)
|
|
|
|
// ReadTable reads and parses the input, returning a Table model
|
|
ReadTable() (*models.Table, error)
|
|
}
|
|
|
|
// ReaderOptions contains common options for readers
|
|
type ReaderOptions struct {
|
|
// FilePath is the path to the input file (if applicable)
|
|
FilePath string
|
|
|
|
// ConnectionString is the database connection string (for DB readers)
|
|
ConnectionString string
|
|
|
|
// Prisma7 enables Prisma 7-specific handling for Prisma schemas.
|
|
Prisma7 bool
|
|
|
|
// StrictDirectives makes DBML dialect directives (@postgres:, @sqlite:, …)
|
|
// fail on an unknown namespace or key instead of preserving them silently.
|
|
StrictDirectives bool
|
|
|
|
// Progress receives human-readable status updates while a reader is working.
|
|
// It is optional so library users can opt in without coupling readers to a UI.
|
|
Progress func(string)
|
|
|
|
// Additional options can be added here as needed
|
|
Metadata map[string]interface{}
|
|
}
|