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

Function TruncateColumnName

go/sql/builder.go:38–49  ·  view source on GitHub ↗

TruncateColumnName truncates a name so it can be used as a MySQL column name, taking into account UTF-8 characters.

(name string, limit int)

Source from the content-addressed store, hash-verified

36// TruncateColumnName truncates a name so it can be used as a MySQL
37// column name, taking into account UTF-8 characters.
38func TruncateColumnName(name string, limit int) string {
39 truncatedName := name
40 chars := 0
41 for byteIdx := range name {
42 if chars >= limit {
43 truncatedName = name[:byteIdx]
44 break
45 }
46 chars++
47 }
48 return truncatedName
49}
50
51func buildColumnsPreparedValues(columns *ColumnList) []string {
52 values := make([]string, columns.Len())

Callers 2

CreateCheckpointTableMethod · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…