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 DropPolicy
- 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
DropPolicy
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 DropPolicy ¶ added in v0.14.0
type DropPolicy struct {
AllowDrop []string `` /* 156-byte string literal not displayed */
}
DropPolicy controls which object types are allowed to be dropped. If AllowDrop is empty, no drops are allowed (safe default). If AllowDrop contains "all", all drops are allowed. Otherwise, only the listed object types are allowed to be dropped.
func (*DropPolicy) IsDropAllowed ¶ added in v0.14.0
func (p *DropPolicy) IsDropAllowed(objectType string) bool
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]
Domains *orderedmap.Map[string, *model.Domain]
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/domains matching the pattern (wildcard: *, ?)."`
Exclude []string `short:"E" help:"Exclude tables/views/enums/domains matching the pattern (wildcard: *, ?)."`
Enable []string `enum:"table,view,enum,domain" env:"PIST_ENABLE" help:"Enable only specified object types (can be repeated)."`
Disable []string `enum:"table,view,enum,domain" env:"PIST_DISABLE" help:"Disable specified object types (can be repeated)."`
}
func (*FilterOptions) AfterApply ¶ added in v0.11.0
func (f *FilterOptions) AfterApply() error
func (*FilterOptions) IsTypeEnabled ¶ added in v0.12.0
func (f *FilterOptions) IsTypeEnabled(typeName string) bool
IsTypeEnabled returns true if the given object type should be included. Enable takes precedence: if set, only listed types are enabled. Disable excludes listed types (ignored when Enable is set). If neither is set, all types are enabled.
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:"PIST_SCHEMAS" 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
DropPolicy
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.