MCPcopy Create free account
hub / github.com/bytebase/bytebase / writeIndexComment

Function writeIndexComment

backend/plugin/schema/pg/get_database_definition.go:2059–2086  ·  view source on GitHub ↗
(out io.Writer, schema string, index *storepb.IndexMetadata)

Source from the content-addressed store, hash-verified

2057}
2058
2059func writeIndexComment(out io.Writer, schema string, index *storepb.IndexMetadata) error {
2060 if _, err := io.WriteString(out, `COMMENT ON INDEX "`); err != nil {
2061 return err
2062 }
2063
2064 if _, err := io.WriteString(out, schema); err != nil {
2065 return err
2066 }
2067
2068 if _, err := io.WriteString(out, `"."`); err != nil {
2069 return err
2070 }
2071
2072 if _, err := io.WriteString(out, index.Name); err != nil {
2073 return err
2074 }
2075
2076 if _, err := io.WriteString(out, `" IS '`); err != nil {
2077 return err
2078 }
2079
2080 if _, err := io.WriteString(out, escapeSingleQuote(index.Comment)); err != nil {
2081 return err
2082 }
2083
2084 _, err := io.WriteString(out, "';\n\n")
2085 return err
2086}
2087
2088func writePartitionUniqueKey(out io.Writer, schema string, partition *storepb.TablePartitionMetadata) error {
2089 for _, index := range partition.Indexes {

Callers 2

writeCreateRegularIndexFunction · 0.70
writeIndexInternalFunction · 0.70

Calls 1

escapeSingleQuoteFunction · 0.85

Tested by

no test coverage detected