MCPcopy Create free account
hub / github.com/auxten/postgresql-parser / JoinNestedOuter

Function JoinNestedOuter

pkg/util/pretty/util.go:168–191  ·  view source on GitHub ↗

JoinNestedOuter attempts to de-indent the items after the first so that the operator appears in the right margin. This replacement is only done if there are enough "simple spaces" (as per previous uses of Align) to de-indent. No attempt is made to de-indent hard tabs, otherwise alignment may break o

(lbl string, docFn func(string) Doc, d ...Doc)

Source from the content-addressed store, hash-verified

166// physical tab width. docFn should be set to Text or Keyword and will be
167// used when converting lbl to a Doc.
168func JoinNestedOuter(lbl string, docFn func(string) Doc, d ...Doc) Doc {
169 sep := docFn(lbl)
170 return &snesting{
171 f: func(k int16) Doc {
172 if k < int16(len(lbl)+1) {
173 // If there is not enough space, don't even try. Just use a
174 // regular nested section.
175 return JoinNestedRight(sep, d...)
176 }
177 // If there is enough space, on the other hand, we can de-indent
178 // every line after the first.
179 return Concat(d[0],
180 NestS(int16(-len(lbl)-1),
181 FoldMap(
182 Concat,
183 func(x Doc) Doc {
184 return Concat(
185 Line,
186 ConcatSpace(sep, Align(Group(x))))
187 },
188 d[1:]...)))
189 },
190 }
191}
192
193// TableRow is the data for one row of a RLTable (see below).
194type TableRow struct {

Callers 1

joinNestedOuterMethod · 0.92

Calls 7

JoinNestedRightFunction · 0.85
NestSFunction · 0.85
FoldMapFunction · 0.85
ConcatSpaceFunction · 0.85
AlignFunction · 0.85
GroupFunction · 0.85
ConcatFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…