buildCompareClause build clause with specified bounds. Usually we will use the following two conditions: (compare, writeEqual) == (less, false), return quotaCols < bound clause. In other words, (-inf, bound) (compare, writeEqual) == (greater, true), return quotaCols >= bound clause. In other words,
(buf *bytes.Buffer, quotaCols []string, bound []string, compare byte, writeEqual bool)
| 1111 | // (compare, writeEqual) == (less, false), return quotaCols < bound clause. In other words, (-inf, bound) |
| 1112 | // (compare, writeEqual) == (greater, true), return quotaCols >= bound clause. In other words, [bound, +inf) |
| 1113 | func buildCompareClause(buf *bytes.Buffer, quotaCols []string, bound []string, compare byte, writeEqual bool) { // revive:disable-line:flag-parameter |
| 1114 | for i, col := range quotaCols { |
| 1115 | if i > 0 { |
| 1116 | buf.WriteString("or(") |
| 1117 | } |
| 1118 | for j := 0; j < i; j++ { |
| 1119 | buf.WriteString(quotaCols[j]) |
| 1120 | buf.WriteByte(equal) |
| 1121 | buf.WriteString(bound[j]) |
| 1122 | buf.WriteString(" and ") |
| 1123 | } |
| 1124 | buf.WriteString(col) |
| 1125 | buf.WriteByte(compare) |
| 1126 | if writeEqual && i == len(quotaCols)-1 { |
| 1127 | buf.WriteByte(equal) |
| 1128 | } |
| 1129 | buf.WriteString(bound[i]) |
| 1130 | if i > 0 { |
| 1131 | buf.WriteByte(')') |
| 1132 | } else if i != len(quotaCols)-1 { |
| 1133 | buf.WriteByte(' ') |
| 1134 | } |
| 1135 | } |
| 1136 | } |
| 1137 | |
| 1138 | // getCommonLength returns the common length of low and up |
| 1139 | func getCommonLength(low []string, up []string) int { |
no test coverage detected
searching dependent graphs…