Skip to main content

gen4id a simple but maybe useful package for auto-increment ids

Project description

Installation

Usage

pip install gen4id

Normal

from gen4id import IncreaseGen
ic = IncreaseGen(key_len=8)
uid = ic.encode(increase_id=10)
print(uid)

Use Random String

by default, it user the gen4id.increase_gen.MIXED as the random string for choose, you can use a generate random string for you application

from gen4id import random_str,IncreaseGen
from gen4id.increase_gen import MIXED

rstr = random_str(MIXED)
ic = IncreaseGen(choose=rstr,key_len=10)
uid = ic.encode(increase_id=10)
print(uid)

Add Digit Check Bit

from gen4id import random_str,IncreaseGen
from gen4id.increase_gen import MIXED

rstr = random_str(MIXED)
ic = IncreaseGen(choose=rstr,key_len=10,digit=True,digit_bit=2)
uid = ic.encode(increase_id=10)
print(uid)

More

To Be Continue ….

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gen4id-1.0.2.tar.gz (3.7 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page