(t *testing.T)
| 166 | } |
| 167 | |
| 168 | func TestFormatSQLDatum(t *testing.T) { |
| 169 | // invalid pk types contains the types that should not exist in primary keys of a TTL table. |
| 170 | // We do not need to check sqlbuilder.FormatSQLDatum for these types |
| 171 | invalidPKTypes := []struct { |
| 172 | types []string |
| 173 | err *terror.Error |
| 174 | }{ |
| 175 | { |
| 176 | types: []string{"json"}, |
| 177 | err: dbterror.ErrJSONUsedAsKey, |
| 178 | }, |
| 179 | { |
| 180 | types: []string{"blob"}, |
| 181 | err: dbterror.ErrBlobKeyWithoutLength, |
| 182 | }, |
| 183 | { |
| 184 | types: []string{"blob(8)"}, |
| 185 | err: dbterror.ErrBlobKeyWithoutLength, |
| 186 | }, |
| 187 | { |
| 188 | types: []string{"text"}, |
| 189 | err: dbterror.ErrBlobKeyWithoutLength, |
| 190 | }, |
| 191 | { |
| 192 | types: []string{"text(8)"}, |
| 193 | err: dbterror.ErrBlobKeyWithoutLength, |
| 194 | }, |
| 195 | { |
| 196 | types: []string{"int", "json"}, |
| 197 | err: dbterror.ErrJSONUsedAsKey, |
| 198 | }, |
| 199 | { |
| 200 | types: []string{"int", "blob"}, |
| 201 | err: dbterror.ErrBlobKeyWithoutLength, |
| 202 | }, |
| 203 | { |
| 204 | types: []string{"int", "text"}, |
| 205 | err: dbterror.ErrBlobKeyWithoutLength, |
| 206 | }, |
| 207 | { |
| 208 | types: []string{"float"}, |
| 209 | err: dbterror.ErrUnsupportedPrimaryKeyTypeWithTTL, |
| 210 | }, |
| 211 | { |
| 212 | types: []string{"double"}, |
| 213 | err: dbterror.ErrUnsupportedPrimaryKeyTypeWithTTL, |
| 214 | }, |
| 215 | { |
| 216 | types: []string{"int", "float"}, |
| 217 | err: dbterror.ErrUnsupportedPrimaryKeyTypeWithTTL, |
| 218 | }, |
| 219 | { |
| 220 | types: []string{"int", "double"}, |
| 221 | err: dbterror.ErrUnsupportedPrimaryKeyTypeWithTTL, |
| 222 | }, |
| 223 | } |
| 224 | |
| 225 | cases := []struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…