add postgres column type check

add specific method to handle named parameters
This commit is contained in:
Simon Vieille 2024-04-01 12:30:45 +02:00
commit a7cd0634ef
Signed by untrusted user: deblan
GPG key ID: 579388D585F70417
4 changed files with 99 additions and 45 deletions

View file

@ -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, "}}")
}