MCPcopy Create free account
hub / github.com/cockroachdb/cockroachdb-parser / formatTime

Function formatTime

pkg/sql/sem/tree/datum.go:4179–4185  ·  view source on GitHub ↗

formatTime formats time with specified layout. TODO(yuzefovich): consider using this function in more places.

(t time.Time, layout string)

Source from the content-addressed store, hash-verified

4177// formatTime formats time with specified layout.
4178// TODO(yuzefovich): consider using this function in more places.
4179func formatTime(t time.Time, layout string) string {
4180 // We only need FmtCtx to access its buffer so
4181 // that we get 0 amortized allocations.
4182 ctx := NewFmtCtx(FmtSimple)
4183 ctx.Write(t.AppendFormat(ctx.scratch[:0], layout))
4184 return ctx.CloseAndGetString()
4185}
4186
4187// ResolvedType implements the TypedExpr interface.
4188func (*DJSON) ResolvedType() *types.T {

Callers 1

AsJSONFunction · 0.85

Calls 4

CloseAndGetStringMethod · 0.95
NewFmtCtxFunction · 0.85
WriteMethod · 0.80
AppendFormatMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…