Aliyun.Oss.Object.select_object
You're seeing just the function
select_object
, go back to Aliyun.Oss.Object module for more information.
Link to this function
select_object(bucket, object, select_request, options \\ [])
Specs
select_object(String.t(), String.t(), String.t() | map(), keyword()) :: {:error, error()} | {:ok, Aliyun.Oss.Client.Response.t()}
SelectObject用于对目标文件执行SQL语句,返回执行结果。
Options
:format
- 用于设置请求语法::json
or:csv
, 默认为:csv
Examples
iex> select_request = %{
"SelectRequest" => %{
"Expression" => "c2VsZWN0ICogZnJvbSBvc3NvYmplY3QuY29udGFjdHNbKl0gcyB3aGVyZSBzLmFnZSA9IDI3",
"InputSerialization" => %{"JSON" => %{"Type" => "DOCUMENT"}},
"OutputSerialization" => %{"JSON" => %{"RecordDelimiter" => "LA=="}}
}
}
iex> Aliyun.Oss.Object.select_object("some-bucket", "some-object", select_request, format: :json)
{:ok, %Aliyun.Oss.Client.Response{
data: <<208, 207, 17, 224, 161, 177, 26, 225, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 62, 0, 3, 0, 254, 255, 9, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18,
0, 0, 0, ...>>,
headers: [
{"Date", "Wed, 05 Dec 2018 02:34:57 GMT"},
...
]
}
}
iex> select_request = ~S[
<SelectRequest>
<Expression>c2VsZWN0ICogZnJvbSBvc3NvYmplY3QuY29udGFjdHNbKl0gcyB3aGVyZSBzLmFnZSA9IDI3</Expression>
<InputSerialization>
<JSON>
<Type>DOCUMENT</Type>
</JSON>
</InputSerialization>
<OutputSerialization>
<JSON>
<RecordDelimiter>LA==</RecordDelimiter>
</JSON>
</OutputSerialization>
</SelectRequest>
]
iex> Aliyun.Oss.Object.select_object("some-bucket", "some-object", select_request, format: :json)
{:ok, %Aliyun.Oss.Client.Response{
data: <<208, 207, 17, 224, 161, 177, 26, 225, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 62, 0, 3, 0, 254, 255, 9, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18,
0, 0, 0, ...>>,
headers: [
{"Date", "Wed, 05 Dec 2018 02:34:57 GMT"},
...
]
}
}