Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed #90 实现kv数据库接口 #93

Merged
merged 11 commits into from
Nov 9, 2024
Merged

Fixed #90 实现kv数据库接口 #93

merged 11 commits into from
Nov 9, 2024

Conversation

HisAtri
Copy link
Owner

@HisAtri HisAtri commented Oct 27, 2024

端点:
/api/v1/db/<table_name>

操作:

  • PUT/POST:修改
  • GET:读取
  • DELETE:删除

@HisAtri HisAtri linked an issue Oct 29, 2024 that may be closed by this pull request
3 tasks
- 允许一次性提交多条SQL语句
- 允许一次性写入/修改多个key
api/db.py Outdated
}


def valide_tablename(table_name: str) -> tuple[bool, str, int]:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

validate

api/db.py Outdated

from mod.db import SqliteDict, saved_path

SQLITE_RESERVED_WORDS = {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好像并没有用于限制CREATE TABLE,检查这个好像不是特别有用(

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好像确实表名没那么多限制,引号加一个就行

return message, 200
else:
return {"code": code, "message": message}, code
elif request.method == "DELETE":
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

改动和删除数据不也敏感吗(

@HisAtri HisAtri merged commit 79a7499 into main Nov 9, 2024
1 check passed
@HisAtri HisAtri deleted the db-patch branch November 9, 2024 05:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] 增加KV数据库读写接口
2 participants