MCPcopy
hub / github.com/gin-gonic/gin / Encode

Method Encode

binding/json_test.go:194–201  ·  view source on GitHub ↗
(ptr unsafe.Pointer, stream *jsoniter.Stream)

Source from the content-addressed store, hash-verified

192}
193
194func (tpc timePointerCodec) Encode(ptr unsafe.Pointer, stream *jsoniter.Stream) {
195 t := *((**time.Time)(ptr))
196 if t == nil || (*t).Equal(zeroTime) {
197 stream.WriteNil()
198 return
199 }
200 stream.WriteString(t.In(time.Local).Format("2006-01-02 15:04:05.000"))
201}
202
203func (tpc timePointerCodec) Decode(ptr unsafe.Pointer, iter *jsoniter.Iterator) {
204 ts := iter.ReadString()

Callers

nothing calls this directly

Calls 1

WriteStringMethod · 0.65

Tested by

no test coverage detected