Skip to content

emqx/ots_erl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The Erlang client for Tablestore

This is the Erlang client for Tablestore based on the protobuf APIs.

Currently it only supports the Timeseries storage model.

Build

$ rebar3 compile

Examples

{ok, _} = application:ensure_all_started(ots_erl),

Opts = [
    {instance, <<"my_instance">>},
    {pool, <<"my_pool_name">>},
    {endpoint, <<"https://my_instance.cn-hangzhou.ots.aliyuncs.com">>},
    {pool_size, 2},
    {access_key, <<"my_access_key_id">>},
    {access_secret, <<"my_access_key_secret">>}
],

{ok, C} = ots_ts_client:start(Opts),

Row = #{
    time => 1734517355998560,
    tags => #{
        <<"tagKey1">> => <<"tagValue1">>,
        <<"tagKey2">> => <<"tagValue2">>
    },
    fields => [
        {<<"bool_field">>, true, #{}},
        {<<"int_field">>, 10, #{isint => true}},
        {<<"double_field1">>, 10, #{}},
        {<<"double_field2">>, 1.3, #{}},
        {<<"str_field">>, <<"hello">>, #{}},
        {<<"bin_field">>, <<"hello">>, #{isbinary => true}}
    ],
    measurement => <<"measurement">>,
    data_source => <<"data_source">>
},

{ok, _Res} = ots_ts_client:put(C, #{
        table_name => <<"table_name">>,
        rows_data => [],
        meta_update_mode => 'MUM_NORMAL'
    }).

Supported APIs for Timeseries model

  • ListTable
  • CreateTable
  • DeleteTable
  • DescribeTable
  • UpdateTable
  • GetData
  • PutData
  • QueryMeta
  • UpdateMeta
  • DeleteMeta

About

Erlang client for Tablestore

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages