Documentation ¶
Index ¶
- type Common
- type Config
- type DataRestorationErrorExclusions
- type DummyConfig
- type Dump
- type GlobalDataRestorationErrorExclusions
- type LogConfig
- type Reference
- type ReferencedColumn
- type Restore
- type StorageConfig
- type Table
- type TablesDataRestorationErrorExclusions
- type TransformerConfig
- type Validate
- type VirtualReference
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Common Common `mapstructure:"common" yaml:"common" json:"common"` Log LogConfig `mapstructure:"log" yaml:"log" json:"log"` Storage StorageConfig `mapstructure:"storage" yaml:"storage" json:"storage"` Dump Dump `mapstructure:"dump" yaml:"dump" json:"dump"` Validate Validate `mapstructure:"validate" yaml:"validate" json:"validate"` Restore Restore `mapstructure:"restore" yaml:"restore" json:"restore"` CustomTransformers []*custom.TransformerDefinition `mapstructure:"custom_transformers" yaml:"custom_transformers" json:"custom_transformers,omitempty"` }
var (
Cfg *Config
)
type DataRestorationErrorExclusions ¶ added in v0.2.0
type DataRestorationErrorExclusions struct { Tables []*TablesDataRestorationErrorExclusions `mapstructure:"tables" yaml:"tables" json:"tables,omitempty"` Global *GlobalDataRestorationErrorExclusions `mapstructure:"global" yaml:"global" json:"global,omitempty"` }
type DummyConfig ¶ added in v0.1.12
type DummyConfig struct { Dump struct { Transformation []struct { Transformers []struct { Params map[string]interface{} `yaml:"params" json:"params"` } `yaml:"transformers" json:"transformers"` } `yaml:"transformation" json:"transformation"` } `yaml:"dump" json:"dump"` }
DummyConfig - This is a dummy config to the viper workaround It is used to parse the transformation parameters manually only avoiding parsing other pars of the config The reason why is there https://github.com/GreenmaskIO/greenmask/discussions/85
type Dump ¶
type Dump struct { PgDumpOptions pgdump.Options `mapstructure:"pg_dump_options" yaml:"pg_dump_options" json:"pg_dump_options"` Transformation []*Table `mapstructure:"transformation" yaml:"transformation" json:"transformation,omitempty"` VirtualReferences []*VirtualReference `mapstructure:"virtual_references" yaml:"virtual_references" json:"virtual_references,omitempty"` }
type GlobalDataRestorationErrorExclusions ¶ added in v0.2.0
type Reference ¶ added in v0.2.0
type Reference struct { Schema string `mapstructure:"schema" json:"schema" yaml:"schema"` Name string `mapstructure:"name" json:"name" yaml:"name"` NotNull bool `mapstructure:"not_null" json:"not_null" yaml:"not_null"` Columns []*ReferencedColumn `mapstructure:"columns" json:"columns" yaml:"columns"` PolymorphicExprs []string `mapstructure:"polymorphic_exprs" json:"polymorphic_exprs" yaml:"polymorphic_exprs"` }
type ReferencedColumn ¶ added in v0.2.0
type Restore ¶
type Restore struct { PgRestoreOptions pgrestore.Options `mapstructure:"pg_restore_options" yaml:"pg_restore_options" json:"pg_restore_options"` Scripts map[string][]pgrestore.Script `mapstructure:"scripts" yaml:"scripts" json:"scripts,omitempty"` ErrorExclusions *DataRestorationErrorExclusions `mapstructure:"insert_error_exclusions" yaml:"insert_error_exclusions" json:"insert_error_exclusions,omitempty"` }
type StorageConfig ¶
type Table ¶
type Table struct { Schema string `mapstructure:"schema" yaml:"schema" json:"schema,omitempty"` Name string `mapstructure:"name" yaml:"name" json:"name,omitempty"` Query string `mapstructure:"query" yaml:"query" json:"query,omitempty"` ApplyForInherited bool `mapstructure:"apply_for_inherited" yaml:"apply_for_inherited" json:"apply_for_inherited,omitempty"` Transformers []*TransformerConfig `mapstructure:"transformers" yaml:"transformers" json:"transformers,omitempty"` ColumnsTypeOverride map[string]string `mapstructure:"columns_type_override" yaml:"columns_type_override" json:"columns_type_override,omitempty"` SubsetConds []string `mapstructure:"subset_conds" yaml:"subset_conds" json:"subset_conds,omitempty"` When string `mapstructure:"when" yaml:"when" json:"when,omitempty"` }
type TablesDataRestorationErrorExclusions ¶ added in v0.2.0
type TablesDataRestorationErrorExclusions struct { Name string `mapstructure:"name" yaml:"name" json:"name,omitempty"` Schema string `mapstructure:"schema" yaml:"schema" json:"schema,omitempty"` Constraints []string `mapstructure:"constraints" yaml:"constraints" json:"constraints,omitempty"` ErrorCodes []string `mapstructure:"error_codes" yaml:"error_codes" json:"error_codes,omitempty"` }
type TransformerConfig ¶
type TransformerConfig struct { Name string `mapstructure:"name" yaml:"name" json:"name,omitempty"` ApplyForReferences bool `mapstructure:"apply_for_references" yaml:"apply_for_references" json:"apply_for_references,omitempty"` // Params - transformation parameters. It might be any type. If structure should be stored as raw json // This cannot be parsed with mapstructure due to uncontrollable lowercasing // https://github.com/spf13/viper/issues/373 // Instead we have to use workaround and parse it manually // // Params attribute decoding is dummy. It is replaced in the runtime internal/utils/config/viper_workaround.go // But it is required to leave mapstruicture tag to avoid errors raised by viper and decoder setting // ErrorUnused = true. It was set in PR #177 (https://github.com/GreenmaskIO/greenmask/pull/177/files) Params toolkit.StaticParameters `mapstructure:"params" yaml:"-" json:"-"` // MetadataParams - encoded transformer parameters - uses only for storing into storage // TODO: You need to get rid of it by creating a separate structure for storing metadata in // internal/db/postgres/storage/metadata_json.go // this is used only due to https://github.com/spf13/viper/issues/373 MetadataParams map[string]any `mapstructure:"-" yaml:"params,omitempty" json:"params,omitempty"` DynamicParams toolkit.DynamicParameters `mapstructure:"dynamic_params" yaml:"dynamic_params" json:"dynamic_params,omitempty"` When string `mapstructure:"when" yaml:"when" json:"when,omitempty"` }
func (*TransformerConfig) Clone ¶ added in v0.2.1
func (tc *TransformerConfig) Clone() *TransformerConfig
type Validate ¶
type Validate struct { Tables []string `mapstructure:"tables" yaml:"tables" json:"tables,omitempty"` Data bool `mapstructure:"data" yaml:"data" json:"data,omitempty"` Diff bool `mapstructure:"diff" yaml:"diff" json:"diff,omitempty"` Schema bool `mapstructure:"schema" yaml:"schema" json:"schema,omitempty"` RowsLimit uint64 `mapstructure:"rows_limit" yaml:"rows_limit" json:"rows_limit,omitempty"` ResolvedWarnings []string `mapstructure:"resolved_warnings" yaml:"resolved_warnings" json:"resolved_warnings,omitempty"` TableFormat string `mapstructure:"table_format" yaml:"table_format" json:"table_format,omitempty"` Format string `mapstructure:"format" yaml:"format" json:"format,omitempty"` OnlyTransformed bool `mapstructure:"transformed_only" yaml:"transformed_only" json:"transformed_only,omitempty"` Warnings bool `mapstructure:"warnings" yaml:"warnings" json:"warnings,omitempty"` }
type VirtualReference ¶ added in v0.2.0
Click to show internal directories.
Click to hide internal directories.