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

Function truncateSQL

pkg/gosqlx/testing/testing.go:286–293  ·  view source on GitHub ↗

Helper functions truncateSQL truncates long SQL strings for readable error messages

(sql string)

Source from the content-addressed store, hash-verified

284
285// truncateSQL truncates long SQL strings for readable error messages
286func truncateSQL(sql string) string {
287 const maxLen = 100
288 sql = strings.TrimSpace(sql)
289 if len(sql) <= maxLen {
290 return sql
291 }
292 return sql[:maxLen] + "..."
293}
294
295// extractTables extracts all table names from an AST
296func extractTables(astNode *ast.AST) []string {

Callers 11

TestTruncateSQLFunction · 0.85
AssertValidSQLFunction · 0.85
AssertInvalidSQLFunction · 0.85
RequireValidSQLFunction · 0.85
RequireInvalidSQLFunction · 0.85
AssertFormattedSQLFunction · 0.85
AssertTablesFunction · 0.85
AssertColumnsFunction · 0.85
AssertParsesToFunction · 0.85
AssertErrorContainsFunction · 0.85
RequireParseFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestTruncateSQLFunction · 0.68