xid
hord
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
xid
-
The Easiest Way to Create a REST API With Go
The goal of babyapi is to be so easy that a baby could do it. As previously mentioned, babyapi.DefaultResource already implements the required interface, so it can be used as a starting point for simple resource types. Besides simply implementing the interface, this default struct implements some validations around the ID and uses rs/xid to create a unique identifer on new resources.
-
Build a Job Queue with Rust Using Aide-De-Camp (Part 2)
To schedule a job, all we need to do is serialize the payload, create a new JID (we use XID for JIDs), and insert both into the adc_queue table.
-
How we used Go 1.18 when designing our Identifiers
XID's are 96 bits. The first 32 bits are the time, which means we get our k-sorting immediately. The next 40 bits are a machine identifier and a process identifier. However, unlike the other systems, these are calculated automatically using the library and don't require us to configure anything ourselves. The final 24 bits are a sequence number, which allows a single process to generate 16,777,216 identifiers per second!
- Xid, globally unique id generator
-
I need a unique ID sequence number generator, I know I could just use a small MySQL instance, but is there no other way?
Checkout xid https://github.com/rs/xid and how MongoDB does its id
-
You Don't Need UUID
I've had success using xid for user-visible IDs. What's nice is they're shorter than UUID, will sort in order, hides the amount of rows in the table.
https://github.com/rs/xid
hord
-
The Easiest Way to Create a REST API With Go
In an effort to provide actual persistent storage out of the box, the babyapi/storage package uses madflojo/hord to support a variety of key-value store backends. Additionally, babyapi/storage provides helper functions for initializing the hord client for Redis or file-based storage.
-
How I Learned Generics in Go
Determined to implement generics and delete some lines of code, I turned my sights to the storage layer of my application. I designed my storage around key-value pairs since I started by storing resources in YAML files. This eventually evolved to use madflojo/hord to interact with key-value data stores like Redis. The function to read a *pkg.Garden from storage looks like this:
What are some alternatives?
nanoid - A tiny and fast Go unique string generator
cachego - Golang Cache component - Multiple drivers
ulid - Universally Unique Lexicographically Sortable Identifier (ULID) in Go
godis - redis client implement by golang, inspired by jedis.
uuid - Go package for UUIDs based on RFC 4122 and DCE 1.1: Authentication and Security Services.
redigo - Go client for Redis
gouid - Fast, dependable universally unique ids
Redis - Redis Go client
sno - Compact, sortable and fast unique IDs with embedded metadata.
go-random-chat - Modern real-time chat in scalable architecture.
goflake - A highly scalable and serverless unique ID generator for use in distributed systems. Written in GoLang. Inspired by Twitters Snowflake.
babyapi - A Go CRUD API framework so simple a baby could use it.