From 6ceb1821c0fd53d81e9767b0708fd22e9eb47f4a Mon Sep 17 00:00:00 2001 From: SergeTupchiy Date: Fri, 26 Jan 2024 10:34:30 +0200 Subject: [PATCH] docs: add metric timeunit example to README (#37) --- README.md | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8c04f0c..ef9c5e6 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,24 @@ Write data by rows: greptimedb:write(Client, Metric, Points). ``` +Write data specifying `timeunit`: + +```erlang + Metric = #{table => <<"temperatures_nanosec">>, + timeunit => nanosecond}, + Points = + [#{fields => #{<<"temperature">> => 1}, + tags => + #{<<"from">> => <<"mqttx_4b963a8e">>, + <<"host">> => <<"serverA">>, + <<"qos">> => greptimedb_values:int64_value(0), + <<"region">> => <<"hangzhou">>}, + timestamp => 1705946037724448346}], + + {ok, #{response := {affected_rows, #{value := 1}}}} = + greptimedb:write(Client, Metric, Points). +``` + Write in async: ```erlang @@ -172,4 +190,4 @@ Finish benchmark, cost: 48 seconds, rows: 10000000, TPS: 208333.33333333334 -``` \ No newline at end of file +```