Skip to content

Add internal kernel API /api/attr/batchGetBlockAttrs #11786

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

Closed
IAliceBobI opened this issue Jun 21, 2024 · 4 comments
Closed

Add internal kernel API /api/attr/batchGetBlockAttrs #11786

IAliceBobI opened this issue Jun 21, 2024 · 4 comments
Assignees
Milestone

Comments

@IAliceBobI
Copy link

IAliceBobI commented Jun 21, 2024

请求提供一个批量查属性的接口:batchGetBlockAttrs

In what scenarios do you need this feature?

新版 #11773 的属性查询有些慢,好像还是串行的。

希望可以一个调用,查询多个id的属性。

@88250 88250 self-assigned this Jun 21, 2024
@88250 88250 changed the title 请求提供一个批量查属性的接口:batchGetBlockAttrs Add internal kernel API /api/attr/batchGetBlockAttrs Jun 21, 2024
@88250 88250 added this to the 3.1.0 milestone Jun 21, 2024
@88250
Copy link
Member

88250 commented Jun 21, 2024

http://127.0.0.1:6806/api/attr/batchGetBlockAttrs

参数:

{
    "ids": [
        "20240620235236-6xwmty8",
        "20240620235539-s5uvysx"
    ]
}

返回:

{
    "code": 0,
    "msg": "",
    "data": {
        "20240620235236-6xwmty8": {
            "custom-a": "1",
            "custom-b": "2",
            "id": "20240620235236-6xwmty8",
            "updated": "20240621224346"
        },
        "20240620235539-s5uvysx": {
            "id": "20240620235539-s5uvysx",
            "updated": "20240621230813"
        }
    }
}

@IAliceBobI
Copy link
Author

@88250 data不是数组吗。那需要客户端再根据ids排序一下,才能得到与ids一致的顺序。

88250 added a commit that referenced this issue Jun 21, 2024

Verified

This commit was signed with the committer’s verified signature.
@88250
Copy link
Member

88250 commented Jun 21, 2024

ids 中指定的 id 不一定能查询到,所以按 map 返回比较好一些,按顺序的话会出问题吧。

@IAliceBobI
Copy link
Author

也行,客户端处理一下。

@88250 88250 closed this as completed Jun 21, 2024
copialot pushed a commit to copialot/siyuan that referenced this issue Aug 3, 2024

Verified

This commit was signed with the committer’s verified signature.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants