add charset support for fields

Summary: Basically, adding support for Hebrew characters.

Reviewed By: alexsn

Differential Revision: D16068537

fbshipit-source-id: 4e934da5ea97c9e804317f746556ab1d51faebcc
This commit is contained in:
Ariel Mashraki
2019-07-01 08:06:04 -07:00
committed by Facebook Github Bot
parent 37ae2b744e
commit e8e96f014f
24 changed files with 417 additions and 182 deletions

View File

@@ -50,7 +50,7 @@ func TestSQLite(t *testing.T) {
func TestMySQL(t *testing.T) {
var drv dialect.Driver
drv, err := sql.Open("mysql", "root:pass@tcp(localhost:3306)/test?charset=utf8&parseTime=True")
drv, err := sql.Open("mysql", "root:pass@tcp(localhost:3306)/test?parseTime=True")
require.NoError(t, err)
defer drv.Close()
if testing.Verbose() {
@@ -97,6 +97,7 @@ var tests = []func(*testing.T, *ent.Client){
Tx,
Sanity,
Paging,
Charset,
Relation,
UniqueConstraint,
O2OTwoTypes,
@@ -219,6 +220,19 @@ func Paging(t *testing.T, client *ent.Client) {
}
}
func Charset(t *testing.T, client *ent.Client) {
require := require.New(t)
ctx := context.Background()
f1 := client.File.Create().SetName("אריאל").SetSize(10).SaveX(ctx)
f2 := client.File.Create().SetName("נטי").SetSize(10).SaveX(ctx)
f3 := client.File.Create().SetName("Ariel").SetSize(10).SaveX(ctx)
f4 := client.File.Create().SetName("Nati").SetSize(10).SaveX(ctx)
require.Equal("אריאל", f1.Name)
require.Equal("נטי", f2.Name)
require.Equal("Ariel", f3.Name)
require.Equal("Nati", f4.Name)
}
func Relation(t *testing.T, client *ent.Client) {
require := require.New(t)
ctx := context.Background()