MCPcopy
hub / github.com/dosco/graphjin / TestWriteSchemaWithClusteringKeys

Function TestWriteSchemaWithClusteringKeys

core/schema_test.go:325–355  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

323}
324
325func TestWriteSchemaWithClusteringKeys(t *testing.T) {
326 var buf bytes.Buffer
327
328 di := &sdata.DBInfo{
329 Type: "snowflake",
330 Version: 1,
331 Schema: "main",
332 Tables: []sdata.DBTable{
333 {
334 Name: "events",
335 Schema: "main",
336 Columns: []sdata.DBColumn{
337 {Name: "id", Type: "bigint", PrimaryKey: true, NotNull: true, Schema: "main", Table: "events"},
338 {Name: "created_at", Type: "timestamp", NotNull: true, Schema: "main", Table: "events"},
339 {Name: "region", Type: "varchar", NotNull: true, Schema: "main", Table: "events"},
340 },
341 ClusteringKeys: []string{"created_at", "region"},
342 },
343 },
344 }
345
346 if err := writeSchema(di, &buf); err != nil {
347 t.Fatal(err)
348 }
349
350 output := buf.String()
351
352 if !strings.Contains(output, `@cluster(columns: ["created_at", "region"])`) {
353 t.Errorf("expected @cluster directive in output, got:\n%s", output)
354 }
355}
356
357func TestSchemaRoundTrip_ClusteringKeys(t *testing.T) {
358 schema := []byte(`# dbinfo:snowflake,1,main

Callers

nothing calls this directly

Calls 2

writeSchemaFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected