Testing
Project description
Installation
pip install kvrocks-dao
setup config.ini in the root of project
[kvrocks]
host = 0.0.0.0
port = 6666
Examples
from kvrocks_dao import BaseDAO, BaseEntity
class MediaEnity(BaseEntity):
def __init__(self, _id: int, name: str, type: int):
super().__init__(_id)
self.name = name
self.type = type
class MediaDao(BaseDAO[MediaEnity]):
def __init__(self):
super().__init__(MediaEnity, "media")
dao = MediaDao()
# --- or ---
dao = BaseDAO.from_entity(MediaEnity, "media")
# get
# return MediaEnity
media = dao.get(_id)
# set
media = Media(1, "Nhớ", 10)
dao.set(media)
# set from dataframe
for _, row in df.iterrows():
media = MediaEnity.from_dict(row.to_dict())
print(media.to_dict())
dao.set(media)
# count
dao.count()
# get list
# return List[tuple[int, MediaEnity]]
dao.mget()
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
kvrocks_dao-0.0.7.tar.gz
(2.7 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
File details
Details for the file kvrocks_dao-0.0.7.tar.gz.
File metadata
- Download URL: kvrocks_dao-0.0.7.tar.gz
- Upload date:
- Size: 2.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ba5e36424a3ce36ef6ce8d6aa8e12e02be6beccfc1cf71558fb347a94e0d249e
|
|
| MD5 |
ffa089dd34f3332b606d4a5056061a11
|
|
| BLAKE2b-256 |
22e4c8851633860d7139b7066c286cd836dc455854deeab181baa2e565d8ecd6
|
File details
Details for the file kvrocks_dao-0.0.7-py3-none-any.whl.
File metadata
- Download URL: kvrocks_dao-0.0.7-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
607ae4552211dad8ed13596bb934dcaef6c11de79c734bca8f8abc34834a5184
|
|
| MD5 |
d103435d01587c2d2bbd6ff30c7811e3
|
|
| BLAKE2b-256 |
844713d384fcbad5506d59fc49b7cacc35949c36fd92fd3eff8f9c0160add979
|