简单的kv数据操作工具。
Project description
使用手册
快速开始
import mapdb
# default map db file : {userHome}/sqlitemap.db
# 写普通属性
mapdb.put("int", 20)
mapdb.put("float", 1.75)
mapdb.put("bool", False)
mapdb.put("string", 'kancy')
mapdb.put("hobby", ["play games"])
mapdb.putBytes("bytes", b"I am bytearray.")
print(mapdb.gets(['int', 'float', 'bool', 'string', 'hobby', 'bytes']))
# 写json
json = {
"name":"kancy",
"age":20,
"height":1.75,
"hobby":["play games"],
"map":{
"k":"v"
}
}
mapdb.put("json", json)
print(mapdb.get("json"))
print(mapdb.get().getJson("json"))
# 写文件
mapdb.putFile("textfile", "data/text.txt")
mapdb.putFile("imgfile", "data/img.png")
mapdb.getFile("textfile", "data/text.txt")
mapdb.getFile("imgfile", "data/img.png")
自定义MapDB
import mapdb
# SQLite实现
db1 = mapdb.SQLiteMapDB(debug=True)
# MySQL实现
db2 = mapdb.MySQLMapDB(host="localhost", username="root", password="root")
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
mapdb-0.0.1.tar.gz
(6.0 kB
view hashes)
Built Distributions
mapdb-0.0.1-py3.9.egg
(9.5 kB
view hashes)
Close
Hashes for mapdb-0.0.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d34f9e9a0b6ab8b1e039a32dbc6a73c6bf39664d7ee3e858cca25f847b41dff5 |
|
MD5 | 692a8a12f36787ebf1fcf47ee8721078 |
|
BLAKE2b-256 | 8b7455bd5aebcb80dc0b91adbc5a6f3a88bd2decd9460752d249e8622658573e |