Documentation
¶
Index ¶
- type ApplyOptions
- type Client
- func (client *Client) Apply(ctx context.Context, options *ApplyOptions, w io.Writer) error
- func (client *Client) Dump(ctx context.Context, options *DumpOptions) (*DumpResult, error)
- func (client *Client) Format(options *FmtOptions) (map[string]string, error)
- func (client *Client) Plan(ctx context.Context, options *PlanOptions) (string, error)
- type DumpOptions
- type DumpResult
- type FilterOptions
- type FmtOptions
- type Options
- type PlanOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApplyOptions ¶
type ApplyOptions struct {
FilterOptions
Files []string `arg:"" help:"Path to the desired schema SQL file(s)."`
PreSQLFile string `type:"path" help:"Path to a SQL file to execute before applying changes."`
WithTx bool `help:"Execute the pre-SQL and schema changes in a transaction."`
}
type Client ¶
type Client struct {
*Options
}
func (*Client) Dump ¶
func (client *Client) Dump(ctx context.Context, options *DumpOptions) (*DumpResult, error)
type DumpOptions ¶
type DumpOptions struct {
FilterOptions
Split string `help:"Output each table/view/enum as a separate file in the specified directory."`
OmitSchema bool `help:"Omit schema name from the dump output."`
}
type DumpResult ¶ added in v0.3.0
type DumpResult struct {
Tables *orderedmap.Map[string, *model.Table]
Views *orderedmap.Map[string, *model.View]
Enums *orderedmap.Map[string, *model.Enum]
OmitSchema bool
}
func (*DumpResult) Files ¶ added in v0.3.0
func (r *DumpResult) Files() map[string]string
func (*DumpResult) String ¶ added in v0.3.0
func (r *DumpResult) String() string
type FilterOptions ¶ added in v0.11.0
type FilterOptions struct {
Include []string `short:"I" help:"Include only tables/views/enums matching the pattern (wildcard: *, ?)."`
Exclude []string `short:"E" help:"Exclude tables/views/enums matching the pattern (wildcard: *, ?)."`
}
func (*FilterOptions) AfterApply ¶ added in v0.11.0
func (f *FilterOptions) AfterApply() error
func (*FilterOptions) MatchName ¶ added in v0.11.0
func (f *FilterOptions) MatchName(name string) bool
func (*FilterOptions) ValidatePatterns ¶ added in v0.11.0
func (f *FilterOptions) ValidatePatterns() error
type FmtOptions ¶ added in v0.11.0
type FmtOptions struct {
Files []string `arg:"" help:"Path to the SQL file(s) to format."`
Write bool `short:"w" xor:"mode" help:"Write result to source file(s) instead of stdout."`
Check bool `xor:"mode" help:"Check if files are formatted. Exit with non-zero status if any file needs formatting."`
}
type Options ¶
type Options struct {
ConnString string `` /* 195-byte string literal not displayed */
Password string `env:"PIST_PASSWORD" help:"PostgreSQL password."`
Schemas []string `short:"n" env:"PGSCHEMAS" default:"public" help:"Schemas to inspect and modify."`
SchemaMap map[string]string `short:"m" help:"Schema name mapping (e.g. -m old=new)."`
}
func (*Options) AfterApply ¶ added in v0.4.0
func (*Options) RemapSchema ¶ added in v0.4.0
func (*Options) ReverseRemapSchema ¶ added in v0.4.0
func (*Options) ValidateSchemaMap ¶ added in v0.4.0
type PlanOptions ¶
type PlanOptions struct {
FilterOptions
Files []string `arg:"" help:"Path to the desired schema SQL file(s)."`
PreSQLFile string `type:"path" help:"Path to a SQL file to execute before applying changes."`
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.