MCPcopy Create free account
hub / github.com/AbelChe/evil_minio / FormatSQLTimestamp

Function FormatSQLTimestamp

internal/s3select/sql/timestampfuncs.go:54–77  ·  view source on GitHub ↗

FormatSQLTimestamp - returns the a string representation of the timestamp as used in S3 Select

(t time.Time)

Source from the content-addressed store, hash-verified

52// FormatSQLTimestamp - returns the a string representation of the
53// timestamp as used in S3 Select
54func FormatSQLTimestamp(t time.Time) string {
55 _, zoneOffset := t.Zone()
56 hasZone := zoneOffset != 0
57 hasFracSecond := t.Nanosecond() != 0
58 hasSecond := t.Second() != 0
59 hasTime := t.Hour() != 0 || t.Minute() != 0
60 hasDay := t.Day() != 1
61 hasMonth := t.Month() != 1
62
63 switch {
64 case hasFracSecond:
65 return t.Format(layoutNanosecond)
66 case hasSecond:
67 return t.Format(layoutSecond)
68 case hasTime || hasZone:
69 return t.Format(layoutMinute)
70 case hasDay:
71 return t.Format(layoutDay)
72 case hasMonth:
73 return t.Format(layoutMonth)
74 default:
75 return t.Format(layoutYear)
76 }
77}
78
79const (
80 timePartYear = "YEAR"

Callers 4

convertFromAnnotationFunction · 0.92
SetMethod · 0.92
CSVStringMethod · 0.85

Calls 1

FormatMethod · 0.80

Tested by 1