MCPcopy Index your code
hub / github.com/github/gh-ost / TestCheckpointQueryBuilder

Function TestCheckpointQueryBuilder

go/sql/builder_test.go:1105–1128  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1103}
1104
1105func TestCheckpointQueryBuilder(t *testing.T) {
1106 databaseName := "mydb"
1107 tableName := "_tbl_ghk"
1108 valueArgs := []interface{}{"mona", "mascot", int8(-17), "anothername", "anotherposition", int8(-2)}
1109 uniqueKeyColumns := NewColumnList([]string{"name", "position", "my_very_long_column_that_is_64_utf8_characters_long_很长很长很长很长很长很长"})
1110 builder, err := NewCheckpointQueryBuilder(databaseName, tableName, uniqueKeyColumns)
1111 require.NoError(t, err)
1112 query, uniqueKeyArgs, err := builder.BuildQuery(valueArgs)
1113 require.NoError(t, err)
1114 expected := `
1115 insert /* gh-ost */ into mydb._tbl_ghk
1116 (gh_ost_chk_timestamp, gh_ost_chk_coords, gh_ost_chk_iteration,
1117 gh_ost_rows_copied, gh_ost_dml_applied, gh_ost_is_cutover,
1118 name_min, position_min, my_very_long_column_that_is_64_utf8_characters_long_很长很长很长很长_min,
1119 name_max, position_max, my_very_long_column_that_is_64_utf8_characters_long_很长很长很长很长_max)
1120 values
1121 (unix_timestamp(now()), ?, ?,
1122 ?, ?, ?,
1123 ?, ?, ?,
1124 ?, ?, ?)
1125 `
1126 require.Equal(t, normalizeQuery(expected), normalizeQuery(query))
1127 require.Equal(t, []interface{}{"mona", "mascot", int8(-17), "anothername", "anotherposition", int8(-2)}, uniqueKeyArgs)
1128}

Callers

nothing calls this directly

Calls 4

NewColumnListFunction · 0.85
normalizeQueryFunction · 0.85
BuildQueryMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…