MCPcopy Create free account
hub / github.com/apecloud/myduckserver / getPrimaryKeyStruct

Function getPrimaryKeyStruct

delta/controller.go:628–641  ·  view source on GitHub ↗

Helper function to get the primary key. For composite primary keys, `row()` is used.

(schema sql.Schema)

Source from the content-addressed store, hash-verified

626
627// Helper function to get the primary key. For composite primary keys, `row()` is used.
628func getPrimaryKeyStruct(schema sql.Schema) string {
629 pks := make([]string, 0, 1)
630 for _, col := range schema {
631 if col.PrimaryKey {
632 pks = append(pks, catalog.QuoteIdentifierANSI(col.Name))
633 }
634 }
635 if len(pks) == 0 {
636 return ""
637 } else if len(pks) == 1 {
638 return pks[0]
639 }
640 return "row(" + strings.Join(pks, ", ") + ")"
641}
642
643// Helper function to get the primary key list.
644func getPrimaryKeyList(schema sql.Schema) string {

Callers 3

handleDeleteOnlyMethod · 0.85
handleGeneralCaseMethod · 0.85
handleWithoutIndexMethod · 0.85

Calls 1

QuoteIdentifierANSIFunction · 0.92

Tested by

no test coverage detected