From d16bfb3e3b917760df1df11482cc613b2416c052 Mon Sep 17 00:00:00 2001 From: Lz Date: Sun, 21 Apr 2024 16:24:50 +0800 Subject: [PATCH] chore(docs): updated CHANGELOG.md --- CHANGELOG.md | 5 +++++ shardid/id.go | 4 ++-- shardid/id_test.go | 6 +++--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0fe9ff2..5b69ac2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [1.4.6] - 2014-04-21 +### Changed +- implements json.Marshaler and json.Unmarshaler on `ID` (#39) + ## [1.4.5] - 2014-04-20 ### Changed - used int64 instead of int in `Queryer.Count` (#37) diff --git a/shardid/id.go b/shardid/id.go index c547b4b..0b613c8 100644 --- a/shardid/id.go +++ b/shardid/id.go @@ -101,12 +101,12 @@ func (b *ID) Scan(src interface{}) error { // skipcq: GO-W1029 } // MarshalJSON implements the json.Marshaler interface -func (id ID) MarshalJSON() ([]byte, error) { +func (id ID) MarshalJSON() ([]byte, error) { // skipcq: GO-W1029 return json.Marshal(id.Int64) } // UnmarshalJSON implements the json.Unmarshaler interface -func (id *ID) UnmarshalJSON(data []byte) error { +func (id *ID) UnmarshalJSON(data []byte) error { // skipcq: GO-W1029 var value int64 if err := json.Unmarshal(data, &value); err != nil { return err diff --git a/shardid/id_test.go b/shardid/id_test.go index 1ddbd3d..deb986b 100644 --- a/shardid/id_test.go +++ b/shardid/id_test.go @@ -42,10 +42,10 @@ func TestID(t *testing.T) { { name: "build_should_work", timeNow: time.Now(), - workerID: int8(rand.Intn(4)), - databaseID: int16(rand.Intn(1024)), + workerID: int8(rand.Intn(4)), // skipcq: GSC-G404 + databaseID: int16(rand.Intn(1024)), // skipcq: GSC-G404 tableRotate: WeeklyRotate, - sequence: int16(rand.Intn(1024)), + sequence: int16(rand.Intn(1024)), // skipcq: GSC-G404 }, { name: "id_should_orderable",