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

Function getLayoutStringFormat

server/functions/timestamp.go:194–223  ·  view source on GitHub ↗
(ctx *sql.Context, dateOnly bool)

Source from the content-addressed store, hash-verified

192)
193
194func getLayoutStringFormat(ctx *sql.Context, dateOnly bool) string {
195 layout := getDateStyleOutputFormat(ctx)
196 switch layout {
197 case DateStyleISO:
198 if dateOnly {
199 return dateStyleFormatDateOnly_ISO
200 }
201 return dateStyleFormat_ISO
202 case DateStyleSQL:
203 if dateOnly {
204 return dateStyleFormatDateOnly_SQL
205 }
206 return dateStyleFormat_SQL
207 case DateStylePostgres:
208 if dateOnly {
209 return dateStyleFormatDateOnly_Postgres
210 }
211 return dateStyleFormat_Postgres
212 case DateStyleGerman:
213 if dateOnly {
214 return dateStyleFormatDateOnly_German
215 }
216 return dateStyleFormat_German
217 }
218 // shouldn't happen but return default
219 if dateOnly {
220 return dateStyleFormatDateOnly_ISO
221 }
222 return dateStyleFormat_ISO
223}
224
225// FormatDateTimeWithBC formats a time.Time that may represent BC dates (negative years)
226// PostgreSQL represents BC years as negative years in time.Time, but Go's Format() doesn't handle this correctly

Callers 3

date.goFile · 0.85
timestamp.goFile · 0.85
timestamptz.goFile · 0.85

Calls 1

getDateStyleOutputFormatFunction · 0.85

Tested by

no test coverage detected