domains

package
v0.2.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 7, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Common

type Common struct {
	PgBinPath     string `mapstructure:"pg_bin_path" yaml:"pg_bin_path,omitempty" json:"pg_bin_path,omitempty"`
	TempDirectory string `mapstructure:"tmp_dir" yaml:"tmp_dir,omitempty" json:"tmp_dir,omitempty"`
}

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
)

func NewConfig

func NewConfig() *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 GlobalDataRestorationErrorExclusions struct {
	Constraints []string `mapstructure:"constraints" yaml:"constraints" json:"constraints,omitempty"`
	ErrorCodes  []string `mapstructure:"error_codes" yaml:"error_codes" json:"error_codes,omitempty"`
}

type LogConfig

type LogConfig struct {
	Format string `mapstructure:"format" yaml:"format" json:"format,omitempty"`
	Level  string `mapstructure:"level" yaml:"level" json:"level,omitempty"`
}

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 ReferencedColumn struct {
	Name       string `mapstructure:"name" json:"name" yaml:"name"`
	Expression string `mapstructure:"expression" json:"expression" yaml:"expression"`
}

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 StorageConfig struct {
	Type      string            `mapstructure:"type" yaml:"type" json:"type,omitempty"`
	S3        *s3.Config        `mapstructure:"s3"  json:"s3,omitempty" yaml:"s3"`
	Directory *directory.Config `mapstructure:"directory" json:"directory,omitempty" yaml:"directory"`
}

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

type VirtualReference struct {
	Schema     string       `mapstructure:"schema" json:"schema" yaml:"schema"`
	Name       string       `mapstructure:"name" json:"name" yaml:"name"`
	References []*Reference `mapstructure:"references" json:"references" yaml:"references"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL