Commit Graph
8 Commits
Author SHA1 Message Date
Yoshiyuki MineoandGitHub 0cdef9e4fe Update TimeUnit in ToTime test to use 100 milliseconds for improved accuracy in timestamp validation. (#77) 2025-06-23 23:07:41 +09:00
Yoshiyuki MineoandGitHub 114716564a Fix time duration comparison in ToTime test to ensure correct validation of generated timestamps. (#76) 2025-06-23 21:45:29 +09:00
2343cac676 Check compose args (#74)
* v2: take only 'bitsMachine' least significant bits from generated machine IDs so it doesn't corrupt the other ID parts (#72)

Co-authored-by: ok32 <e.starikoff@gmail.com>
Co-authored-by: Yoshiyuki Mineo <Yoshiyuki.Mineo@jp.sony.com>

* Refactor Sonyflake Compose method to return errors for invalid parameters and update related tests. Consolidate error handling for start time, sequence, and machine ID validations. Remove unused variable in tests for clarity.

---------

Co-authored-by: ok32 <artuh.gubanova@gmail.com>
Co-authored-by: ok32 <e.starikoff@gmail.com>
2025-05-18 15:56:36 +09:00
Yoshiyuki MineoandGitHub 5347433c8c Enhance Sonyflake error handling by adding tests for invalid machine IDs, including cases for too large and negative values. (#73) 2025-05-18 15:16:04 +09:00
Yoshiyuki MineoandGitHub 774342570a Add Compose method (#71) 2025-05-07 13:17:30 +09:00
Yoshiyuki MineoandGitHub 59c47aeab1 Fix lint errors (#70) 2025-05-05 19:51:28 +09:00
Yoshiyuki MineoandGitHub 7ee8f154df feat(v2): make bit assignment for time/sequence/machine customizable … (#68)
* feat(v2): make bit assignment for time/sequence/machine customizable via Settings; update all logic and tests

* gofmt
2025-05-05 14:16:21 +09:00
Yoshiyuki MineoandGitHub 357b2ee5f0 Upgrade Sonyflake to v2 (#66)
* Add v2

* Introduce staticcheck

* Introduce golangci-lint

* Add error checks

* Add error checks

* Lint v2 code

* Improve CI trigger

* Use io.ReadAll

* Use int64

* Remove NewSonyflake

* Fix errors

* v2: Change MachineID, sequence, and AmazonEC2MachineID to int; update all usage and tests for type consistency

* docs: update Settings struct in README to use int for MachineID and CheckMachineID (v2)

* docs(v2): clarify Settings, StartTime, MachineID, and CheckMachineID comments and update README links and explanations

* docs(v2/mock): improve comments and docstrings for mock implementations

* docs(types): unify and clarify package and type docstrings for types.go in v1 and v2

* test(v2): refactor and modernize tests, improve error assertions, and update mocks for v2

* test(v2): normalize whitespace in pseudoSleep calls for consistency

* feat(v2): add configurable TimeUnit and refactor time handling for So… (#67)

* feat(v2): add configurable TimeUnit and refactor time handling for Sonyflake v2

* test(v2): add ToTime tests, clarify TimeUnit behavior, and update docs for v2

* gofmt
2025-05-05 10:53:08 +09:00