objectid-crystal
objectid-crystal
simple implement mongodb bson objectid
The 12-byte ObjectId value consists of:
- a 4-byte value representing the seconds since the Unix epoch,
- a 3-byte machine identifier,
- a 2-byte process id, and
- a 3-byte counter, starting with a random value.
see: https://docs.mongodb.com/manual/reference/method/ObjectId
Installation
Add this to your application's shard.yml
:
dependencies:
objectid-crystal:
github: liu-chong/objectid-crystal
Usage
require "objectid-crystal"
ObjectId.new
ObjectId.new 16 # base 16
ObjectId.new 16, Time.now.epoch
ObjectId.new 36, Time.new(2016, 2, 15, 10, 20, 30).epoch
Development
TODO: Write development instructions here
Contributing
- Fork it ( https://github.com/liu-chong/objectid-crystal/fork )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
Contributors
- [liu-chong] Liu Chong - creator, maintainer
Repository
objectid-crystal
Owner
Statistic
- 0
- 0
- 0
- 0
- 0
- over 5 years ago
- February 28, 2018
License
MIT License
Links
Synced at
Sun, 22 Dec 2024 03:04:57 GMT
Languages