https://github.com/maxdeviant/entity-id
https://github.com/maxdeviant/entity-id
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/maxdeviant/entity-id
- Owner: maxdeviant
- License: mit
- Created: 2023-03-25T22:50:46.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2023-09-09T14:53:59.000Z (over 2 years ago)
- Last Synced: 2025-03-21T13:53:24.322Z (11 months ago)
- Language: Rust
- Size: 35.2 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# entity_id
[](https://crates.io/crates/entity_id)
[](https://docs.rs/entity_id/)
[](https://github.com/maxdeviant/entity-id/blob/master/LICENSE)
[](https://github.com/maxdeviant/entity-id/actions/workflows/ci.yml)
Production-grade entity IDs for your web application.
## Features
- All the features of [ULIDs](https://github.com/ulid/spec)
- Prefixed IDs à la Stripe (`cus_01gwfyayqspvsdqzd32nh44psh`)
- Easy conversion to and from UUIDs
## Usage
```rust
use entity_id::EntityId;
use ulid::Ulid;
#[derive(EntityId, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy)]
#[entity_id(prefix = "movie")]
struct MovieId(Ulid);
let movie_id = MovieId::new();
println!("{}", movie_id);
// movie_01gwe2pv0c3p1xbcfvm4n8vx08
```