Skip to main content

简单的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


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)

Uploaded Source

Built Distributions

mapdb-0.0.1-py3.9.egg (9.5 kB view hashes)

Uploaded Source

mapdb-0.0.1-py2.py3-none-any.whl (4.4 kB view hashes)

Uploaded Python 2 Python 3

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