https://github.com/jackkweyunga/idika
A python unique ids generator implemented in rust
https://github.com/jackkweyunga/idika
Last synced: over 1 year ago
JSON representation
A python unique ids generator implemented in rust
- Host: GitHub
- URL: https://github.com/jackkweyunga/idika
- Owner: jackkweyunga
- License: other
- Created: 2024-06-20T11:49:59.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-06-23T21:36:17.000Z (about 2 years ago)
- Last Synced: 2025-03-24T14:07:59.155Z (over 1 year ago)
- Language: Nix
- Size: 416 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# idika
A simple unique ids generator for python implemented in rust
Algorithms / Implimentations
- [x] cuid2
- [ ] sonyflakes
# Installation
```shell
pip install idika
```
## cuid2
```python
import idika
# generate one id
# 10 -> id length
idika.with_cuid(10)
# output: o13q75qk9q
# generate multiple ids
# 10000 -> Count , 10 -> length
idika.n_with_cuid(1000, 10)
"""
output:
[
'mdse9rnpj1',
'ub324hvoxm',
'f1rcv9ysrr',
'jzeweia5ut',
'k12lt092sc',
'k11j9jpbb7',
...10000
]
"""
# Pipe
# Run a certain function on all ids generated.
def process_id(id):
# doing some processing
# ... e.g database calls
print(id)
idika.n_with_cuid(1000, 10).pipe(process_id)
```