MCPcopy Index your code
hub / github.com/apache/dubbo-go-hessian2 / DecObject

Method DecObject

java_sql_time.go:111–136  ·  view source on GitHub ↗

nolint

(d *Decoder, typ reflect.Type, cls *ClassInfo)

Source from the content-addressed store, hash-verified

109
110// nolint
111func (JavaSqlTimeSerializer) DecObject(d *Decoder, typ reflect.Type, cls *ClassInfo) (interface{}, error) {
112 if typ.Kind() != reflect.Struct {
113 return nil, perrors.Errorf("wrong type expect Struct but get:%s", typ.String())
114 }
115
116 vRef := reflect.New(typ)
117 // add pointer ref so that ref the same object
118 d.appendRefs(vRef.Interface())
119
120 tag, err := d.ReadByte()
121 if perrors.Is(err, io.EOF) {
122 return nil, err
123 }
124 date, err := d.decDate(int32(tag))
125 if err != nil {
126 return nil, perrors.WithStack(err)
127 }
128 sqlTime := vRef.Interface()
129
130 result, ok := sqlTime.(java_sql_time.JavaSqlTime)
131 if !ok {
132 panic("result type is not sql time, please check the whether the conversion is ok")
133 }
134 result.SetTime(date)
135 return result, nil
136}

Callers

nothing calls this directly

Calls 5

appendRefsMethod · 0.80
ReadByteMethod · 0.80
decDateMethod · 0.80
StringMethod · 0.65
SetTimeMethod · 0.65

Tested by

no test coverage detected