MCPcopy Create free account
hub / github.com/dolthub/doltgresql / WithFlags

Method WithFlags

postgres/parser/sem/tree/format.go:309–318  ·  view source on GitHub ↗

WithFlags changes the flags in the FmtCtx, runs the given function, then restores the old flags.

(flags FmtFlags, fn func())

Source from the content-addressed store, hash-verified

307// WithFlags changes the flags in the FmtCtx, runs the given function, then
308// restores the old flags.
309func (ctx *FmtCtx) WithFlags(flags FmtFlags, fn func()) {
310 if ctx.ann == nil && flags&flagsRequiringAnnotations != 0 {
311 panic(errors.AssertionFailedf("no Annotations provided"))
312 }
313 oldFlags := ctx.flags
314 ctx.flags = flags
315 defer func() { ctx.flags = oldFlags }()
316
317 fn()
318}
319
320// HasFlags returns true iff the given flags are set in the formatter context.
321func (ctx *FmtCtx) HasFlags(f FmtFlags) bool {

Callers 5

FormatMethod · 0.80
FormatMethod · 0.80
FormatMethod · 0.80
FormatMethod · 0.80
FormatMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected