dj3nk
English | 简体中文
dj3nk is an ID generation algorithm, the principle of which is from nightteam.
1. Introduction
- You can use
NaturalKeyGeneratorto generate auto-incrementing IDs. - When using Django ORM, you can inherit the NKModel class to automatically generate auto-incrementing IDs.
2. Usage
Install
pip install dj3nk
Examples
- Use directly.
from dj3nk.natural_key_generator import NaturalKeyGenerator
# Optional. Reconfigure.
CONFIG = {
"increment_main_key": "dj3nk",
"random_bit_length": 16,
"puzzle_count": 1000000,
"rdb_conf_name": "default"
}
g = NaturalKeyGenerator(config=CONFIG)
g.generate_nk()
- 在Django ORM中使用
# Optional. Configure `settings.py`.
DJ3NK = {
"increment_main_key": "dj3nk",
"random_bit_length": 16,
"puzzle_count": 1000000,
"rdb_conf_name": "default"
}
# models
from dj3nk.nk_model import NKModel
class XXX(NKModel):
...
Metadata
Release files for dj3nk 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dj3nk-0.3.0.tar.gz | 3.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dj3nk-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.1 kB
Release files / dj3nk-0.3.0.tar.gz
| Download URL | dj3nk-0.3.0.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e2722085a1fe6e873b696d88aa63b9a172d2c25f7b7dcddbd3e69e84c5c7bebc
|
|
BLAKE2b-256 checksum How to use checksums |
c69c5e189a9e672e2e16674b1efa656c9a21c40c2ceb3f938a48c321c3b455af
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.2
|
Release files / dj3nk-0.3.0-py3-none-any.whl
| Download URL | dj3nk-0.3.0-py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
df17788d9a560b4377379cfec0cf6b89577fa735dd9f42b77082fe0a7f973a52
|
|
BLAKE2b-256 checksum How to use checksums |
f025b022edc7ce6265f0626eede47cbdec48a02ee3f8f8a92672f73c72a2f303
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.2
|