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

Method WithFlags

pkg/sql/sem/tree/format.go:246–255  ·  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

244// WithFlags changes the flags in the FmtCtx, runs the given function, then
245// restores the old flags.
246func (ctx *FmtCtx) WithFlags(flags FmtFlags, fn func()) {
247 if ctx.ann == nil && flags&flagsRequiringAnnotations != 0 {
248 panic(errors.AssertionFailedf("no Annotations provided"))
249 }
250 oldFlags := ctx.flags
251 ctx.flags = flags
252 defer func() { ctx.flags = oldFlags }()
253
254 fn()
255}
256
257// HasFlags returns true iff the given flags are set in the formatter context.
258func (ctx *FmtCtx) HasFlags(f FmtFlags) bool {

Callers 6

FormatMethod · 0.80
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