Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tejainece/short_readable_id
A short human readable and easily memorable unique id generator.
https://github.com/tejainece/short_readable_id
Last synced: about 2 months ago
JSON representation
A short human readable and easily memorable unique id generator.
- Host: GitHub
- URL: https://github.com/tejainece/short_readable_id
- Owner: tejainece
- License: other
- Created: 2019-03-05T15:40:18.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2024-03-16T12:07:30.000Z (10 months ago)
- Last Synced: 2024-07-29T10:40:56.359Z (5 months ago)
- Language: Dart
- Size: 4.88 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# short_readable_id
A short human readable and easily memorable unique id generator.
# Generating short human readable id
```dart
void main() {
print(idGenerator.generateReadable()); // => VVGU-976
}
```## Configuring separator
Use `separator` parameter to configure the separator used
between alphabetical and numerical parts of the id.```dart
void main() {
print(idGenerator.generateReadable(separator: '')); // => VVGU976
}
```# Generating short id
```dart
void main() {
print(idGenerator.generate()); // => 1YQOBQO
}
```# Choose date reference
The parameter `refDate` lets the programmer configure reference date that
is used to generate a part of the generated id. The most recent date you
pick, the shorter will be the generated id.```dart
void main() {
final gen = IdGenerator(refDate: DateTime(2050));
}
```# Worker id
Worker id is used to generate the id to make sure ids generated by multiple
concurrent id generators do not conflict. Configure worker id using `workerId`
parameter.```dart
void main() {
final gen = IdGenerator(workerId: 5);
}
```