dj3nk is an ID generation algorithm, the principle of which is from nightteam.
Project description
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):
...
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
dj3nk-0.3.0.tar.gz
(3.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
dj3nk-0.3.0-py3-none-any.whl
(4.2 kB
view details)
File details
Details for the file dj3nk-0.3.0.tar.gz.
File metadata
- Download URL: dj3nk-0.3.0.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e2722085a1fe6e873b696d88aa63b9a172d2c25f7b7dcddbd3e69e84c5c7bebc
|
|
| MD5 |
a65751ee3519a6e17263a0a4ecfe250f
|
|
| BLAKE2b-256 |
c69c5e189a9e672e2e16674b1efa656c9a21c40c2ceb3f938a48c321c3b455af
|
File details
Details for the file dj3nk-0.3.0-py3-none-any.whl.
File metadata
- Download URL: dj3nk-0.3.0-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
df17788d9a560b4377379cfec0cf6b89577fa735dd9f42b77082fe0a7f973a52
|
|
| MD5 |
94526c1a1dbb0f6bec74692d8df3b688
|
|
| BLAKE2b-256 |
f025b022edc7ce6265f0626eede47cbdec48a02ee3f8f8a92672f73c72a2f303
|