forked from deblan/database-anonymizer
add postgres column type check
add specific method to handle named parameters
This commit is contained in:
parent
2ba8561574
commit
a7cd0634ef
4 changed files with 99 additions and 45 deletions
25
data/data.go
25
data/data.go
|
|
@ -16,30 +16,47 @@ type Data struct {
|
|||
IsVirtual bool
|
||||
IsPrimaryKey bool
|
||||
IsUpdated bool
|
||||
IsInteger bool
|
||||
|
||||
IsInteger bool
|
||||
IsBoolean bool
|
||||
IsString bool
|
||||
IsNull bool
|
||||
}
|
||||
|
||||
func (d *Data) FromByte(v []byte) *Data {
|
||||
d.Value = string(v)
|
||||
d.IsInteger = false
|
||||
|
||||
return d
|
||||
}
|
||||
|
||||
func (d *Data) FromInt64(v int64) *Data {
|
||||
d.Value = strconv.FormatInt(v, 10)
|
||||
d.IsInteger = true
|
||||
|
||||
return d
|
||||
}
|
||||
|
||||
func (d *Data) FromString(v string) *Data {
|
||||
d.Value = v
|
||||
d.IsInteger = false
|
||||
|
||||
return d
|
||||
}
|
||||
|
||||
func (d *Data) FinalValue() string {
|
||||
if d.IsNull {
|
||||
return "null"
|
||||
}
|
||||
|
||||
if d.IsBoolean {
|
||||
if d.Value == "1" {
|
||||
return "true"
|
||||
} else {
|
||||
return "false"
|
||||
}
|
||||
}
|
||||
|
||||
return d.Value
|
||||
}
|
||||
|
||||
func (d *Data) IsTwigExpression() bool {
|
||||
return strings.Contains(d.Faker, "{{") || strings.Contains(d.Faker, "}}")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue