MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / trimBytes

Function trimBytes

pkg/sql/parser/validate.go:69–78  ·  view source on GitHub ↗

trimBytes returns input with leading/trailing whitespace removed.

(b []byte)

Source from the content-addressed store, hash-verified

67
68// trimBytes returns input with leading/trailing whitespace removed.
69func trimBytes(b []byte) []byte {
70 start, end := 0, len(b)
71 for start < end && (b[start] == ' ' || b[start] == '\t' || b[start] == '\n' || b[start] == '\r') {
72 start++
73 }
74 for end > start && (b[end-1] == ' ' || b[end-1] == '\t' || b[end-1] == '\n' || b[end-1] == '\r') {
75 end--
76 }
77 return b[start:end]
78}
79
80// validDialectList returns a human-readable comma-separated list of all valid
81// dialect names for use in error messages.

Callers 2

ValidateBytesFunction · 0.85
ValidateBytesWithDialectFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected