Skip to content

Commit 17747b9

Browse files
committed
docs: update readme
1 parent 8f1cb34 commit 17747b9

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@ See [tempoid.dev](https://tempoid.dev) for more information.
1515
- **Short**: The IDs are shorter than UUIDs because they are encoded with a larger alphabet.
1616
- **Sortable**: The IDs are sortable by time because a timestamp is encoded in the beginning of the ID.
1717

18+
Example ID:
19+
20+
```text
21+
0uoUX2EcwlFjsxim
22+
<------><------>
23+
Time Random
24+
```
25+
1826
## Getting Started
1927

2028
```yaml
@@ -39,6 +47,33 @@ void main() {
3947
}
4048
```
4149

50+
## Parameters
51+
52+
### ➤ Length
53+
54+
By default, the length of the ID is 16 characters.
55+
It contains an 8-character UNIX timestamp and an 8-character random string.
56+
You can change the length by passing the `timeLength` and `randomLength` parameters.
57+
58+
```dart
59+
TempoId id = TempoId.generate(timeLength: 10, randomLength: 6);
60+
```
61+
62+
By setting `timeLength` to zero, you can generate a random ID without a timestamp.
63+
`timeLength` should be at least 8 characters to ensure that there are no overflows within the next 7000 years.
64+
65+
### ➤ Alphabet
66+
67+
By default, the ID is encoded with an alphanumeric alphabet (`[A-Za-z0-9]`) without any special characters,
68+
making it easy to select and copy.
69+
You can change the alphabet by passing the `alphabet` parameter.
70+
71+
```dart
72+
Alphabet alphabet = Alphabet('ABCDEF');
73+
TempoId id1 = TempoId.generate(alphabet: alphabet);
74+
TempoId id2 = TempoId.generate(alphabet: Alphabet.base64);
75+
```
76+
4277
## License
4378

4479
MIT License

0 commit comments

Comments
 (0)