MCPcopy Create free account
hub / github.com/AdRoll/baker / genFormatFun

Function genFormatFun

filter/format_time.go:190–210  ·  view source on GitHub ↗
(format string)

Source from the content-addressed store, hash-verified

188}
189
190func genFormatFun(format string) func(t time.Time) []byte {
191 switch format {
192 case unix:
193 return func(t time.Time) []byte {
194 return []byte(strconv.FormatInt(t.Unix(), 10))
195 }
196 case unixms:
197 return func(t time.Time) []byte {
198 return []byte(strconv.FormatInt(t.UnixNano()/int64(time.Millisecond), 10))
199 }
200 case unixns:
201 return func(t time.Time) []byte {
202 return []byte(strconv.FormatInt(t.UnixNano(), 10))
203 }
204 default:
205 layout := formatToLayout(format)
206 return func(t time.Time) []byte {
207 return []byte(t.Format(layout))
208 }
209 }
210}

Callers 1

NewFormatTimeFunction · 0.85

Calls 1

formatToLayoutFunction · 0.85

Tested by

no test coverage detected