Uniqueidentifier now treated as uuid
This commit is contained in:
parent
dfbcef7fe3
commit
a4ba4b6e9d
2 changed files with 12 additions and 6 deletions
|
@ -313,8 +313,11 @@ func (m *MSSQLDriver) TranslateColumnType(c bdb.Column) bdb.Column {
|
|||
c.Type = "null.Bytes"
|
||||
case "timestamp", "rowversion":
|
||||
c.Type = "null.Bytes"
|
||||
case "uniqueidentifier", "xml":
|
||||
case "xml":
|
||||
c.Type = "null.String"
|
||||
case "uniqueidentifier":
|
||||
c.Type = "null.String"
|
||||
c.DBType = "uuid"
|
||||
default:
|
||||
c.Type = "null.String"
|
||||
}
|
||||
|
@ -342,8 +345,11 @@ func (m *MSSQLDriver) TranslateColumnType(c bdb.Column) bdb.Column {
|
|||
c.Type = "[]byte"
|
||||
case "timestamp", "rowversion":
|
||||
c.Type = "[]byte"
|
||||
case "uniqueidentifier", "xml":
|
||||
case "xml":
|
||||
c.Type = "string"
|
||||
case "uniqueidentifier":
|
||||
c.Type = "string"
|
||||
c.DBType = "uuid"
|
||||
default:
|
||||
c.Type = "string"
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ var (
|
|||
rgxValidTime = regexp.MustCompile(`[2-9]+`)
|
||||
|
||||
validatedTypes = []string{
|
||||
"inet", "line", "uuid", "uniqueidentifier", "interval", "mediumint",
|
||||
"inet", "line", "uuid", "interval", "mediumint",
|
||||
"json", "jsonb", "box", "cidr", "circle",
|
||||
"lseg", "macaddr", "path", "pg_lsn", "point",
|
||||
"polygon", "txid_snapshot", "money", "hstore",
|
||||
|
@ -195,7 +195,7 @@ func randomizeField(s *Seed, field reflect.Value, fieldType string, canBeNull bo
|
|||
field.Set(reflect.ValueOf(value))
|
||||
return nil
|
||||
}
|
||||
if fieldType == "uuid" || fieldType == "uniqueidentifier" {
|
||||
if fieldType == "uuid" {
|
||||
value = null.NewString(uuid.NewV4().String(), true)
|
||||
field.Set(reflect.ValueOf(value))
|
||||
return nil
|
||||
|
@ -268,7 +268,7 @@ func randomizeField(s *Seed, field reflect.Value, fieldType string, canBeNull bo
|
|||
field.Set(reflect.ValueOf(value))
|
||||
return nil
|
||||
}
|
||||
if fieldType == "uuid" || fieldType == "uniqueidentifier" {
|
||||
if fieldType == "uuid" {
|
||||
value = uuid.NewV4().String()
|
||||
field.Set(reflect.ValueOf(value))
|
||||
return nil
|
||||
|
@ -390,7 +390,7 @@ func getArrayRandValue(s *Seed, typ reflect.Type, fieldType string) interface{}
|
|||
value := strconv.Itoa((s.nextInt()%26)+2) + " days"
|
||||
return types.StringArray{value, value}
|
||||
}
|
||||
if fieldType == "uuid" || fieldType == "uniqueidentifier" {
|
||||
if fieldType == "uuid" {
|
||||
value := uuid.NewV4().String()
|
||||
return types.StringArray{value, value}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue