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

Function sampleSQL

pkg/formatter/render.go:1308–1328  ·  view source on GitHub ↗

sampleSQL renders a ClickHouse SAMPLE clause.

(s *ast.SampleClause, f *nodeFormatter)

Source from the content-addressed store, hash-verified

1306
1307// sampleSQL renders a ClickHouse SAMPLE clause.
1308func sampleSQL(s *ast.SampleClause, f *nodeFormatter) string {
1309 var sb strings.Builder
1310 sb.WriteString(f.kw("SAMPLE"))
1311 sb.WriteString(" ")
1312 sb.WriteString(s.Value)
1313 if s.Denominator != "" {
1314 sb.WriteString("/")
1315 sb.WriteString(s.Denominator)
1316 }
1317 if s.Offset != "" {
1318 sb.WriteString(" ")
1319 sb.WriteString(f.kw("OFFSET"))
1320 sb.WriteString(" ")
1321 sb.WriteString(s.Offset)
1322 if s.OffsetDenominator != "" {
1323 sb.WriteString("/")
1324 sb.WriteString(s.OffsetDenominator)
1325 }
1326 }
1327 return sb.String()
1328}
1329
1330// joinSQL renders a JOIN clause.
1331func joinSQL(j *ast.JoinClause, f *nodeFormatter) string {

Callers 1

renderSelectFunction · 0.85

Calls 2

kwMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected