@@ -90,52 +90,52 @@ func TestExpr_Build(t *testing.T) {
90
90
Result : "GROUP_CONCAT(`id`)" ,
91
91
},
92
92
{
93
- Expr : field .NewFieldRaw ("if(column1=?,column2,column3)" , "1" ),
93
+ Expr : field .NewUnsafeFieldRaw ("if(column1=?,column2,column3)" , "1" ),
94
94
Result : "if(column1=?,column2,column3)" ,
95
95
ExpectedVars : []interface {}{"1" },
96
96
},
97
97
{
98
- Expr : field .NewFieldRaw ("if(column1=?,column2,column3)" , "1" ).Eq (p ),
98
+ Expr : field .NewUnsafeFieldRaw ("if(column1=?,column2,column3)" , "1" ).Eq (p ),
99
99
Result : "if(column1=?,column2,column3) = ?" ,
100
100
ExpectedVars : []interface {}{"1" , p },
101
101
},
102
102
{
103
- Expr : field .NewFieldRaw ("if(column1=?,column2,column3)" , field .NewField ("" , "new_id" )).Eq (p ),
103
+ Expr : field .NewUnsafeFieldRaw ("if(column1=?,column2,column3)" , field .NewField ("" , "new_id" )).Eq (p ),
104
104
Result : "if(column1=`new_id`,column2,column3) = ?" ,
105
105
ExpectedVars : []interface {}{p },
106
106
},
107
107
{
108
- Expr : field .NewFieldRaw ("if(column1=?,column2,column3)" , "1" ).EqCol (field .NewField ("" , "new_id" )),
108
+ Expr : field .NewUnsafeFieldRaw ("if(column1=?,column2,column3)" , "1" ).EqCol (field .NewField ("" , "new_id" )),
109
109
Result : "if(column1=?,column2,column3) = `new_id`" ,
110
110
ExpectedVars : []interface {}{"1" },
111
111
},
112
112
{
113
- Expr : field .NewFieldRaw ("if(column1=?,column2,column3)" , "1" ).EqCol (field .NewField ("" , "new_id" ).WithTable ("tableB" )),
113
+ Expr : field .NewUnsafeFieldRaw ("if(column1=?,column2,column3)" , "1" ).EqCol (field .NewField ("" , "new_id" ).WithTable ("tableB" )),
114
114
Result : "if(column1=?,column2,column3) = `tableB`.`new_id`" ,
115
115
ExpectedVars : []interface {}{"1" },
116
116
},
117
117
{
118
- Expr : field .NewFieldRaw ("if(column1=?,column2,column3)" , "1" ).IsNull (),
118
+ Expr : field .NewUnsafeFieldRaw ("if(column1=?,column2,column3)" , "1" ).IsNull (),
119
119
Result : "if(column1=?,column2,column3) IS NULL" ,
120
120
ExpectedVars : []interface {}{"1" },
121
121
},
122
122
{
123
- Expr : field .NewFieldRaw ("if(column1=?,column2,column3)" , "1" ).GroupConcat (),
123
+ Expr : field .NewUnsafeFieldRaw ("if(column1=?,column2,column3)" , "1" ).GroupConcat (),
124
124
Result : "GROUP_CONCAT(if(column1=?,column2,column3))" ,
125
125
ExpectedVars : []interface {}{"1" },
126
126
},
127
127
{
128
- Expr : field .NewFieldRaw ("if(column1=?,column2,column3)" , "1" ).Desc (),
128
+ Expr : field .NewUnsafeFieldRaw ("if(column1=?,column2,column3)" , "1" ).Desc (),
129
129
Result : "if(column1=?,column2,column3) DESC" ,
130
130
ExpectedVars : []interface {}{"1" },
131
131
},
132
132
{
133
- Expr : field .NewFieldRaw ("if(column1=?,column2,column3)" , "1" ).IfNull (p ),
133
+ Expr : field .NewUnsafeFieldRaw ("if(column1=?,column2,column3)" , "1" ).IfNull (p ),
134
134
Result : "IFNULL(if(column1=?,column2,column3),?)" ,
135
135
ExpectedVars : []interface {}{"1" , p },
136
136
},
137
137
{
138
- Expr : field .NewFieldRaw ("if(column1=?,column2,column3)" , "1" ).As ("column4" ),
138
+ Expr : field .NewUnsafeFieldRaw ("if(column1=?,column2,column3)" , "1" ).As ("column4" ),
139
139
Result : "if(column1=?,column2,column3) AS `column4`" ,
140
140
ExpectedVars : []interface {}{"1" },
141
141
},
0 commit comments