Skip to content

Commit 0872cba

Browse files
authored
Improve ReqCH docs
1 parent 1b64105 commit 0872cba

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

lib/req_ch.ex

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,8 @@ defmodule ReqCH do
4545
iex> Req.post!(req, body: "SELECT number + 1 FROM numbers LIMIT 3").body
4646
"1\\n2\\n3\\n"
4747
48-
It's also possible to make a query using `Req.get/2`:
49-
50-
iex> req = ReqCH.new(database: "system")
51-
iex> Req.get!(req, params: [query: "SELECT number + 1 FROM numbers LIMIT 3"]).body
52-
"1\\n2\\n3\\n"
48+
Although, if you want to pass any parameter, you would need to manually
49+
encode them. For this reason, prefer to use `query/4` for doing queries.
5350
5451
In case the server needs authentication, it's possible to use `Req` options for that.
5552
@@ -75,20 +72,16 @@ defmodule ReqCH do
7572
@doc """
7673
Performs a query against the ClickHouse API.
7774
78-
This version receives a `Req.Request.t()`, so it won't
79-
create a new one from scratch.
80-
8175
By default, it will use the `http://localhost:8123` as `:base_url`.
8276
You can change that either providing in your Req request, or in passing
8377
down in the options.
84-
See `new/1` for the options. Like that function, `query/4` accepts any
85-
option that `Req.new/1` accepts.
78+
79+
`query/4` accepts any option that `new/1` accepts.
8680
8781
## Examples
8882
89-
Queries can be performed using both `Req.get/2` or `Req.post/2`, but GET
90-
is "read-only" and commands like `CREATE` or `INSERT` cannot be used with it.
91-
For that reason, by default we perform a `POST` request.
83+
This function wraps `Req.get/2` and `Req.post/2` to automatically perform
84+
parameter encoding.
9285
9386
A plain query:
9487

0 commit comments

Comments
 (0)