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

关于 Object Select 方法返回 503 #290

Open
mteznja4ma opened this issue Nov 22, 2024 · 0 comments
Open

关于 Object Select 方法返回 503 #290

mteznja4ma opened this issue Nov 22, 2024 · 0 comments

Comments

@mteznja4ma
Copy link

mteznja4ma commented Nov 22, 2024

调用 cos-go-sdk-v5/0.7.59 版 sdk 中 ObjectService 的 Select 始终返回503

func (c *cosClient) QueryJson(objectKey string) ([]byte, error) {
	// 执行SELECT请求。
	body, err := c.client.Object.Select(context.Background(), objectKey, &cos.ObjectSelectOptions{
		Expression:     `select * from COSObject`,
		ExpressionType: "SQL",
		InputSerialization: &cos.SelectInputSerialization{
			JSON: &cos.JSONInputSerialization{
				Type: "DOCUMENT",
			},
		},
		OutputSerialization: &cos.SelectOutputSerialization{
			JSON: &cos.JSONOutputSerialization{
				RecordDelimiter: "\n",
			},
		},
	})
	if err != nil {
		return nil, err
	}
	defer body.Close()

	// 读取内容。
	content, err := io.ReadAll(body)
	if err != nil {
		return nil, err
	}

	return content, nil
}
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

No branches or pull requests

1 participant