MCPcopy Create free account
hub / github.com/dgraph-io/dgraph / escapeColumnNames

Function escapeColumnNames

dgraph/cmd/migrate/dump.go:44–50  ·  view source on GitHub ↗

escapeColumnNames wraps columnNames with backticks in order to avoid creating invalid sql queries in cases where a table uses a reserved keyword as a column name

(columnNames []string)

Source from the content-addressed store, hash-verified

42// invalid sql queries in cases where a table uses a reserved keyword as a
43// column name
44func escapeColumnNames(columnNames []string) []string {
45 var escapedColNames []string
46 for _, c := range columnNames {
47 escapedColNames = append(escapedColNames, fmt.Sprintf("`"+"%s"+"`", c))
48 }
49 return escapedColNames
50}
51
52// dumpSchema generates the Dgraph schema based on m.tableGuides
53// and sends the schema to m.schemaWriter

Callers 2

dumpTableMethod · 0.85
dumpTableConstraintsMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…