Documentation ¶
Index ¶
- Constants
- Variables
- func EmailParse(email []byte) (localPart, domain []byte, err error)
- func EmailValidate(email []byte) bool
- func MakeNewFakeTransformerFunction(generator FakerFunc) utils.NewTransformerFunc
- func NewBooleanTransformer(ctx context.Context, driver *toolkit.Driver, ...) (utils.Transformer, toolkit.ValidationWarnings, error)
- func NewCmd(ctx context.Context, driver *toolkit.Driver, ...) (utils.Transformer, toolkit.ValidationWarnings, error)
- func NewDictTransformer(ctx context.Context, driver *toolkit.Driver, ...) (utils.Transformer, toolkit.ValidationWarnings, error)
- func NewEmailTransformer(ctx context.Context, driver *toolkit.Driver, ...) (utils.Transformer, toolkit.ValidationWarnings, error)
- func NewFakeTransformer(ctx context.Context, driver *toolkit.Driver, ...) (utils.Transformer, toolkit.ValidationWarnings, error)
- func NewFloatTransformer(ctx context.Context, driver *toolkit.Driver, ...) (utils.Transformer, toolkit.ValidationWarnings, error)
- func NewHashTransformer(ctx context.Context, driver *toolkit.Driver, ...) (utils.Transformer, toolkit.ValidationWarnings, error)
- func NewIntegerTransformer(ctx context.Context, driver *toolkit.Driver, ...) (utils.Transformer, toolkit.ValidationWarnings, error)
- func NewIpTransformer(ctx context.Context, driver *toolkit.Driver, ...) (utils.Transformer, toolkit.ValidationWarnings, error)
- func NewJsonTransformer(ctx context.Context, driver *toolkit.Driver, ...) (utils.Transformer, toolkit.ValidationWarnings, error)
- func NewMacAddressTransformer(ctx context.Context, driver *toolkit.Driver, ...) (utils.Transformer, toolkit.ValidationWarnings, error)
- func NewMaskingTransformer(ctx context.Context, driver *toolkit.Driver, ...) (utils.Transformer, toolkit.ValidationWarnings, error)
- func NewNoiseDateTransformer(ctx context.Context, driver *toolkit.Driver, ...) (utils.Transformer, toolkit.ValidationWarnings, error)
- func NewNoiseDateTransformerBase(ctx context.Context, driver *toolkit.Driver, ...) (utils.Transformer, toolkit.ValidationWarnings, error)
- func NewNoiseFloatTransformer(ctx context.Context, driver *toolkit.Driver, ...) (utils.Transformer, toolkit.ValidationWarnings, error)
- func NewNoiseIntTransformer(ctx context.Context, driver *toolkit.Driver, ...) (utils.Transformer, toolkit.ValidationWarnings, error)
- func NewNumericFloatTransformer(ctx context.Context, driver *toolkit.Driver, ...) (utils.Transformer, toolkit.ValidationWarnings, error)
- func NewRandomChoiceTransformer(ctx context.Context, driver *toolkit.Driver, ...) (utils.Transformer, toolkit.ValidationWarnings, error)
- func NewRandomNameTransformer(ctx context.Context, driver *toolkit.Driver, ...) (utils.Transformer, toolkit.ValidationWarnings, error)
- func NewRandomNumericTransformer(ctx context.Context, driver *toolkit.Driver, ...) (utils.Transformer, toolkit.ValidationWarnings, error)
- func NewRandomStringTransformer(ctx context.Context, driver *toolkit.Driver, ...) (utils.Transformer, toolkit.ValidationWarnings, error)
- func NewRandomUuidTransformer(ctx context.Context, driver *toolkit.Driver, ...) (utils.Transformer, toolkit.ValidationWarnings, error)
- func NewRealAddressTransformer(ctx context.Context, driver *toolkit.Driver, ...) (utils.Transformer, toolkit.ValidationWarnings, error)
- func NewRegexpReplaceTransformer(ctx context.Context, driver *toolkit.Driver, ...) (utils.Transformer, toolkit.ValidationWarnings, error)
- func NewReplaceTransformer(ctx context.Context, driver *toolkit.Driver, ...) (utils.Transformer, toolkit.ValidationWarnings, error)
- func NewSetNullTransformer(ctx context.Context, driver *toolkit.Driver, ...) (utils.Transformer, toolkit.ValidationWarnings, error)
- func NewTemplateRecordTransformer(ctx context.Context, driver *toolkit.Driver, ...) (utils.Transformer, toolkit.ValidationWarnings, error)
- func NewTemplateTransformer(ctx context.Context, driver *toolkit.Driver, ...) (utils.Transformer, toolkit.ValidationWarnings, error)
- func NewTimestampTransformer(ctx context.Context, driver *toolkit.Driver, ...) (utils.Transformer, toolkit.ValidationWarnings, error)
- func NewTimestampTransformerBase(ctx context.Context, driver *toolkit.Driver, ...) (utils.Transformer, toolkit.ValidationWarnings, error)
- func NewUnixTimestampTransformer(ctx context.Context, driver *toolkit.Driver, ...) (utils.Transformer, toolkit.ValidationWarnings, error)
- type BooleanTransformer
- type ChoiceTransformer
- type Cmd
- type Column
- type ColumnContext
- func (cc *ColumnContext) DecodeValue(v any) (any, error)
- func (cc *ColumnContext) DecodeValueByColumn(name string, v any) (any, error)
- func (cc *ColumnContext) DecodeValueByType(name string, v any) (any, error)
- func (cc *ColumnContext) EncodeValue(v any) (any, error)
- func (cc *ColumnContext) EncodeValueByColumn(name string, v any) (any, error)
- func (cc *ColumnContext) EncodeValueByType(name string, v any) (any, error)
- func (cc *ColumnContext) GetColumnType() string
- func (cc *ColumnContext) GetColumnValue(name string) (any, error)
- func (cc *ColumnContext) GetRawColumnValue(name string) (any, error)
- func (cc *ColumnContext) GetRawValue() (any, error)
- func (cc *ColumnContext) GetValue() (any, error)
- type DictTransformer
- type EmailTransformer
- type FakeTransformer
- type FakerFunc
- type FakerTransformerDef
- type FloatTransformer
- type HashTransformer
- type IntegerTransformer
- type JsonContext
- func (jc *JsonContext) DecodeValueByColumn(name string, v any) (any, error)
- func (jc *JsonContext) DecodeValueByType(name string, v any) (any, error)
- func (jc *JsonContext) EncodeValueByColumn(name string, v any) (any, error)
- func (jc *JsonContext) EncodeValueByType(name string, v any) (any, error)
- func (jc *JsonContext) GetColumnValue(name string) (any, error)
- func (jc *JsonContext) GetOriginalValue() any
- func (jc *JsonContext) GetPath() string
- func (jc *JsonContext) GetRawColumnValue(name string) (any, error)
- func (jc *JsonContext) OriginalValueExists() bool
- type JsonTransformer
- type MaskingTransformer
- type NoiseDateTransformer
- func (ndt *NoiseDateTransformer) Done(ctx context.Context) error
- func (ndt *NoiseDateTransformer) GetAffectedColumns() map[int]string
- func (ndt *NoiseDateTransformer) Init(ctx context.Context) error
- func (ndt *NoiseDateTransformer) Transform(ctx context.Context, r *toolkit.Record) (*toolkit.Record, error)
- type NoiseFloatTransformer
- func (nft *NoiseFloatTransformer) Done(ctx context.Context) error
- func (nft *NoiseFloatTransformer) GetAffectedColumns() map[int]string
- func (nft *NoiseFloatTransformer) Init(ctx context.Context) error
- func (nft *NoiseFloatTransformer) Transform(ctx context.Context, r *toolkit.Record) (*toolkit.Record, error)
- type NoiseIntTransformer
- func (nit *NoiseIntTransformer) Done(ctx context.Context) error
- func (nit *NoiseIntTransformer) GetAffectedColumns() map[int]string
- func (nit *NoiseIntTransformer) Init(ctx context.Context) error
- func (nit *NoiseIntTransformer) Transform(ctx context.Context, r *toolkit.Record) (*toolkit.Record, error)
- type NoiseNumericTransformer
- func (nft *NoiseNumericTransformer) Done(ctx context.Context) error
- func (nft *NoiseNumericTransformer) GetAffectedColumns() map[int]string
- func (nft *NoiseNumericTransformer) Init(ctx context.Context) error
- func (nft *NoiseNumericTransformer) Transform(ctx context.Context, r *toolkit.Record) (*toolkit.Record, error)
- type NumericTransformer
- type Operation
- type RandomIp
- type RandomMac
- type RandomNameTransformer
- func (nft *RandomNameTransformer) Done(ctx context.Context) error
- func (nft *RandomNameTransformer) GetAffectedColumns() map[int]string
- func (nft *RandomNameTransformer) Init(ctx context.Context) error
- func (nft *RandomNameTransformer) Transform(ctx context.Context, r *toolkit.Record) (*toolkit.Record, error)
- type RandomStringTransformer
- func (rst *RandomStringTransformer) Done(ctx context.Context) error
- func (rst *RandomStringTransformer) GetAffectedColumns() map[int]string
- func (rst *RandomStringTransformer) Init(ctx context.Context) error
- func (rst *RandomStringTransformer) Transform(ctx context.Context, r *toolkit.Record) (*toolkit.Record, error)
- type RandomUuidTransformer
- func (rut *RandomUuidTransformer) Done(ctx context.Context) error
- func (rut *RandomUuidTransformer) GetAffectedColumns() map[int]string
- func (rut *RandomUuidTransformer) Init(ctx context.Context) error
- func (rut *RandomUuidTransformer) Transform(ctx context.Context, r *toolkit.Record) (*toolkit.Record, error)
- type RealAddressColumn
- type RealAddressTransformer
- func (rat *RealAddressTransformer) Done(ctx context.Context) error
- func (rat *RealAddressTransformer) GetAffectedColumns() map[int]string
- func (rat *RealAddressTransformer) Init(ctx context.Context) error
- func (rat *RealAddressTransformer) Transform(ctx context.Context, r *toolkit.Record) (*toolkit.Record, error)
- type RealAddressValue
- type RegexpReplaceTransformer
- func (rrt *RegexpReplaceTransformer) Done(ctx context.Context) error
- func (rrt *RegexpReplaceTransformer) GetAffectedColumns() map[int]string
- func (rrt *RegexpReplaceTransformer) Init(ctx context.Context) error
- func (rrt *RegexpReplaceTransformer) Transform(ctx context.Context, r *toolkit.Record) (*toolkit.Record, error)
- type ReplaceTransformer
- type SetNullTransformer
- type TemplateRecordTransformer
- func (sut *TemplateRecordTransformer) Done(ctx context.Context) error
- func (sut *TemplateRecordTransformer) GetAffectedColumns() map[int]string
- func (sut *TemplateRecordTransformer) Init(ctx context.Context) error
- func (sut *TemplateRecordTransformer) Transform(ctx context.Context, r *toolkit.Record) (*toolkit.Record, error)
- type TemplateTransformer
- func (sut *TemplateTransformer) Done(ctx context.Context) error
- func (sut *TemplateTransformer) GetAffectedColumns() map[int]string
- func (sut *TemplateTransformer) Init(ctx context.Context) error
- func (sut *TemplateTransformer) Transform(ctx context.Context, r *toolkit.Record) (*toolkit.Record, error)
- type TimestampTransformer
- func (rdt *TimestampTransformer) Done(ctx context.Context) error
- func (rdt *TimestampTransformer) GetAffectedColumns() map[int]string
- func (rdt *TimestampTransformer) Init(ctx context.Context) error
- func (rdt *TimestampTransformer) Transform(_ context.Context, r *toolkit.Record) (*toolkit.Record, error)
- type UnixTimestampTransformer
Constants ¶
View Source
const ( RandomEngineParameterName = "random" HashEngineParameterName = "hash" )
View Source
const ( JsonDeleteOpName = "delete" JsonSetOpName = "set" )
View Source
const ( MPassword string = "password" MName string = "name" MAddress string = "addr" MEmail string = "email" MMobile string = "mobile" MTelephone string = "tel" MID string = "id" MCreditCard string = "credit_card" MURL string = "url" MDefault string = "default" )
View Source
const ( RandomLatitudeTransformerName = "RandomLatitude" RandomLongitudeTransformerName = "RandomLongitude" RandomMonthNameTransformerName = "RandomMonthName" RandomYearStringTransformerName = "RandomYearString" RandomDayOfWeekTransformerName = "RandomDayOfWeek" RandomDayOfMonthTransformerName = "RandomDayOfMonth" RandomCenturyTransformerName = "RandomCentury" RandomTimezoneTransformerName = "RandomTimezone" RandomDomainNameTransformerName = "RandomDomainName" RandomURLTransformerName = "RandomURL" RandomUsernameTransformerName = "RandomUsername" RandomPasswordTransformerName = "RandomPassword" RandomWordTransformerName = "RandomWord" RandomSentenceTransformerName = "RandomSentence" RandomParagraphTransformerName = "RandomParagraph" RandomCCTypeTransformerName = "RandomCCType" RandomCCNumberTransformerName = "RandomCCNumber" RandomCurrencyTransformerName = "RandomCurrency" RandomAmountWithCurrencyTransformerName = "RandomAmountWithCurrency" RandomPhoneNumberTransformerName = "RandomPhoneNumber" RandomTollFreePhoneNumberTransformerName = "RandomTollFreePhoneNumber" RandomE164PhoneNumberTransformerName = "RandomE164PhoneNumber" )
View Source
const ( Int2Length = 2 Int4Length = 4 Int8Length = 8 )
View Source
const ( AllowApplyForReferenced utils.MetaKey = "AllowApplyForReferenced" RequireHashEngineParameter utils.MetaKey = "RequireHashEngineParameter" )
View Source
const DictTransformerName = "Dict"
View Source
const HashTransformerName = "Hash"
View Source
const JsonTransformerName = "Json"
View Source
const MaskingTransformerName = "Masking"
View Source
const NoiseDateTransformerName = "NoiseDate"
View Source
const NoiseFloatTransformerName = "NoiseFloat"
View Source
const NoiseIntTransformerName = "NoiseInt"
View Source
const NoiseNumericTransformerName = "NoiseNumeric"
View Source
const RandomBoolTransformerName = "RandomBool"
View Source
const RandomChoiceTransformerName = "RandomChoice"
View Source
const RandomDateTransformerName = "RandomDate"
View Source
const RandomEmailTransformerName = "RandomEmail"
View Source
const RandomFloatTransformerName = "RandomFloat"
View Source
const RandomIntTransformerName = "RandomInt"
View Source
const RandomIpTransformerName = "RandomIp"
View Source
const RandomMacTransformerName = "RandomMac"
View Source
const RandomNumericTransformerName = "RandomNumeric"
View Source
const RandomPersonTransformerName = "RandomPerson"
View Source
const RandomStringTransformerName = "RandomString"
View Source
const RandomUnixTimestampTransformerName = "RandomUnixTimestamp"
View Source
const RandomUuidTransformerName = "RandomUuid"
View Source
const RealAddressTransformerName = "RealAddress"
View Source
const RegexpReplaceTransformerName = "RegexpReplace"
View Source
const ReplaceTransformerName = "Replace"
View Source
const SetNullTransformerName = "SetNull"
View Source
const TemplateRecordTransformerName = "TemplateRecord"
View Source
const TemplateTransformerName = "Template"
Variables ¶
View Source
var ChoiceTransformerDefinition = utils.NewTransformerDefinition( utils.NewTransformerProperties( RandomChoiceTransformerName, "Replace values chosen randomly from list", ).AddMeta(AllowApplyForReferenced, true). AddMeta(RequireHashEngineParameter, true), NewRandomChoiceTransformer, toolkit.MustNewParameterDefinition( "column", "column name", ).SetIsColumn(toolkit.NewColumnProperties(). SetAffected(true), ).SetRequired(true), toolkit.MustNewParameterDefinition( "values", `list of values in any format. The string with value "\N" supposed to be NULL value`, ).SetRequired(true). SetUnmarshaler(randomChoiceValuesUnmarshaller), toolkit.MustNewParameterDefinition( "validate", `perform decode procedure via PostgreSQL driver using column type, ensuring that value has correct type`, ).SetRequired(false). SetDefaultValue(toolkit.ParamsValue("true")), keepNullParameterDefinition, engineParameterDefinition, )
View Source
var CmdTransformerDefinition = utils.NewTransformerDefinition( utils.NewTransformerProperties( CmdTransformerName, "Transform data via external program using stdin and stdout interaction", ), NewCmd, toolkit.MustNewParameterDefinition( "columns", "affected column names. If empty use the whole tuple."+ "The structure:"+ `{`+ `"name": "type:string, required:true, description: column Name",`+ `"not_affected": "type:bool, required:false, description: is column affected in transformation", `+ `"skip_original_data": "type:bool, required:false, description: is original data required for transformer",`+ `"skip_on_null_input": "type:bool, required:false, description: skip transformation on null input"`+ `}`, ).SetDefaultValue([]byte("[]")). SetIsColumnContainer(true), toolkit.MustNewParameterDefinition( "executable", "path to executable file", ).SetRequired(true), toolkit.MustNewParameterDefinition( "args", "list of parameters for executable file", ).SetDefaultValue([]byte("[]")), toolkit.MustNewParameterDefinition( "driver", "row driver with parameters that is used for interacting with cmd. The default is csv. "+ `The structure is:`+ `{"name": "text|csv|json", "params": { "format": "[text|bytes]"} }`, ).SetDefaultValue([]byte(`{"name": "csv"}`)), toolkit.MustNewParameterDefinition( "validate", "try to encode-decode data received from cmd", ).SetDefaultValue([]byte("false")), toolkit.MustNewParameterDefinition( "timeout", "timeout for sending and receiving data from cmd", ).SetDefaultValue([]byte("2s")), toolkit.MustNewParameterDefinition( "expected_exit_code", "expected exit code", ).SetDefaultValue([]byte("0")), toolkit.MustNewParameterDefinition( "skip_on_behaviour", "skip transformation call if one of the provided columns has null value (any) or each of the provided"+ " column has null values (all). This option works together with skip_on_null_input parameter on columns."+ `Possible values: "all", "any"`, ).SetDefaultValue([]byte("all")). SetRawValueValidator(cmdValidateSkipBehaviour), )
View Source
var CmdTransformerName = "Cmd"
View Source
var DictTransformerDefinition = utils.NewTransformerDefinition( utils.NewTransformerProperties( DictTransformerName, "Replace values matched by dictionary keys", ), NewDictTransformer, toolkit.MustNewParameterDefinition( "column", "column name", ).SetIsColumn(toolkit.NewColumnProperties(). SetAffected(true), ).SetRequired(true), toolkit.MustNewParameterDefinition( "values", `map of value to replace in format: {"string": "string"}". The string with value "\N" supposed to be NULL value`, ).SetRequired(true), toolkit.MustNewParameterDefinition( "default", `default value if not any value has been matched with dict. The string with value "\N" supposed to be NULL value. Default is empty`, ).SetRequired(false), toolkit.MustNewParameterDefinition( "fail_not_matched", `fail if value is not matched with dict otherwise keep value`, ).SetRequired(false). SetDefaultValue(toolkit.ParamsValue("true")), toolkit.MustNewParameterDefinition( "validate", `perform encode-decode procedure using column type, ensuring that value has correct type`, ).SetRequired(false). SetDefaultValue(toolkit.ParamsValue("true")), )
View Source
var EmailTransformerDefinition = utils.NewTransformerDefinition( utils.NewTransformerProperties( RandomEmailTransformerName, "Generate random email", ).AddMeta(AllowApplyForReferenced, true). AddMeta(RequireHashEngineParameter, true), NewEmailTransformer, toolkit.MustNewParameterDefinition( "column", "column name", ).SetIsColumn(toolkit.NewColumnProperties(). SetAffected(true). SetAllowedColumnTypes( "text", "varchar", "char", "bpchar", ), ).SetRequired(true), toolkit.MustNewParameterDefinition( "keep_original_domain", `Keep original domain`, ).SetDefaultValue(toolkit.ParamsValue("false")), toolkit.MustNewParameterDefinition( "local_part_template", `The template for local part of email. By default it is random characters`, ), toolkit.MustNewParameterDefinition( "domain_part_template", `The template for domain part of email`, ), toolkit.MustNewParameterDefinition( "domains", `List of domains to use for random email generation`, ), toolkit.MustNewParameterDefinition( "validate", `validate generated email if using template`, ).SetDefaultValue(toolkit.ParamsValue("false")), toolkit.MustNewParameterDefinition( "max_random_length", `max length of randomly generated part of the email`, ).SetDefaultValue(toolkit.ParamsValue("32")), keepNullParameterDefinition, engineParameterDefinition, )
View Source
var FakerTransformersDes = map[string]*FakerTransformerDef{ RandomLatitudeTransformerName: { Generator: func(opts ...options.OptionFunc) string { return fmt.Sprintf("%f", faker.Latitude()) }, SupportedTypes: []string{"float4", "float8", "numeric"}, Description: "Generates a random latitude value.", }, RandomLongitudeTransformerName: { Generator: func(opts ...options.OptionFunc) string { return fmt.Sprintf("%f", faker.Longitude()) }, SupportedTypes: []string{"float4", "float8", "numeric"}, Description: "Generates a random longitude value.", }, RandomMonthNameTransformerName: { Generator: faker.MonthName, SupportedTypes: []string{"text", "varchar"}, Description: "Generates the name of a random month.", }, RandomYearStringTransformerName: { Generator: faker.YearString, SupportedTypes: []string{"text", "varchar", "int2", "int4", "int8", "numeric"}, Description: "Generates a random year as a string.", }, RandomDayOfWeekTransformerName: { Generator: faker.DayOfWeek, SupportedTypes: []string{"text", "varchar"}, Description: "Generates a random day of the week.", }, RandomDayOfMonthTransformerName: { Generator: faker.DayOfMonth, SupportedTypes: []string{"text", "varchar", "int2", "int4", "int8", "numeric"}, Description: "Generates a random day of the month.", }, RandomCenturyTransformerName: { Generator: faker.Century, SupportedTypes: []string{"text", "varchar"}, Description: "Generates a random century.", }, RandomTimezoneTransformerName: { Generator: faker.Timezone, SupportedTypes: []string{"text", "varchar"}, Description: "Generates a random timezone.", }, RandomDomainNameTransformerName: { Generator: faker.DomainName, SupportedTypes: []string{"text", "varchar"}, Description: "Generates a random domain name.", }, RandomURLTransformerName: { Generator: faker.URL, SupportedTypes: []string{"text", "varchar"}, Description: "Generates a random URL.", }, RandomUsernameTransformerName: { Generator: faker.Username, SupportedTypes: []string{"text", "varchar"}, Description: "Generates a random username.", }, RandomPasswordTransformerName: { Generator: faker.Password, SupportedTypes: []string{"text", "varchar"}, Description: "Generates a random password.", }, RandomWordTransformerName: { Generator: faker.Word, SupportedTypes: []string{"text", "varchar"}, Description: "Generates a random word.", }, RandomSentenceTransformerName: { Generator: faker.Sentence, SupportedTypes: []string{"text", "varchar"}, Description: "Generates a random sentence.", }, RandomParagraphTransformerName: { Generator: faker.Paragraph, SupportedTypes: []string{"text", "varchar"}, Description: "Generates a random paragraph.", }, RandomCCTypeTransformerName: { Generator: faker.CCType, SupportedTypes: []string{"text", "varchar"}, Description: "Generates a random credit card type.", }, RandomCCNumberTransformerName: { Generator: faker.CCNumber, SupportedTypes: []string{"text", "varchar", "int4", "int8", "numeric"}, Description: "Generates a random credit card number.", }, RandomCurrencyTransformerName: { Generator: faker.Currency, SupportedTypes: []string{"text", "varchar"}, Description: "Generates a random currency code.", }, RandomAmountWithCurrencyTransformerName: { Generator: faker.AmountWithCurrency, SupportedTypes: []string{"text", "varchar"}, Description: "Generates a random monetary amount with currency.", }, RandomPhoneNumberTransformerName: { Generator: faker.Phonenumber, SupportedTypes: []string{"text", "varchar"}, Description: "Generates a random phone number.", }, RandomTollFreePhoneNumberTransformerName: { Generator: faker.TollFreePhoneNumber, SupportedTypes: []string{"text", "varchar"}, Description: "Generates a random toll-free phone number.", }, RandomE164PhoneNumberTransformerName: { Generator: faker.E164PhoneNumber, SupportedTypes: []string{"text", "varchar"}, Description: "Generates a random phone number in E.164 format.", }, }
View Source
var HashTransformerDefinition = utils.NewTransformerDefinition( utils.NewTransformerProperties( HashTransformerName, "Generate hash of the text value using Scrypt hash function under the hood", ).AddMeta(AllowApplyForReferenced, true). AddMeta(RequireHashEngineParameter, false), NewHashTransformer, toolkit.MustNewParameterDefinition( "column", "column name", ).SetIsColumn(toolkit.NewColumnProperties(). SetAffected(true). SetAllowedColumnTypes("text", "varchar"), ).SetRequired(true), toolkit.MustNewParameterDefinition( "salt", "hex encoded salt string. This value may be provided via environment variable GREENMASK_GLOBAL_SALT", ).SetGetFromGlobalEnvVariable("GREENMASK_GLOBAL_SALT"), toolkit.MustNewParameterDefinition( "function", fmt.Sprintf("hash function name. Possible values: %s", strings.Join( []string{sha1Name, sha256Name, sha512Name, sha3224Name, sha3256Name, sha384Name, sha5124Name, md5Name}, ", ", ), ), ).SetDefaultValue([]byte(sha3256Name)). SetRawValueValidator(validateHashFunctionsParameter), toolkit.MustNewParameterDefinition( "max_length", "limit length of hash function result", ).SetDefaultValue([]byte("0")). SetRawValueValidator(validateMaxLengthParameter), )
View Source
var JsonTransformerDefinition = utils.NewTransformerDefinition( utils.NewTransformerProperties( JsonTransformerName, "Update json document", ), NewJsonTransformer, toolkit.MustNewParameterDefinition( "column", "column name", ).SetIsColumn(toolkit.NewColumnProperties(). SetAffected(true). SetAllowedColumnTypes("json", "jsonb"), ).SetRequired(true), toolkit.MustNewParameterDefinition( "operations", `list of operations that contains editing operation [{"operation": "set|delete", "path": "path to the part of the document", "value": "value in any type - string, int, float, list, object, null", "value_template": "go template", "error_not_exist", "raise error if not exists - boolean"}]`, ).SetRequired(true), toolkit.MustNewParameterDefinition( "keep_null", "apply changes in value is null", ).SetDefaultValue(toolkit.ParamsValue("true")), )
View Source
var MaskingTransformerDefinition = utils.NewTransformerDefinition( utils.NewTransformerProperties( MaskingTransformerName, "Mask a value using one of masking type", ), NewMaskingTransformer, toolkit.MustNewParameterDefinition( "column", "column name", ).SetIsColumn( toolkit.NewColumnProperties(). SetAffected(true). SetAllowedColumnTypes("text", "varchar"), ).SetRequired(true), toolkit.MustNewParameterDefinition( "type", "logical type of attribute (default, password, name, addr, email, mobile, tel, id, credit_card, url)", ).SetRawValueValidator(maskerTypeValidator). SetDefaultValue(toolkit.ParamsValue(MDefault)), )
View Source
var NoiseDateTransformerDefinition = utils.NewTransformerDefinition( utils.NewTransformerProperties( NoiseDateTransformerName, "Add some random value (shift value) in the provided interval", ).AddMeta(AllowApplyForReferenced, true). AddMeta(RequireHashEngineParameter, true), NewNoiseDateTransformer, toolkit.MustNewParameterDefinition( "column", "column name", ).SetIsColumn(toolkit.NewColumnProperties(). SetAffected(true). SetAllowedColumnTypes("date", "timestamp", "timestamptz"). SetSkipOnNull(true), ).SetRequired(true), toolkit.MustNewParameterDefinition( "min_ratio", "min random duration for noise. Dy default 5% of the max_ratio", ).SetCastDbType("interval"). SetSupportTemplate(true), toolkit.MustNewParameterDefinition( "max_ratio", "max random duration for noise", ).SetRequired(true). SetCastDbType("interval"). SetSupportTemplate(true), toolkit.MustNewParameterDefinition( "min", "min threshold date (and/or time) of value", ).SetSupportTemplate(true). SetLinkParameter("column"). SetDynamicMode( toolkit.NewDynamicModeProperties(). SetCompatibleTypes("date", "timestamp", "timestamptz"), ), toolkit.MustNewParameterDefinition( "max", "max threshold date (and/or time) of value", ).SetSupportTemplate(true). SetLinkParameter("column"). SetDynamicMode( toolkit.NewDynamicModeProperties(). SetCompatibleTypes("date", "timestamp", "timestamptz"), ), truncateDateParameterDefinition, engineParameterDefinition, )
View Source
var NoiseFloatTransformerDefinition = utils.NewTransformerDefinition( utils.NewTransformerProperties( NoiseFloatTransformerName, "Add noise to float value in min and max thresholds", ).AddMeta(AllowApplyForReferenced, true). AddMeta(RequireHashEngineParameter, true), NewNoiseFloatTransformer, toolkit.MustNewParameterDefinition( "column", "column name", ).SetIsColumn(toolkit.NewColumnProperties(). SetAffected(true). SetAllowedColumnTypes("float4", "float8"). SetSkipOnNull(true), ).SetRequired(true), toolkit.MustNewParameterDefinition( "decimal", "Numbers of decimal", ).SetSupportTemplate(true). SetDefaultValue(toolkit.ParamsValue("4")), toolkit.MustNewParameterDefinition( "min", "min float value threshold", ).SetLinkParameter("column"). SetSupportTemplate(true). SetDynamicMode( toolkit.NewDynamicModeProperties(). SetCompatibleTypes("float4", "float8", "int2", "int4", "int8"), ), toolkit.MustNewParameterDefinition( "max", "max float value threshold", ).SetLinkParameter("column"). SetSupportTemplate(true). SetDynamicMode( toolkit.NewDynamicModeProperties(). SetCompatibleTypes("float4", "float8", "int2", "int4", "int8"), ), minRatioParameterDefinition, maxRatioParameterDefinition, engineParameterDefinition, )
View Source
var NoiseIntTransformerDefinition = utils.NewTransformerDefinition( utils.NewTransformerProperties( NoiseIntTransformerName, "Make noise value for int", ).AddMeta(AllowApplyForReferenced, true). AddMeta(RequireHashEngineParameter, true), NewNoiseIntTransformer, toolkit.MustNewParameterDefinition( "column", "column name", ).SetIsColumn(toolkit.NewColumnProperties(). SetAffected(true). SetAllowedColumnTypes("int2", "int4", "int8"). SetSkipOnNull(true), ).SetRequired(true), toolkit.MustNewParameterDefinition( "min", "min value threshold limiter", ).SetSupportTemplate(true). SetDynamicMode( toolkit.NewDynamicModeProperties(). SetCompatibleTypes("int2", "int4", "int8"), ), toolkit.MustNewParameterDefinition( "max", "max value threshold limiter", ).SetSupportTemplate(true). SetDynamicMode( toolkit.NewDynamicModeProperties(). SetCompatibleTypes("int2", "int4", "int8"), ), minRatioParameterDefinition, maxRatioParameterDefinition, engineParameterDefinition, )
View Source
var NoiseNumericTransformerDefinition = utils.NewTransformerDefinition( utils.NewTransformerProperties( NoiseNumericTransformerName, "Add noise to numeric value in min and max thresholds", ).AddMeta(AllowApplyForReferenced, true). AddMeta(RequireHashEngineParameter, true), NewNumericFloatTransformer, toolkit.MustNewParameterDefinition( "column", "column name", ).SetIsColumn(toolkit.NewColumnProperties(). SetAffected(true). SetAllowedColumnTypes("numeric", "decimal"). SetSkipOnNull(true), ).SetRequired(true), toolkit.MustNewParameterDefinition( "decimal", "Numbers of decimal", ).SetSupportTemplate(true). SetDefaultValue(toolkit.ParamsValue("4")), toolkit.MustNewParameterDefinition( "min", "min float value threshold", ).SetSupportTemplate(true). SetLinkParameter("column"). SetDynamicMode( toolkit.NewDynamicModeProperties(). SetCompatibleTypes( "float4", "float8", "numeric", "decimal", "int2", "int4", "int8", ).SetUnmarshaler(numericTypeUnmarshaler), ), toolkit.MustNewParameterDefinition( "max", "max float value threshold", ).SetSupportTemplate(true). SetLinkParameter("column"). SetDynamicMode( toolkit.NewDynamicModeProperties(). SetCompatibleTypes( "float4", "float8", "numeric", "decimal", "int2", "int4", "int8", ).SetUnmarshaler(numericTypeUnmarshaler), ), minRatioParameterDefinition, maxRatioParameterDefinition, engineParameterDefinition, )
View Source
var RandomIpDefinition = utils.NewTransformerDefinition( utils.NewTransformerProperties( RandomIpTransformerName, "Generate V4 or V6 IP in the provided subnet", ).AddMeta(AllowApplyForReferenced, true). AddMeta(RequireHashEngineParameter, true), NewIpTransformer, toolkit.MustNewParameterDefinition( "column", "Column name", ).SetIsColumn(toolkit.NewColumnProperties(). SetAffected(true). SetAllowedColumnTypes("text", "varchar", "inet"), ).SetRequired(true), toolkit.MustNewParameterDefinition( "subnet", "Subnet for generating random ip in V4 or V6 format", ).SetRequired(true). SetSupportTemplate(true). SetCastDbType("cidr"). SetDynamicMode( toolkit.NewDynamicModeProperties(). SetCompatibleTypes("text", "varchar", "cidr"), ), engineParameterDefinition, )
View Source
var RandomMacAddressDefinition = utils.NewTransformerDefinition( utils.NewTransformerProperties( RandomMacTransformerName, "Generate random mac address", ).AddMeta(AllowApplyForReferenced, true). AddMeta(RequireHashEngineParameter, true), NewMacAddressTransformer, toolkit.MustNewParameterDefinition( "column", "Column name", ).SetIsColumn(toolkit.NewColumnProperties(). SetAffected(true). SetAllowedColumnTypes("macaddr", "varchar", "text"), ).SetRequired(true), toolkit.MustNewParameterDefinition( "keep_original_vendor", "Keep original vendor. Default false", ).SetRequired(false). SetDefaultValue(toolkit.ParamsValue("false")), toolkit.MustNewParameterDefinition( "cast_type", "Cast type, supported types are: individual, group, any.", ).SetRequired(false). SetAllowedValues( toolkit.ParamsValue(castTypeNameIndividual), toolkit.ParamsValue(castTypeNameGroup), toolkit.ParamsValue(castTypeNameAny), ). SetDefaultValue(toolkit.ParamsValue(castTypeNameAny)). SetUnmarshaler(scanCastType), toolkit.MustNewParameterDefinition( "management_type", "Management type, supported types are: universal, local, any.", ).SetRequired(false).SetAllowedValues( toolkit.ParamsValue(managementTypeNameUniversal), toolkit.ParamsValue(managementTypeNameLocal), toolkit.ParamsValue(managementTypeNameAny), ).SetDefaultValue(toolkit.ParamsValue(managementTypeNameAny)). SetUnmarshaler(scanManagementType), engineParameterDefinition, )
View Source
var RealAddressTransformerDefinition = utils.NewTransformerDefinition( utils.NewTransformerProperties( RealAddressTransformerName, "Generate a real address", ), NewRealAddressTransformer, toolkit.MustNewParameterDefinition( "columns", "affected column names."+ "The structure:"+ `{`+ `"name": "type:string, required:true, description: column Name",`+ `"template": "type:string, required:true, description: gotemplate with real address attributes injections",`+ `"keep_null": "type:bool, required:false, description: keep null values",`+ `}`, ).SetRequired(true). SetIsColumnContainer(true), )
View Source
var RegexpReplaceTransformerDefinition = utils.NewTransformerDefinition( utils.NewTransformerProperties( RegexpReplaceTransformerName, "Replace string using regular expression", ).AddMeta(AllowApplyForReferenced, true). AddMeta(RequireHashEngineParameter, true), NewRegexpReplaceTransformer, toolkit.MustNewParameterDefinition( "column", "column name", ).SetIsColumn(toolkit.NewColumnProperties(). SetAffected(true). SetAllowedColumnTypes("varchar", "text", "bpchar"), ).SetRequired(true), toolkit.MustNewParameterDefinition( "regexp", "regular expression", ).SetRequired(true), toolkit.MustNewParameterDefinition( "replace", "replacement value", ).SetRequired(true), )
View Source
var ReplaceTransformerDefinition = utils.NewTransformerDefinition( utils.NewTransformerProperties( ReplaceTransformerName, "Replace column value to the provided", ).AddMeta(AllowApplyForReferenced, true). AddMeta(RequireHashEngineParameter, true), NewReplaceTransformer, toolkit.MustNewParameterDefinition( "column", "column name", ).SetIsColumn(toolkit.NewColumnProperties(). SetAffected(true), ).SetRequired(true), toolkit.MustNewParameterDefinition( "value", "value to replace", ).SetRequired(true). SetLinkParameter("column"), toolkit.MustNewParameterDefinition( "keep_null", "indicates that NULL values must not be replaced with transformed values", ).SetDefaultValue(toolkit.ParamsValue("true")), toolkit.MustNewParameterDefinition( "validate", "validate the value via driver decoding procedure", ).SetDefaultValue(toolkit.ParamsValue("true")), )
View Source
var SetNullTransformerDefinition = utils.NewTransformerDefinition( utils.NewTransformerProperties( SetNullTransformerName, "Set NULL value", ), NewSetNullTransformer, toolkit.MustNewParameterDefinition( "column", "column name", ).SetIsColumn(toolkit.NewColumnProperties(). SetAffected(true). SetNullable(true), ).SetRequired(true), )
View Source
var TemplateRecordTransformerDefinition = utils.NewTransformerDefinition( utils.NewTransformerProperties( TemplateRecordTransformerName, "Modify the record using gotemplate", ), NewTemplateRecordTransformer, toolkit.MustNewParameterDefinition( "template", "gotemplate string", ).SetRequired(true), toolkit.MustNewParameterDefinition( "validate", "validate template result via PostgreSQL driver decoding", ).SetRequired(false). SetDefaultValue(toolkit.ParamsValue("false")), toolkit.MustNewParameterDefinition( "columns", "columns that supposed to be affected by the template. The list of columns will be checked for constraint violation", ).SetRequired(false). SetDefaultValue(toolkit.ParamsValue("[]")), )
View Source
var TemplateTransformerDefinition = utils.NewTransformerDefinition( utils.NewTransformerProperties( TemplateTransformerName, "Modify the value using gotemplate", ), NewTemplateTransformer, toolkit.MustNewParameterDefinition( "column", "column name", ).SetIsColumn(toolkit.NewColumnProperties(). SetAffected(true), ).SetRequired(true), toolkit.MustNewParameterDefinition( "template", "gotemplate string", ).SetRequired(true), toolkit.MustNewParameterDefinition( "validate", "validate template result via PostgreSQL driver decoding", ).SetRequired(false). SetDefaultValue(toolkit.ParamsValue("false")), )
Functions ¶
func EmailParse ¶ added in v0.2.0
EmailParse parses the email into local part and domain part, and returns an error if the format is wrong
func EmailValidate ¶ added in v0.2.0
EmailValidate checks if the email is in a valid format
func MakeNewFakeTransformerFunction ¶ added in v0.1.1
func MakeNewFakeTransformerFunction(generator FakerFunc) utils.NewTransformerFunc
func NewBooleanTransformer ¶ added in v0.2.0
func NewBooleanTransformer(ctx context.Context, driver *toolkit.Driver, parameters map[string]toolkit.Parameterizer) (utils.Transformer, toolkit.ValidationWarnings, error)
func NewCmd ¶
func NewCmd( ctx context.Context, driver *toolkit.Driver, parameters map[string]toolkit.Parameterizer, ) (utils.Transformer, toolkit.ValidationWarnings, error)
func NewDictTransformer ¶
func NewDictTransformer( ctx context.Context, driver *toolkit.Driver, parameters map[string]toolkit.Parameterizer, ) (utils.Transformer, toolkit.ValidationWarnings, error)
func NewEmailTransformer ¶ added in v0.2.0
func NewEmailTransformer(ctx context.Context, driver *toolkit.Driver, parameters map[string]toolkit.Parameterizer) (utils.Transformer, toolkit.ValidationWarnings, error)
func NewFakeTransformer ¶ added in v0.1.1
func NewFakeTransformer( ctx context.Context, driver *toolkit.Driver, parameters map[string]toolkit.Parameterizer, generator FakerFunc, ) (utils.Transformer, toolkit.ValidationWarnings, error)
func NewFloatTransformer ¶ added in v0.2.0
func NewFloatTransformer(ctx context.Context, driver *toolkit.Driver, parameters map[string]toolkit.Parameterizer) (utils.Transformer, toolkit.ValidationWarnings, error)
func NewHashTransformer ¶
func NewHashTransformer( ctx context.Context, driver *toolkit.Driver, parameters map[string]toolkit.Parameterizer, ) (utils.Transformer, toolkit.ValidationWarnings, error)
func NewIntegerTransformer ¶ added in v0.2.0
func NewIntegerTransformer(ctx context.Context, driver *toolkit.Driver, parameters map[string]toolkit.Parameterizer) (utils.Transformer, toolkit.ValidationWarnings, error)
func NewIpTransformer ¶ added in v0.2.0
func NewIpTransformer(ctx context.Context, driver *toolkit.Driver, parameters map[string]toolkit.Parameterizer) (utils.Transformer, toolkit.ValidationWarnings, error)
func NewJsonTransformer ¶
func NewJsonTransformer(ctx context.Context, driver *toolkit.Driver, parameters map[string]toolkit.Parameterizer) (utils.Transformer, toolkit.ValidationWarnings, error)
func NewMacAddressTransformer ¶ added in v0.2.0
func NewMacAddressTransformer(ctx context.Context, driver *toolkit.Driver, parameters map[string]toolkit.Parameterizer) (utils.Transformer, toolkit.ValidationWarnings, error)
func NewMaskingTransformer ¶
func NewMaskingTransformer(ctx context.Context, driver *toolkit.Driver, parameters map[string]toolkit.Parameterizer) (utils.Transformer, toolkit.ValidationWarnings, error)
func NewNoiseDateTransformer ¶
func NewNoiseDateTransformer(ctx context.Context, driver *toolkit.Driver, parameters map[string]toolkit.Parameterizer) (utils.Transformer, toolkit.ValidationWarnings, error)
func NewNoiseDateTransformerBase ¶ added in v0.2.0
func NewNoiseDateTransformerBase(ctx context.Context, driver *toolkit.Driver, parameters map[string]toolkit.Parameterizer, encoder noiseTimestampMinMaxEncoder) (utils.Transformer, toolkit.ValidationWarnings, error)
func NewNoiseFloatTransformer ¶
func NewNoiseFloatTransformer(ctx context.Context, driver *toolkit.Driver, parameters map[string]toolkit.Parameterizer) (utils.Transformer, toolkit.ValidationWarnings, error)
func NewNoiseIntTransformer ¶
func NewNoiseIntTransformer(ctx context.Context, driver *toolkit.Driver, parameters map[string]toolkit.Parameterizer) (utils.Transformer, toolkit.ValidationWarnings, error)
func NewNumericFloatTransformer ¶ added in v0.2.0
func NewNumericFloatTransformer(ctx context.Context, driver *toolkit.Driver, parameters map[string]toolkit.Parameterizer) (utils.Transformer, toolkit.ValidationWarnings, error)
func NewRandomChoiceTransformer ¶
func NewRandomChoiceTransformer( ctx context.Context, driver *toolkit.Driver, parameters map[string]toolkit.Parameterizer, ) (utils.Transformer, toolkit.ValidationWarnings, error)
func NewRandomNameTransformer ¶ added in v0.2.0
func NewRandomNameTransformer(ctx context.Context, driver *toolkit.Driver, parameters map[string]toolkit.Parameterizer) (utils.Transformer, toolkit.ValidationWarnings, error)
func NewRandomNumericTransformer ¶ added in v0.2.0
func NewRandomNumericTransformer(ctx context.Context, driver *toolkit.Driver, parameters map[string]toolkit.Parameterizer) (utils.Transformer, toolkit.ValidationWarnings, error)
func NewRandomStringTransformer ¶
func NewRandomStringTransformer(ctx context.Context, driver *toolkit.Driver, parameters map[string]toolkit.Parameterizer) (utils.Transformer, toolkit.ValidationWarnings, error)
func NewRandomUuidTransformer ¶
func NewRandomUuidTransformer(ctx context.Context, driver *toolkit.Driver, parameters map[string]toolkit.Parameterizer) (utils.Transformer, toolkit.ValidationWarnings, error)
func NewRealAddressTransformer ¶ added in v0.1.1
func NewRealAddressTransformer(ctx context.Context, driver *toolkit.Driver, parameters map[string]toolkit.Parameterizer) (utils.Transformer, toolkit.ValidationWarnings, error)
func NewRegexpReplaceTransformer ¶
func NewRegexpReplaceTransformer(ctx context.Context, driver *toolkit.Driver, parameters map[string]toolkit.Parameterizer) (utils.Transformer, toolkit.ValidationWarnings, error)
func NewReplaceTransformer ¶
func NewReplaceTransformer(ctx context.Context, driver *toolkit.Driver, parameters map[string]toolkit.Parameterizer) (utils.Transformer, toolkit.ValidationWarnings, error)
func NewSetNullTransformer ¶
func NewSetNullTransformer(ctx context.Context, driver *toolkit.Driver, parameters map[string]toolkit.Parameterizer) (utils.Transformer, toolkit.ValidationWarnings, error)
func NewTemplateRecordTransformer ¶
func NewTemplateRecordTransformer(ctx context.Context, driver *toolkit.Driver, parameters map[string]toolkit.Parameterizer) (utils.Transformer, toolkit.ValidationWarnings, error)
func NewTemplateTransformer ¶
func NewTemplateTransformer(ctx context.Context, driver *toolkit.Driver, parameters map[string]toolkit.Parameterizer) (utils.Transformer, toolkit.ValidationWarnings, error)
func NewTimestampTransformer ¶ added in v0.2.0
func NewTimestampTransformer(ctx context.Context, driver *toolkit.Driver, parameters map[string]toolkit.Parameterizer) (utils.Transformer, toolkit.ValidationWarnings, error)
func NewTimestampTransformerBase ¶ added in v0.2.0
func NewTimestampTransformerBase(ctx context.Context, driver *toolkit.Driver, parameters map[string]toolkit.Parameterizer, encoder timestampMinMaxEncoder) (utils.Transformer, toolkit.ValidationWarnings, error)
func NewUnixTimestampTransformer ¶ added in v0.2.0
func NewUnixTimestampTransformer(ctx context.Context, driver *toolkit.Driver, parameters map[string]toolkit.Parameterizer) (utils.Transformer, toolkit.ValidationWarnings, error)
Types ¶
type BooleanTransformer ¶ added in v0.2.0
type BooleanTransformer struct {
// contains filtered or unexported fields
}
func (*BooleanTransformer) Done ¶ added in v0.2.0
func (rbt *BooleanTransformer) Done(ctx context.Context) error
func (*BooleanTransformer) GetAffectedColumns ¶ added in v0.2.0
func (rbt *BooleanTransformer) GetAffectedColumns() map[int]string
type ChoiceTransformer ¶ added in v0.2.0
type ChoiceTransformer struct {
// contains filtered or unexported fields
}
func (*ChoiceTransformer) Done ¶ added in v0.2.0
func (rct *ChoiceTransformer) Done(ctx context.Context) error
func (*ChoiceTransformer) GetAffectedColumns ¶ added in v0.2.0
func (rct *ChoiceTransformer) GetAffectedColumns() map[int]string
type Cmd ¶
type Cmd struct { *utils.CmdTransformerBase Columns []*Column // contains filtered or unexported fields }
func (*Cmd) GetAffectedColumns ¶
type ColumnContext ¶
type ColumnContext struct {
// contains filtered or unexported fields
}
func NewColumnContext ¶
func NewColumnContext(columnType string, columnName string) *ColumnContext
func (*ColumnContext) DecodeValue ¶
func (cc *ColumnContext) DecodeValue(v any) (any, error)
func (*ColumnContext) DecodeValueByColumn ¶
func (cc *ColumnContext) DecodeValueByColumn(name string, v any) (any, error)
func (*ColumnContext) DecodeValueByType ¶
func (cc *ColumnContext) DecodeValueByType(name string, v any) (any, error)
func (*ColumnContext) EncodeValue ¶
func (cc *ColumnContext) EncodeValue(v any) (any, error)
func (*ColumnContext) EncodeValueByColumn ¶
func (cc *ColumnContext) EncodeValueByColumn(name string, v any) (any, error)
func (*ColumnContext) EncodeValueByType ¶
func (cc *ColumnContext) EncodeValueByType(name string, v any) (any, error)
func (*ColumnContext) GetColumnType ¶
func (cc *ColumnContext) GetColumnType() string
func (*ColumnContext) GetColumnValue ¶
func (cc *ColumnContext) GetColumnValue(name string) (any, error)
func (*ColumnContext) GetRawColumnValue ¶ added in v0.2.3
func (cc *ColumnContext) GetRawColumnValue(name string) (any, error)
func (*ColumnContext) GetRawValue ¶
func (cc *ColumnContext) GetRawValue() (any, error)
func (*ColumnContext) GetValue ¶
func (cc *ColumnContext) GetValue() (any, error)
type DictTransformer ¶
type DictTransformer struct {
// contains filtered or unexported fields
}
func (*DictTransformer) GetAffectedColumns ¶
func (ht *DictTransformer) GetAffectedColumns() map[int]string
type EmailTransformer ¶ added in v0.2.0
type EmailTransformer struct {
// contains filtered or unexported fields
}
func (*EmailTransformer) Done ¶ added in v0.2.0
func (rit *EmailTransformer) Done(ctx context.Context) error
func (*EmailTransformer) GetAffectedColumns ¶ added in v0.2.0
func (rit *EmailTransformer) GetAffectedColumns() map[int]string
type FakeTransformer ¶ added in v0.1.1
type FakeTransformer struct {
// contains filtered or unexported fields
}
func (*FakeTransformer) Done ¶ added in v0.1.1
func (fts *FakeTransformer) Done(ctx context.Context) error
func (*FakeTransformer) GetAffectedColumns ¶ added in v0.1.1
func (fts *FakeTransformer) GetAffectedColumns() map[int]string
type FakerFunc ¶ added in v0.1.1
type FakerFunc func(opts ...options.OptionFunc) string
type FakerTransformerDef ¶ added in v0.1.1
type FloatTransformer ¶ added in v0.2.0
type FloatTransformer struct {
// contains filtered or unexported fields
}
func (*FloatTransformer) Done ¶ added in v0.2.0
func (rit *FloatTransformer) Done(_ context.Context) error
func (*FloatTransformer) GetAffectedColumns ¶ added in v0.2.0
func (rit *FloatTransformer) GetAffectedColumns() map[int]string
type HashTransformer ¶
type HashTransformer struct {
// contains filtered or unexported fields
}
func (*HashTransformer) GetAffectedColumns ¶
func (ht *HashTransformer) GetAffectedColumns() map[int]string
type IntegerTransformer ¶ added in v0.2.0
type IntegerTransformer struct { *transformers.RandomInt64Transformer // contains filtered or unexported fields }
func (*IntegerTransformer) Done ¶ added in v0.2.0
func (rit *IntegerTransformer) Done(_ context.Context) error
func (*IntegerTransformer) GetAffectedColumns ¶ added in v0.2.0
func (rit *IntegerTransformer) GetAffectedColumns() map[int]string
type JsonContext ¶
type JsonContext struct {
// contains filtered or unexported fields
}
func NewJsonContext ¶
func NewJsonContext() *JsonContext
func (*JsonContext) DecodeValueByColumn ¶
func (jc *JsonContext) DecodeValueByColumn(name string, v any) (any, error)
func (*JsonContext) DecodeValueByType ¶
func (jc *JsonContext) DecodeValueByType(name string, v any) (any, error)
func (*JsonContext) EncodeValueByColumn ¶
func (jc *JsonContext) EncodeValueByColumn(name string, v any) (any, error)
func (*JsonContext) EncodeValueByType ¶
func (jc *JsonContext) EncodeValueByType(name string, v any) (any, error)
func (*JsonContext) GetColumnValue ¶
func (jc *JsonContext) GetColumnValue(name string) (any, error)
func (*JsonContext) GetOriginalValue ¶
func (jc *JsonContext) GetOriginalValue() any
func (*JsonContext) GetPath ¶
func (jc *JsonContext) GetPath() string
func (*JsonContext) GetRawColumnValue ¶ added in v0.2.3
func (jc *JsonContext) GetRawColumnValue(name string) (any, error)
func (*JsonContext) OriginalValueExists ¶
func (jc *JsonContext) OriginalValueExists() bool
type JsonTransformer ¶
type JsonTransformer struct {
// contains filtered or unexported fields
}
func (*JsonTransformer) GetAffectedColumns ¶
func (jt *JsonTransformer) GetAffectedColumns() map[int]string
type MaskingTransformer ¶
type MaskingTransformer struct {
// contains filtered or unexported fields
}
func (*MaskingTransformer) GetAffectedColumns ¶
func (mt *MaskingTransformer) GetAffectedColumns() map[int]string
type NoiseDateTransformer ¶
type NoiseDateTransformer struct {
// contains filtered or unexported fields
}
func (*NoiseDateTransformer) Done ¶
func (ndt *NoiseDateTransformer) Done(ctx context.Context) error
func (*NoiseDateTransformer) GetAffectedColumns ¶
func (ndt *NoiseDateTransformer) GetAffectedColumns() map[int]string
type NoiseFloatTransformer ¶
type NoiseFloatTransformer struct {
// contains filtered or unexported fields
}
func (*NoiseFloatTransformer) Done ¶
func (nft *NoiseFloatTransformer) Done(ctx context.Context) error
func (*NoiseFloatTransformer) GetAffectedColumns ¶
func (nft *NoiseFloatTransformer) GetAffectedColumns() map[int]string
type NoiseIntTransformer ¶
type NoiseIntTransformer struct {
// contains filtered or unexported fields
}
func (*NoiseIntTransformer) GetAffectedColumns ¶
func (nit *NoiseIntTransformer) GetAffectedColumns() map[int]string
type NoiseNumericTransformer ¶ added in v0.2.0
type NoiseNumericTransformer struct {
// contains filtered or unexported fields
}
TODO: Add numeric introspection (getting the Numering settings)
func (*NoiseNumericTransformer) Done ¶ added in v0.2.0
func (nft *NoiseNumericTransformer) Done(ctx context.Context) error
func (*NoiseNumericTransformer) GetAffectedColumns ¶ added in v0.2.0
func (nft *NoiseNumericTransformer) GetAffectedColumns() map[int]string
type NumericTransformer ¶ added in v0.2.0
type NumericTransformer struct { *transformers.RandomNumericTransformer // contains filtered or unexported fields }
TODO: Add numeric introspection (getting the Numering settings)
func (*NumericTransformer) Done ¶ added in v0.2.0
func (bit *NumericTransformer) Done(ctx context.Context) error
func (*NumericTransformer) GetAffectedColumns ¶ added in v0.2.0
func (bit *NumericTransformer) GetAffectedColumns() map[int]string
type Operation ¶
type Operation struct { Operation string `mapstructure:"operation" json:"operation"` Value interface{} `mapstructure:"value,omitempty" json:"value"` ValueTemplate string `mapstructure:"value_template,omitempty" json:"value_template"` Path string `mapstructure:"path" json:"path"` ErrorNotExist bool `mapstructure:"error_not_exist" json:"error_not_exist"` // contains filtered or unexported fields }
type RandomIp ¶ added in v0.2.0
type RandomIp struct {
// contains filtered or unexported fields
}
func (*RandomIp) GetAffectedColumns ¶ added in v0.2.0
type RandomMac ¶ added in v0.2.0
type RandomMac struct {
// contains filtered or unexported fields
}
func (*RandomMac) GetAffectedColumns ¶ added in v0.2.0
type RandomNameTransformer ¶ added in v0.2.0
type RandomNameTransformer struct {
// contains filtered or unexported fields
}
func (*RandomNameTransformer) Done ¶ added in v0.2.0
func (nft *RandomNameTransformer) Done(ctx context.Context) error
func (*RandomNameTransformer) GetAffectedColumns ¶ added in v0.2.0
func (nft *RandomNameTransformer) GetAffectedColumns() map[int]string
type RandomStringTransformer ¶
type RandomStringTransformer struct {
// contains filtered or unexported fields
}
func (*RandomStringTransformer) Done ¶
func (rst *RandomStringTransformer) Done(ctx context.Context) error
func (*RandomStringTransformer) GetAffectedColumns ¶
func (rst *RandomStringTransformer) GetAffectedColumns() map[int]string
type RandomUuidTransformer ¶
type RandomUuidTransformer struct {
// contains filtered or unexported fields
}
func (*RandomUuidTransformer) Done ¶
func (rut *RandomUuidTransformer) Done(ctx context.Context) error
func (*RandomUuidTransformer) GetAffectedColumns ¶
func (rut *RandomUuidTransformer) GetAffectedColumns() map[int]string
type RealAddressColumn ¶ added in v0.1.1
type RealAddressTransformer ¶ added in v0.1.1
type RealAddressTransformer struct {
// contains filtered or unexported fields
}
func (*RealAddressTransformer) Done ¶ added in v0.1.1
func (rat *RealAddressTransformer) Done(ctx context.Context) error
func (*RealAddressTransformer) GetAffectedColumns ¶ added in v0.1.1
func (rat *RealAddressTransformer) GetAffectedColumns() map[int]string
type RealAddressValue ¶ added in v0.1.1
type RegexpReplaceTransformer ¶
type RegexpReplaceTransformer struct {
// contains filtered or unexported fields
}
func (*RegexpReplaceTransformer) Done ¶
func (rrt *RegexpReplaceTransformer) Done(ctx context.Context) error
func (*RegexpReplaceTransformer) GetAffectedColumns ¶
func (rrt *RegexpReplaceTransformer) GetAffectedColumns() map[int]string
type ReplaceTransformer ¶
type ReplaceTransformer struct {
// contains filtered or unexported fields
}
func (*ReplaceTransformer) GetAffectedColumns ¶
func (rt *ReplaceTransformer) GetAffectedColumns() map[int]string
type SetNullTransformer ¶
type SetNullTransformer struct {
// contains filtered or unexported fields
}
func (*SetNullTransformer) GetAffectedColumns ¶
func (sut *SetNullTransformer) GetAffectedColumns() map[int]string
type TemplateRecordTransformer ¶
type TemplateRecordTransformer struct {
// contains filtered or unexported fields
}
func (*TemplateRecordTransformer) Done ¶
func (sut *TemplateRecordTransformer) Done(ctx context.Context) error
func (*TemplateRecordTransformer) GetAffectedColumns ¶
func (sut *TemplateRecordTransformer) GetAffectedColumns() map[int]string
type TemplateTransformer ¶
type TemplateTransformer struct {
// contains filtered or unexported fields
}
func (*TemplateTransformer) GetAffectedColumns ¶
func (sut *TemplateTransformer) GetAffectedColumns() map[int]string
type TimestampTransformer ¶ added in v0.2.0
type TimestampTransformer struct { *transformers.Timestamp // contains filtered or unexported fields }
func (*TimestampTransformer) Done ¶ added in v0.2.0
func (rdt *TimestampTransformer) Done(ctx context.Context) error
func (*TimestampTransformer) GetAffectedColumns ¶ added in v0.2.0
func (rdt *TimestampTransformer) GetAffectedColumns() map[int]string
type UnixTimestampTransformer ¶ added in v0.2.0
type UnixTimestampTransformer struct { *TimestampTransformer // contains filtered or unexported fields }
Source Files ¶
- cmd.go
- column_context.go
- data.go
- default_params.go
- dict.go
- email.go
- hash.go
- json.go
- json_context.go
- masking.go
- noise_date.go
- noise_float.go
- noise_int.go
- noise_numeric.go
- random_bool.go
- random_choice.go
- random_date.go
- random_faker.go
- random_float.go
- random_int.go
- random_ip.go
- random_mac.go
- random_numeric.go
- random_person.go
- random_string.go
- random_unix_timestamp.go
- random_uuid.go
- real_address.go
- regexp_replace.go
- replace.go
- set_null.go
- template.go
- template_record.go
- utils.go
Click to show internal directories.
Click to hide internal directories.