MCPcopy Index your code
hub / github.com/upper/db / TestMySQLTypes

Method TestMySQLTypes

adapter/mysql/mysql_test.go:206–396  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

204}
205
206func (s *AdapterTests) TestMySQLTypes() {
207 sess := s.Session()
208
209 type MyType struct {
210 ID int64 `db:"id,omitempty"`
211
212 JSONMap JSONMap `db:"json_map"`
213
214 JSONObject JSONMap `db:"json_object"`
215 JSONArray JSONArray `db:"json_array"`
216
217 CustomJSONObject customJSON `db:"custom_json_object"`
218 AutoCustomJSONObject autoCustomJSON `db:"auto_custom_json_object"`
219
220 CustomJSONObjectPtr *customJSON `db:"custom_json_object_ptr,omitempty"`
221 AutoCustomJSONObjectPtr *autoCustomJSON `db:"auto_custom_json_object_ptr,omitempty"`
222
223 AutoCustomJSONObjectArray []autoCustomJSON `db:"auto_custom_json_object_array"`
224 AutoCustomJSONObjectMap map[string]autoCustomJSON `db:"auto_custom_json_object_map"`
225
226 Int64CompatValueJSONArray []int64Compat `db:"integer_compat_value_json_array"`
227 UIntCompatValueJSONArray uintCompatArray `db:"uinteger_compat_value_json_array"`
228 StringCompatValueJSONArray []stringCompat `db:"string_compat_value_json_array"`
229 }
230
231 origMyTypeTests := []MyType{
232 MyType{
233 Int64CompatValueJSONArray: []int64Compat{1, -2, 3, -4},
234 UIntCompatValueJSONArray: []uintCompat{1, 2, 3, 4},
235 StringCompatValueJSONArray: []stringCompat{"a", "b", "", "c"},
236 },
237 MyType{
238 Int64CompatValueJSONArray: []int64Compat(nil),
239 UIntCompatValueJSONArray: []uintCompat(nil),
240 StringCompatValueJSONArray: []stringCompat(nil),
241 },
242 MyType{
243 AutoCustomJSONObjectArray: []autoCustomJSON{
244 autoCustomJSON{
245 N: "Hello",
246 },
247 autoCustomJSON{
248 N: "World",
249 },
250 },
251 AutoCustomJSONObjectMap: map[string]autoCustomJSON{
252 "a": autoCustomJSON{
253 N: "Hello",
254 },
255 "b": autoCustomJSON{
256 N: "World",
257 },
258 },
259 JSONArray: JSONArray{float64(1), float64(2), float64(3), float64(4)},
260 },
261 MyType{
262 JSONArray: JSONArray{},
263 },

Callers

nothing calls this directly

Calls 15

JSONArrayTypeAlias · 0.85
SessionMethod · 0.65
InsertMethod · 0.65
CollectionMethod · 0.65
OneMethod · 0.65
FindMethod · 0.65
IDMethod · 0.65
ExecMethod · 0.65
ValuesMethod · 0.65
InsertIntoMethod · 0.65
SQLMethod · 0.65
WhereMethod · 0.65

Tested by

no test coverage detected