From 0e6346e57d342844e11c241b82829371edb91857 Mon Sep 17 00:00:00 2001 From: siddontang Date: Mon, 7 Sep 2015 16:18:39 +0800 Subject: [PATCH] mysqldef: remove fsp codec, set out manually. --- mysqldef/time.go | 17 ----------------- mysqldef/time_test.go | 1 + 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/mysqldef/time.go b/mysqldef/time.go index 4eb4e341d81b8..21364f87182d5 100644 --- a/mysqldef/time.go +++ b/mysqldef/time.go @@ -161,9 +161,6 @@ func (t Time) Marshal() ([]byte, error) { return nil, errors.Trace(err) } - // append fsp to the end - b = append(b, byte(t.Fsp)) - return b, nil } @@ -175,20 +172,6 @@ func (t *Time) Unmarshal(b []byte) error { // UnmarshalInLocation decodes the binary data // into Time with a specific time Location. func (t *Time) UnmarshalInLocation(b []byte, loc *time.Location) error { - if len(b) < 1 { - return errors.Errorf("insufficient bytes to unmarshal time") - } - - // Get fsp - fsp, err := checkFsp(int(int8(b[len(b)-1]))) - if err != nil { - return errors.Trace(err) - } - - t.Fsp = fsp - - b = b[:len(b)-1] - if err := t.Time.UnmarshalBinary(b); err != nil { return errors.Trace(err) } diff --git a/mysqldef/time_test.go b/mysqldef/time_test.go index c4e158648377e..57d1a10df7060 100644 --- a/mysqldef/time_test.go +++ b/mysqldef/time_test.go @@ -354,6 +354,7 @@ func (s *testTimeSuite) TestCodec(c *C) { var dest Time dest.Type = TypeDatetime + dest.Fsp = MaxFsp err = dest.Unmarshal(b) c.Assert(err, IsNil) c.Assert(dest.String(), Equals, test)