nido
Version, currently 0.1.13 versions
- 0.1.2latestSep 7, 2017
- 0.1.1not indexedSep 7, 2017
- 0.1.0not indexedSep 7, 2017
github.com/microspino/nido-crystal
Structured keys helper: Crystal port of https://github.com/soveran/nido
Nothing has been indexed for 0.1.1 yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.
Installation
# Add this to your shard.yml
dependencies:
nido:
github: microspino/nido-crystal
version: ~> 0.1.1Then run:
shards installshard.yml
No shard.yml has been indexed for 0.1.1. You can read it on the repository.
Dependencies
Unknown: the shard.yml for this version has not been read yet.
README
This README is the one indexed from the repository at its latest ref, not from the tag for this version.
Nido (ported to Crystal lang)
Original Nido Ruby project from @soveran
Structured keys helper.
Description
If you are familiar with databases like Redis and libraries like Ohm you already know how important it is to craft the keys that will hold the data.
>> redis = Redis.new
>> redis.sadd("event:3:attendees", "Albert")
>> redis.smembers("event:3:attendees")
=> ["Albert"]
It is a design pattern in key-value databases to use the key to simulate structure, and you can read more about this in the case study for a Twitter clone.
Nido helps you generate those keys by providing chainable namespaces:
>> r = Redis.new
>> event = Nido.new("event")
>> r.sadd(event[3][:attendees], "Albert")
>> r.smembers(event[3][:attendees])
=> ["Albert"]
Usage
To create a new namespace:
>> require "nido"
>> ns = Nido.new("foo")
=> "foo"
>> ns["bar"]
=> "foo:bar"
>> ns["bar"]["baz"]["qux"]
=> "foo:bar:baz:qux"
And you can use any object as a key, not only strings:
>> ns[:bar][42]
=> "foo:bar:42"
In a more realistic tone, lets assume you are working with Redis and dealing with events:
>> events = Nido.new("events")
=> "events"
>> id = r.incr(events[:id])
=> 1
>> r.sadd(events[id][:attendees], "Albert")
=> "OK"
>> meetup = events[id]
=> "events:1"
>> r.smembers(meetup[:attendees])
=> ["Albert"]
Installation
Add this to your application's shard.yml:
dependencies:
nido:
github: microspino/nido-crystal
version: ~> 0.1.2
Thanks
to soveran for inventing it and inspiring me to write minimal code in Ruby and now Crystal.
Contributing
- Fork it ( https://github.com/microspino/nido-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
- [microspino] Microspino - creator, maintainer
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.1.1- Tagged
- Sep 7, 2017
- Commit
cce6ca2816d6- Indexed
- not yet
Dependents
Repository
github.com/microspino/nido-crystal
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 16, 2026
- Synced
- Aug 16, 2026
- Versions
- 3