domains

package
v0.1.14 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: Apache-2.0 Imports: 7 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 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"`
}

type LogConfig

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

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"`
}

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"`
}

type TransformerConfig

type TransformerConfig struct {
	Name     string               `mapstructure:"name" yaml:"name" json:"name,omitempty"`
	Settings *TransformerSettings `mapstructure:"settings,omitempty" yaml:"settings,omitempty" json:"settings,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 toolkit.Params `mapstructure:"-" yaml:"-" json:"-"` // yaml:"params" json:"params,omitempty"`
	// 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"`
}

type TransformerSettings

type TransformerSettings struct {
	NoValidateSchema           bool     `mapstructure:"no_validate_schema" yaml:"no_validate_schema" json:"no_validate_schema,omitempty"`
	ResolvedValidationWarnings []string `mapstructure:"resolved_validation_warnings" yaml:"resolved_validation_warnings" json:"resolved_validation_warnings,omitempty"`
}

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"`
}

Jump to

Keyboard shortcuts

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