(format string)
| 188 | } |
| 189 | |
| 190 | func 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 | } |
no test coverage detected