MCPcopy
hub / github.com/github/gh-ost / newTwoColumnRangeMeta

Function newTwoColumnRangeMeta

go/sql/builder.go:558–583  ·  view source on GitHub ↗
(uniqueKeyColumns *ColumnList)

Source from the content-addressed store, hash-verified

556}
557
558func newTwoColumnRangeMeta(uniqueKeyColumns *ColumnList) twoColumnRangeMeta {
559 colVals := buildColumnsPreparedValues(uniqueKeyColumns)
560 cols := uniqueKeyColumns.Columns()
561 col1Name := EscapeName(cols[0].Name)
562 col2Name := EscapeName(cols[1].Name)
563 col1Asc := fmt.Sprintf("%s asc", col1Name)
564 col2Asc := fmt.Sprintf("%s asc", col2Name)
565 col1Desc := fmt.Sprintf("%s desc", col1Name)
566 col2Desc := fmt.Sprintf("%s desc", col2Name)
567 if cols[0].Type == EnumColumnType {
568 col1Asc = fmt.Sprintf("concat(%s) asc", col1Name)
569 col1Desc = fmt.Sprintf("concat(%s) desc", col1Name)
570 }
571 if cols[1].Type == EnumColumnType {
572 col2Asc = fmt.Sprintf("concat(%s) asc", col2Name)
573 col2Desc = fmt.Sprintf("concat(%s) desc", col2Name)
574 }
575 return twoColumnRangeMeta{
576 col1Name: col1Name,
577 col2Name: col2Name,
578 col1Val: colVals[0],
579 col2Val: colVals[1],
580 orderByAsc: col1Asc + ", " + col2Asc,
581 orderByDesc: col1Desc + ", " + col2Desc,
582 }
583}
584
585func buildTwoColumnUnionParts(
586 selectClause, fromClause string,

Calls 3

EscapeNameFunction · 0.85
ColumnsMethod · 0.80

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…