Format implements the NodeFormatter interface.
(ctx *FmtCtx)
| 173 | |
| 174 | // Format implements the NodeFormatter interface. |
| 175 | func (u *UnresolvedName) Format(ctx *FmtCtx) { |
| 176 | isCrdbInternal := false |
| 177 | stopAt := 1 |
| 178 | if u.Star { |
| 179 | stopAt = 2 |
| 180 | } |
| 181 | for i := u.NumParts; i >= stopAt; i-- { |
| 182 | // The first part to print is the last item in u.Parts. It is also |
| 183 | // a potentially restricted name to disambiguate from keywords in |
| 184 | // the grammar, so print it out as a "Name". Every part after that is |
| 185 | // necessarily an unrestricted name. |
| 186 | if i == u.NumParts { |
| 187 | if u.Parts[i-1] == "crdb_internal" && i > 1 { |
| 188 | ctx.WithFlags(ctx.flags&^FmtAnonymize&^FmtMarkRedactionNode, func() { |
| 189 | ctx.FormatNode((*Name)(&u.Parts[i-1])) |
| 190 | }) |
| 191 | isCrdbInternal = true |
| 192 | } else { |
| 193 | ctx.FormatNode((*Name)(&u.Parts[i-1])) |
| 194 | } |
| 195 | } else { |
| 196 | if isCrdbInternal { |
| 197 | ctx.WithFlags(ctx.flags&^FmtAnonymize&^FmtMarkRedactionNode, func() { |
| 198 | ctx.FormatNode((*UnrestrictedName)(&u.Parts[i-1])) |
| 199 | }) |
| 200 | } else { |
| 201 | ctx.FormatNode((*UnrestrictedName)(&u.Parts[i-1])) |
| 202 | |
| 203 | } |
| 204 | } |
| 205 | if i > 1 { |
| 206 | ctx.WriteByte('.') |
| 207 | } |
| 208 | } |
| 209 | if u.Star { |
| 210 | ctx.WriteByte('*') |
| 211 | } |
| 212 | } |
| 213 | func (u *UnresolvedName) String() string { return AsString(u) } |
| 214 | |
| 215 | // NewUnresolvedName constructs an UnresolvedName from some strings. |
nothing calls this directly
no test coverage detected