MCPcopy Create free account
hub / github.com/pingcap/tidb / GetTimeWithFsp

Method GetTimeWithFsp

pkg/types/json_binary.go:249–260  ·  view source on GitHub ↗

GetTimeWithFsp gets the time value with given fsp

(fsp int)

Source from the content-addressed store, hash-verified

247
248// GetTimeWithFsp gets the time value with given fsp
249func (bj BinaryJSON) GetTimeWithFsp(fsp int) Time {
250 coreTime := CoreTime(bj.GetUint64())
251
252 tp := mysql.TypeDate
253 if bj.TypeCode == JSONTypeCodeDatetime {
254 tp = mysql.TypeDatetime
255 } else if bj.TypeCode == JSONTypeCodeTimestamp {
256 tp = mysql.TypeTimestamp
257 }
258
259 return NewTime(coreTime, tp, fsp)
260}
261
262// GetDuration gets the duration value
263func (bj BinaryJSON) GetDuration() Duration {

Callers 6

GetTimeMethod · 0.95
vecEvalTimeMethod · 0.80
vecEvalDurationMethod · 0.80
convertJSON2TpFunction · 0.80
evalTimeMethod · 0.80
evalDurationMethod · 0.80

Calls 3

GetUint64Method · 0.95
CoreTimeTypeAlias · 0.85
NewTimeFunction · 0.85

Tested by

no test coverage detected