From 6618ba5511de63e46eead917b53945e228d1447d Mon Sep 17 00:00:00 2001 From: anlicheng <244108715@qq.com> Date: Wed, 4 Jun 2025 10:38:22 +0800 Subject: [PATCH] add deps --- apps/endpoint/include/endpoint.hrl | 58 ++++++++++++++++++++++++++++++ apps/endpoint/src/endpoint.app.src | 6 ++++ 2 files changed, 64 insertions(+) create mode 100644 apps/endpoint/include/endpoint.hrl diff --git a/apps/endpoint/include/endpoint.hrl b/apps/endpoint/include/endpoint.hrl new file mode 100644 index 0000000..0789fbd --- /dev/null +++ b/apps/endpoint/include/endpoint.hrl @@ -0,0 +1,58 @@ +%%%------------------------------------------------------------------- +%%% @author anlicheng +%%% @copyright (C) 2024, +%%% @doc +%%% 数据类型统一为 LineProtocol +%%% @end +%%% Created : 06. 5月 2024 18:17 +%%%------------------------------------------------------------------- +-author("anlicheng"). + +-record(http_endpoint, { + url = <<>> :: binary(), + pool_size = 10 :: integer() +}). + +-record(mqtt_endpoint, { + host = <<>> :: binary(), + port = 0 :: integer(), + client_id = <<>> :: binary(), + username = <<>> :: binary(), + password = <<>> :: binary(), + topic = <<>> :: binary(), + qos = 0 :: integer() +}). + +-record(kafka_endpoint, { + username = <<>> :: binary(), + password = <<>> :: binary(), + bootstrap_servers = [] :: [binary()], + topic = <<>> :: binary() +}). + +-record(mysql_endpoint, { + host = <<>> :: binary(), + port = 0 :: integer(), + username = <<>> :: binary(), + password = <<>> :: binary(), + database = <<>> :: binary(), + table_name = <<>> :: binary(), + pool_size = 10 :: integer() +}). + +-record(endpoint, { + id :: integer(), + %% 标题描述 + title = <<>> :: binary(), + mapper = <<>> :: binary(), + %% 数据转换规则,基于 + %% fun(LocationCode :: binary(), Fields :: [{<<"key">> => <<>>, <<"value">> => <<>>, <<"unit">> => <<>>}]) + %% fun(LocationCode :: binary(), Fields :: [{<<"key">> => <<>>, <<"value">> => <<>>, <<"unit">> => <<>>}], Timestamp :: integer()) + mapper_fun = fun(_, Fields) -> Fields end :: fun(), + %% 配置项, 格式: #{<<"protocol">> => <<"http|https|ws|kafka|mqtt">>, <<"args">> => #{}} + config = #http_endpoint{} :: #http_endpoint{} | #mqtt_endpoint{} | #kafka_endpoint{} | #mysql_endpoint{}, + %% 更新时间 + updated_at = 0 :: integer(), + %% 创建时间 + created_at = 0 :: integer() +}). \ No newline at end of file diff --git a/apps/endpoint/src/endpoint.app.src b/apps/endpoint/src/endpoint.app.src index b10c10f..b10e1e0 100644 --- a/apps/endpoint/src/endpoint.app.src +++ b/apps/endpoint/src/endpoint.app.src @@ -5,7 +5,13 @@ {mod, {endpoint_app, []}}, {applications, [ + poolboy, + hackney, + sync, + mysql, emqtt, + parse_trans, + lager, kernel, stdlib ]},