diff --git a/sql/sql.go b/sql/sql.go index efbaab06..1fc2d637 100644 --- a/sql/sql.go +++ b/sql/sql.go @@ -34,12 +34,11 @@ const ( var ( allowedTypes = []string{ "array", "boolean", "circle", - "color", "datetime", "domain", - "double", "email", "latitude", - "longitude", "number", "object", - "password", "phone", "point", - "polygon", "record", "string", - "url", "uuid", + "datetime", "domain", "double", + "email", "latitude", "longitude", + "number", "object", "password", + "phone", "point", "polygon", + "record", "string", "uuid", } allowedAlgorithms = []string{ diff --git a/sql/sql_test.go b/sql/sql_test.go index 62152472..1b7b187b 100644 --- a/sql/sql_test.go +++ b/sql/sql_test.go @@ -2694,20 +2694,11 @@ func Test_Parse_Queries_Define(t *testing.T) { }, { sql: `DEFINE FIELD temp ON person TYPE`, - err: "Found `` but expected `array, boolean, circle, color, datetime, domain, double, email, latitude, longitude, number, object, password, phone, point, polygon, record, string, url, uuid`", + err: "Found `` but expected `array, boolean, circle, datetime, domain, double, email, latitude, longitude, number, object, password, phone, point, polygon, record, string, uuid`", }, { sql: `DEFINE FIELD temp ON person TYPE something`, - err: "Found `something` but expected `array, boolean, circle, color, datetime, domain, double, email, latitude, longitude, number, object, password, phone, point, polygon, record, string, url, uuid`", - }, - { - sql: `DEFINE FIELD temp ON person TYPE url`, - res: &Query{Statements: []Statement{&DefineFieldStatement{ - KV: "*", NS: "*", DB: "*", - Name: &Ident{"temp"}, - What: Tables{&Table{"person"}}, - Type: "url", - }}}, + err: "Found `something` but expected `array, boolean, circle, datetime, domain, double, email, latitude, longitude, number, object, password, phone, point, polygon, record, string, uuid`", }, { sql: `DEFINE FIELD temp ON person TYPE email`, diff --git a/util/conv/conv.go b/util/conv/conv.go index a737f5fa..9c22c232 100644 --- a/util/conv/conv.go +++ b/util/conv/conv.go @@ -87,12 +87,8 @@ func ConvertTo(t, k string, obj interface{}) (val interface{}, err error) { switch t { default: return obj, nil - case "url": - return ConvertToUrl(obj) case "uuid": return ConvertToUuid(obj) - case "color": - return ConvertToColor(obj) case "email": return ConvertToEmail(obj) case "phone": @@ -124,14 +120,6 @@ func ConvertTo(t, k string, obj interface{}) (val interface{}, err error) { } } -func ConvertToUrl(obj interface{}) (val string, err error) { - val = fmt.Sprintf("%v", obj) - if !govalidator.IsURL(val) { - err = fmt.Errorf("Expected a URL, but found '%v'", obj) - } - return -} - func ConvertToUuid(obj interface{}) (val string, err error) { val = fmt.Sprintf("%v", obj) if !govalidator.IsUUID(val) { @@ -156,14 +144,6 @@ func ConvertToPhone(obj interface{}) (val string, err error) { return } -func ConvertToColor(obj interface{}) (val string, err error) { - val = fmt.Sprintf("%v", obj) - if !govalidator.IsHexcolor(val) && !govalidator.IsRGBcolor(val) { - err = fmt.Errorf("Expected a HEX or RGB color, but found '%v'", obj) - } - return -} - func ConvertToArray(obj interface{}) (val []interface{}, err error) { if now, ok := obj.([]interface{}); ok { val = now