finlab
e2f9873db4
add example3: postgres implemented
2021-01-29 03:52:16 +08:00
finlab
31e5b003cd
add example2
2020-12-28 05:11:31 +08:00
finlab
d51ab3304e
add example
2020-12-27 16:38:16 +08:00
finlab
bb688a618b
add go.mod
2020-12-27 16:21:38 +08:00
Bruce Marriner
c09e69ae59
Added test for NewNode
2019-04-12 17:30:32 -05:00
Bruce Marriner
cdbb8ee279
minor changes
2019-04-12 17:10:24 -05:00
Bruce Marriner
80c99c0e83
Added Parsers and Tests fixes #6
2019-04-12 17:07:23 -05:00
Bruce Marriner
0684ace7ee
Minor comments updates
2019-04-11 20:34:59 -05:00
Skippy
7dcf86e66a
Merge pull request #19 from nishaad78/monotonic_clock
...
Optimize monotonic clock code
2019-04-11 15:57:57 -05:00
Nishaad Ajani
4c4a27940a
Optimize code
2019-04-11 13:03:43 +08:00
Skippy
652d4f1b7f
Merge pull request #18 from nishaad78/monotonic_clock
...
Use Monotonic clock
2019-04-10 22:58:04 -05:00
Nishaad Ajani
1c6d654675
Update to avoid breaking the existing API
2019-04-11 11:17:23 +08:00
Nishaad Ajani
a3f3d0ff71
Merge branch 'master' into monotonic_clock
2019-04-10 17:14:22 +08:00
Nishaad Ajani
55825bae4b
Bug fix and optimization
...
* Fix for default Epoch to use monotonic clock.
* Using common case optimization in the time pkg.
2019-04-10 17:02:30 +08:00
Bruce Marriner
74a8a18aca
Install golint:)
2019-04-10 01:41:37 +00:00
Bruce Marriner
20ab5dc6a4
Deprecate several global variables
...
This allows better data race protection and makes it more possible to
have multi nodes running on the same program with different options. A
temp global mutex was added to protect data races caused by NewNode
until the deprecated variables are removed. fixed #15
2019-04-10 01:37:32 +00:00
Bruce Marriner
267d02f8b9
Add BenchmarkGenerateMaxSequence func
...
This allows a benchmark showing how fast ids can be generated with 21
bits assigned to the sequence number
2019-04-10 01:32:30 +00:00
Bruce Marriner
0de6e0c074
Don't let tests skew benchmark
2019-04-10 01:21:34 +00:00
Bruce Marriner
272c8fb215
👌 Linting
2019-04-10 01:12:21 +00:00
Bruce Marriner
c3f5528809
Check more, Check against Go 11.x/12.x
2019-04-10 01:06:02 +00:00
Bruce Marriner
1d51515945
An attempt at catching race issues
2019-04-10 01:02:19 +00:00
Nishaad Ajani
2983bd9d27
Saving time as a duration in Node
2019-04-03 14:57:50 +08:00
Nishaad Ajani
0685b6ac31
Rounding time to nearest millisecond
2019-04-03 14:23:35 +08:00
Nishaad Ajani
af41c88b24
code cleanup
2019-03-15 13:10:57 +08:00
Nishaad Ajani
564a60a44c
Use monotonic clock if available from the package runtime
2019-03-15 12:46:51 +08:00
Bruce
68117e6bbe
Merge pull request #13 from NineRec/patch-1
...
Update error log for wrong node id.
2018-04-11 20:05:44 -05:00
龚尚
c64f7c8e01
Int64 to string.
2018-04-07 14:51:49 +08:00
龚尚
4ca43961f4
Update error log for wrong node id.
...
When custom NodeBits was set, the node number may bigger than 1023.
2018-04-07 14:46:40 +08:00
Bruce Marriner
f613937295
Document Custom Format options
2018-03-19 21:20:30 +00:00
Bruce Marriner
a685984f2e
Allow custom NodeBits and StepBits to be set.
...
You can now set the snowflake.NodeBits or snowflake.StepBits to
custom values. Please keep in mind you have a total of 22 bits
available to use between these two values. Setting these to
inappropriate values may break things. So take care to understand
what you're doing here.
This is not the best way of doing this but it does not break
API compatibility with existing users of this package. I will
release a version 2 of this package which will implement this
feature better.
2018-03-19 21:07:06 +00:00
Bruce
07b209d699
Merge pull request #10 from freman/master
...
Use constants for bits, for easier changing
2018-03-19 15:35:01 -05:00
Bruce Marriner
be5fa11f4f
Lets try a code block
2018-03-19 19:39:52 +00:00
Bruce Marriner
6ed9a16198
Added a visual reference of snowflake format
2018-03-19 19:39:03 +00:00
Bruce Marriner
0516e7e5cf
Added Base32 and ParseBase32 methods.
...
These methods are nearly identical to the base58 methods, except that
these use the z-base-32 character set.
2018-03-12 20:56:32 +00:00
Bruce Marriner
7d434bc4d8
Move things around.
2018-02-01 02:42:33 +00:00
Bruce Marriner
18b124e694
Added more details on ID format
2018-02-01 02:30:24 +00:00
Bruce Marriner
812a8db720
Hide node Mutex
2018-02-01 01:25:24 +00:00
Shannon Wynter
3a07db85c1
Use constants for bits, for easier changing
2017-10-01 22:07:22 +10:00
Bruce
1c0147d077
Merge pull request #8 from mixer/fix-decode-panic
...
Fix panic during UnmarshalJSON
2017-06-29 22:27:14 -05:00
Connor Peet
d3bf1ae440
Fix panic during UnmarshalJSON
2017-06-16 09:02:47 -07:00
Bruce Marriner
02cc386c18
Add Status
2017-02-21 10:07:16 -06:00
Bruce Marriner
734cbe306e
Added Base58 encoder/decoder
2017-02-21 09:58:29 -06:00
Bruce Marriner
34b33bf22a
Merge branch 'master' of https://github.com/bwmarrin/snowflake
2016-12-04 08:16:30 -06:00
Bruce Marriner
d80550bec3
Fixed readme example.
2016-12-04 08:16:12 -06:00
Bruce
3107b1dd8c
Merge pull request #4 from WatchBeam/intbytes
...
Add a method to encode the snowflake as a byte slice
2016-08-12 13:28:05 -05:00
Connor Peet
95d961a628
Add a method to encode the snowflake as a byte slice
2016-07-26 11:35:39 -07:00
Bruce
cd8e42350a
Merge pull request #2 from zeroZshadow/master
...
Fix UnmarshalJSON benchmark & Optimize MarshalJSON a little more
2016-06-10 21:24:27 -05:00
zeroZshadow
8abf09e1ce
Allocate the maximum in 1 go for marshaling
2016-06-11 04:20:04 +02:00
zeroZshadow
bb0fb2c0f5
Fix UnmarshalJSON benchmark
...
Optimize MarshalJSON a little more
2016-06-11 03:48:54 +02:00
Bruce Marriner
c676f9e9ea
Correct node error. It's 0-1023!
2016-06-10 18:54:48 -05:00