MCPcopy Create free account
hub / github.com/cockroachdb/cockroachdb-parser / truncateString

Function truncateString

pkg/sql/sem/tree/parse_string.go:126–134  ·  view source on GitHub ↗
(s string, t *types.T)

Source from the content-addressed store, hash-verified

124}
125
126func truncateString(s string, t *types.T) string {
127 // If the string type specifies a limit we truncate to that limit:
128 // 'hello'::CHAR(2) -> 'he'
129 // This is true of all the string type variants.
130 if t.Width() > 0 {
131 s = util.TruncateString(s, int(t.Width()))
132 }
133 return s
134}
135
136// ParseDOidAsInt parses the input and returns it as an OID. If the input
137// is not formatted as an int, an error is returned.

Callers 2

ParseAndRequireStringFunction · 0.85

Calls 2

TruncateStringFunction · 0.92
WidthMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…