babyapi
xid
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.
babyapi
-
Let's Talk About REST...
Now this is the part where I tell you about a library I created, babyapi, and how it makes all of this tedious REST stuff easy!
-
Run Go + HTMX in the Cloud with Acorn
The availability of app platforms like Acorn and easy-to-use libraries like babyapi take care of the boring and tedious parts of software engineering and let you focus on the things that interest you. Try them out for yourself and let me know what you have any feature requests or issues with babyapi.
-
How To Build a Web Application with HTMX and Go
All that's left is adding a little style. I won't claim to be a frontend engineer or a UI designer, so I just used UIKit to easily add modern-looking style to the HTML table and buttons. As mentioned throughout the article, the CSS classes and other small details are excluded since they are not directly relevant to the tutorial. See the full example on GitHub to try running it for yourself.
-
The Easiest Way to Create a REST API With Go
Go is known for being easy to learn and providing the fastest path to production. With HTTP functionality built-in to the standard library, you have everything you need without any external dependencies. The lower-level access to HTTP can be a breath of fresh air if you are accustomed to bloated frameworks, but it results in a lot of boilerplate code which eventually becomes tiring to write over and over. This is where babyapi comes in. I created this library to enable super simple creation of REST APIs without forcing a specific structure on your whole application. It's so easy that a baby could do it!
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
What are some alternatives?
hord - Manage data in Go with a simple key-value interface supporting various databases.
nanoid - A tiny and fast Go unique string generator
ulid - Universally Unique Lexicographically Sortable Identifier (ULID) in Go
uuid - Go package for UUIDs based on RFC 4122 and DCE 1.1: Authentication and Security Services.
gouid - Fast, dependable universally unique ids
sno - Compact, sortable and fast unique IDs with embedded metadata.
goflake - A highly scalable and serverless unique ID generator for use in distributed systems. Written in GoLang. Inspired by Twitters Snowflake.
go.uuid - UUID package for Go
Monoton - Highly scalable, single/multi node, sortable, predictable and incremental unique id generator with zero allocation magic on the sequential generation
golang-docker-cache - Improved docker Golang module dependency cache for faster builds.
modd - A flexible developer tool that runs processes and responds to filesystem changes
ksuid - K-Sortable Globally Unique IDs