From e58a52ee5aaee81a750e2d347f098e5f2a4d7027 Mon Sep 17 00:00:00 2001 From: tison Date: Wed, 29 Nov 2023 23:04:00 +0800 Subject: [PATCH 1/4] chore: rename ceresdb to horaedb Signed-off-by: tison --- Makefile | 3 +-- README.md | 6 +----- ceresdb/client.go | 2 +- ceresdb/client_impl.go | 2 +- ceresdb/code.go | 2 +- ceresdb/options.go | 2 +- ceresdb/point.go | 2 +- ceresdb/route.go | 2 +- ceresdb/rpc.go | 2 +- ceresdb/types.go | 2 +- ceresdb/utils.go | 2 +- ceresdb/value.go | 2 +- examples/read_write.go | 2 +- licenserc.toml | 19 +++++++++++++++++++ test/base_test.go | 2 +- test/cluster_test.go | 2 +- test/point_test.go | 2 +- test/route_test.go | 2 +- tools/check-license.sh | 12 ------------ 19 files changed, 36 insertions(+), 34 deletions(-) create mode 100644 licenserc.toml delete mode 100644 tools/check-license.sh diff --git a/Makefile b/Makefile index d75f83e..8d50457 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,3 @@ - default: build GO_TOOLS_BIN_PATH := $(shell pwd)/.tools/bin @@ -20,7 +19,7 @@ lint: revive -formatter friendly -config revive.toml ./... check-license: - sh ./tools/check-license.sh + docker run --rm -v $(pwd):/github/workspace ghcr.io/korandoru/hawkeye-native:v3 check test: go test -timeout 5m -race -cover ./... diff --git a/README.md b/README.md index 3b38871..8b23573 100644 --- a/README.md +++ b/README.md @@ -17,9 +17,5 @@ Golang client for [HoraeDB](https://github.com/CeresDB/horaedb). Please refer [Golang SDK docs](https://ceresdb.github.io/docs/en/sdk/go.html). ## License -Under [Apache License 2.0](./LICENSE). -## Community and support -- Join the user group on [Slack](https://join.slack.com/t/ceresdbcommunity/shared_invite/zt-1au1ihbdy-5huC9J9s2462yBMIWmerTw) -- Join the user group on WeChat [WeChat QR code](https://github.com/CeresDB/community/blob/main/communication/wechat/group_qrcode.png) -- Join the user group on DingTalk: 44602802 +Under [Apache License 2.0](LICENSE). diff --git a/ceresdb/client.go b/ceresdb/client.go index 55eae0a..de4fdb7 100644 --- a/ceresdb/client.go +++ b/ceresdb/client.go @@ -1,4 +1,4 @@ -// Copyright 2022 CeresDB Project Authors. Licensed under Apache-2.0. + package ceresdb diff --git a/ceresdb/client_impl.go b/ceresdb/client_impl.go index 72b6eba..6e447a1 100644 --- a/ceresdb/client_impl.go +++ b/ceresdb/client_impl.go @@ -1,4 +1,4 @@ -// Copyright 2022 CeresDB Project Authors. Licensed under Apache-2.0. + package ceresdb diff --git a/ceresdb/code.go b/ceresdb/code.go index 0cc4bd4..24a1fa5 100644 --- a/ceresdb/code.go +++ b/ceresdb/code.go @@ -1,4 +1,4 @@ -// Copyright 2022 CeresDB Project Authors. Licensed under Apache-2.0. + package ceresdb diff --git a/ceresdb/options.go b/ceresdb/options.go index 1fb68c1..260eb40 100644 --- a/ceresdb/options.go +++ b/ceresdb/options.go @@ -1,4 +1,4 @@ -// Copyright 2022 CeresDB Project Authors. Licensed under Apache-2.0. + package ceresdb diff --git a/ceresdb/point.go b/ceresdb/point.go index 0584828..4adf896 100644 --- a/ceresdb/point.go +++ b/ceresdb/point.go @@ -1,4 +1,4 @@ -// Copyright 2022 CeresDB Project Authors. Licensed under Apache-2.0. + package ceresdb diff --git a/ceresdb/route.go b/ceresdb/route.go index 5b46a85..ac96654 100644 --- a/ceresdb/route.go +++ b/ceresdb/route.go @@ -1,4 +1,4 @@ -// Copyright 2022 CeresDB Project Authors. Licensed under Apache-2.0. + package ceresdb diff --git a/ceresdb/rpc.go b/ceresdb/rpc.go index 36b9e4a..7cb688a 100644 --- a/ceresdb/rpc.go +++ b/ceresdb/rpc.go @@ -1,4 +1,4 @@ -// Copyright 2022 CeresDB Project Authors. Licensed under Apache-2.0. + package ceresdb diff --git a/ceresdb/types.go b/ceresdb/types.go index 69d5b0c..66a3b26 100644 --- a/ceresdb/types.go +++ b/ceresdb/types.go @@ -1,4 +1,4 @@ -// Copyright 2022 CeresDB Project Authors. Licensed under Apache-2.0. + package ceresdb diff --git a/ceresdb/utils.go b/ceresdb/utils.go index 21958ae..bc724b7 100644 --- a/ceresdb/utils.go +++ b/ceresdb/utils.go @@ -1,4 +1,4 @@ -// Copyright 2022 CeresDB Project Authors. Licensed under Apache-2.0. + package ceresdb diff --git a/ceresdb/value.go b/ceresdb/value.go index 6d617dc..daa4fba 100644 --- a/ceresdb/value.go +++ b/ceresdb/value.go @@ -1,4 +1,4 @@ -// Copyright 2022 CeresDB Project Authors. Licensed under Apache-2.0. + package ceresdb diff --git a/examples/read_write.go b/examples/read_write.go index 22abd68..5f7c908 100644 --- a/examples/read_write.go +++ b/examples/read_write.go @@ -1,4 +1,4 @@ -// Copyright 2022 CeresDB Project Authors. Licensed under Apache-2.0. + package main diff --git a/licenserc.toml b/licenserc.toml new file mode 100644 index 0000000..c01b9f2 --- /dev/null +++ b/licenserc.toml @@ -0,0 +1,19 @@ +# Copyright 2022 The HoraeDB Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +headerPath = "Apache-2.0.txt" + +[properties] +inceptionYear = 2022 +copyrightOwner = "The HoraeDB Authors" diff --git a/test/base_test.go b/test/base_test.go index 970c804..44077cf 100644 --- a/test/base_test.go +++ b/test/base_test.go @@ -1,4 +1,4 @@ -// Copyright 2022 CeresDB Project Authors. Licensed under Apache-2.0. + package test diff --git a/test/cluster_test.go b/test/cluster_test.go index 39a5c4f..7d817c7 100644 --- a/test/cluster_test.go +++ b/test/cluster_test.go @@ -1,4 +1,4 @@ -// Copyright 2022 CeresDB Project Authors. Licensed under Apache-2.0. + package test diff --git a/test/point_test.go b/test/point_test.go index 9889cc6..e376326 100644 --- a/test/point_test.go +++ b/test/point_test.go @@ -1,4 +1,4 @@ -// Copyright 2022 CeresDB Project Authors. Licensed under Apache-2.0. + package test diff --git a/test/route_test.go b/test/route_test.go index cac922f..ac93a6f 100644 --- a/test/route_test.go +++ b/test/route_test.go @@ -1,4 +1,4 @@ -// Copyright 2022 CeresDB Project Authors. Licensed under Apache-2.0. + package test diff --git a/tools/check-license.sh b/tools/check-license.sh deleted file mode 100644 index d0ff3f4..0000000 --- a/tools/check-license.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash -# Check all source files have a license header. -set -eu - -for i in $(git ls-files --exclude-standard | grep "\.go$"); do - # first line -> match -> print line -> quit - matches=$(sed -n "1{/Copyright [0-9]\{4\} CeresDB Project Authors. Licensed under Apache-2.0./p;};q;" $i) - if [ -z "${matches}" ]; then - echo "License header is missing from $i." - exit 1 - fi -done \ No newline at end of file From c8d19fdc1974e7492d6e7757b946cc4693d20573 Mon Sep 17 00:00:00 2001 From: tison Date: Wed, 29 Nov 2023 23:04:25 +0800 Subject: [PATCH 2/4] apply license header format Signed-off-by: tison --- .github/workflows/CI.yml | 14 ++++++++++++++ .golangci.yml | 14 ++++++++++++++ ceresdb/client.go | 16 +++++++++++++++- ceresdb/client_impl.go | 16 +++++++++++++++- ceresdb/code.go | 16 +++++++++++++++- ceresdb/options.go | 16 +++++++++++++++- ceresdb/point.go | 16 +++++++++++++++- ceresdb/route.go | 16 +++++++++++++++- ceresdb/rpc.go | 16 +++++++++++++++- ceresdb/types.go | 16 +++++++++++++++- ceresdb/utils.go | 16 +++++++++++++++- ceresdb/value.go | 16 +++++++++++++++- examples/read_write.go | 16 +++++++++++++++- revive.toml | 14 ++++++++++++++ test/base_test.go | 16 +++++++++++++++- test/cluster_test.go | 16 +++++++++++++++- test/point_test.go | 16 +++++++++++++++- test/route_test.go | 16 +++++++++++++++- 18 files changed, 267 insertions(+), 15 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 9959378..9b3304d 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -1,3 +1,17 @@ +# Copyright 2022 The HoraeDB Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + name: CI on: diff --git a/.golangci.yml b/.golangci.yml index 61d1f72..27a71bf 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,3 +1,17 @@ +# Copyright 2022 The HoraeDB Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + run: deadline: 5m skip-files: diff --git a/ceresdb/client.go b/ceresdb/client.go index de4fdb7..9c6b2bd 100644 --- a/ceresdb/client.go +++ b/ceresdb/client.go @@ -1,4 +1,18 @@ - +/* + * Copyright 2022 The HoraeDB Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package ceresdb diff --git a/ceresdb/client_impl.go b/ceresdb/client_impl.go index 6e447a1..3b0e7ca 100644 --- a/ceresdb/client_impl.go +++ b/ceresdb/client_impl.go @@ -1,4 +1,18 @@ - +/* + * Copyright 2022 The HoraeDB Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package ceresdb diff --git a/ceresdb/code.go b/ceresdb/code.go index 24a1fa5..74334a6 100644 --- a/ceresdb/code.go +++ b/ceresdb/code.go @@ -1,4 +1,18 @@ - +/* + * Copyright 2022 The HoraeDB Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package ceresdb diff --git a/ceresdb/options.go b/ceresdb/options.go index 260eb40..1a85817 100644 --- a/ceresdb/options.go +++ b/ceresdb/options.go @@ -1,4 +1,18 @@ - +/* + * Copyright 2022 The HoraeDB Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package ceresdb diff --git a/ceresdb/point.go b/ceresdb/point.go index 4adf896..54bbb7e 100644 --- a/ceresdb/point.go +++ b/ceresdb/point.go @@ -1,4 +1,18 @@ - +/* + * Copyright 2022 The HoraeDB Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package ceresdb diff --git a/ceresdb/route.go b/ceresdb/route.go index ac96654..945ec4e 100644 --- a/ceresdb/route.go +++ b/ceresdb/route.go @@ -1,4 +1,18 @@ - +/* + * Copyright 2022 The HoraeDB Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package ceresdb diff --git a/ceresdb/rpc.go b/ceresdb/rpc.go index 7cb688a..b3a4689 100644 --- a/ceresdb/rpc.go +++ b/ceresdb/rpc.go @@ -1,4 +1,18 @@ - +/* + * Copyright 2022 The HoraeDB Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package ceresdb diff --git a/ceresdb/types.go b/ceresdb/types.go index 66a3b26..4c9a80f 100644 --- a/ceresdb/types.go +++ b/ceresdb/types.go @@ -1,4 +1,18 @@ - +/* + * Copyright 2022 The HoraeDB Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package ceresdb diff --git a/ceresdb/utils.go b/ceresdb/utils.go index bc724b7..55a3222 100644 --- a/ceresdb/utils.go +++ b/ceresdb/utils.go @@ -1,4 +1,18 @@ - +/* + * Copyright 2022 The HoraeDB Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package ceresdb diff --git a/ceresdb/value.go b/ceresdb/value.go index daa4fba..cc72d24 100644 --- a/ceresdb/value.go +++ b/ceresdb/value.go @@ -1,4 +1,18 @@ - +/* + * Copyright 2022 The HoraeDB Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package ceresdb diff --git a/examples/read_write.go b/examples/read_write.go index 5f7c908..d9f26b6 100644 --- a/examples/read_write.go +++ b/examples/read_write.go @@ -1,4 +1,18 @@ - +/* + * Copyright 2022 The HoraeDB Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package main diff --git a/revive.toml b/revive.toml index a08fbed..a1edc27 100644 --- a/revive.toml +++ b/revive.toml @@ -1,3 +1,17 @@ +# Copyright 2022 The HoraeDB Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + ignoreGeneratedHeader = true severity = "warning" confidence = 0.8 diff --git a/test/base_test.go b/test/base_test.go index 44077cf..3d0930c 100644 --- a/test/base_test.go +++ b/test/base_test.go @@ -1,4 +1,18 @@ - +/* + * Copyright 2022 The HoraeDB Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package test diff --git a/test/cluster_test.go b/test/cluster_test.go index 7d817c7..3150dc9 100644 --- a/test/cluster_test.go +++ b/test/cluster_test.go @@ -1,4 +1,18 @@ - +/* + * Copyright 2022 The HoraeDB Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package test diff --git a/test/point_test.go b/test/point_test.go index e376326..f52434c 100644 --- a/test/point_test.go +++ b/test/point_test.go @@ -1,4 +1,18 @@ - +/* + * Copyright 2022 The HoraeDB Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package test diff --git a/test/route_test.go b/test/route_test.go index ac93a6f..7d3ad90 100644 --- a/test/route_test.go +++ b/test/route_test.go @@ -1,4 +1,18 @@ - +/* + * Copyright 2022 The HoraeDB Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package test From 2e3925b7394f0c6595782cb6aa422b780a0ee023 Mon Sep 17 00:00:00 2001 From: tison Date: Wed, 29 Nov 2023 23:14:06 +0800 Subject: [PATCH 3/4] rename more Signed-off-by: tison --- CHANGELOG.md | 18 ------- examples/read_write.go | 38 +++++++-------- go.mod | 7 ++- go.sum | 7 ++- {ceresdb => horaedb}/client.go | 2 +- {ceresdb => horaedb}/client_impl.go | 4 +- {ceresdb => horaedb}/code.go | 4 +- {ceresdb => horaedb}/options.go | 2 +- {ceresdb => horaedb}/point.go | 4 +- {ceresdb => horaedb}/route.go | 2 +- {ceresdb => horaedb}/rpc.go | 4 +- {ceresdb => horaedb}/types.go | 2 +- {ceresdb => horaedb}/utils.go | 2 +- {ceresdb => horaedb}/value.go | 2 +- test/base_test.go | 74 ++++++++++++++--------------- test/cluster_test.go | 20 ++++---- test/point_test.go | 44 ++++++++--------- test/route_test.go | 34 ++++++------- 18 files changed, 125 insertions(+), 145 deletions(-) delete mode 100644 CHANGELOG.md rename {ceresdb => horaedb}/client.go (98%) rename {ceresdb => horaedb}/client_impl.go (97%) rename {ceresdb => horaedb}/code.go (95%) rename {ceresdb => horaedb}/options.go (99%) rename {ceresdb => horaedb}/point.go (96%) rename {ceresdb => horaedb}/route.go (99%) rename {ceresdb => horaedb}/rpc.go (99%) rename {ceresdb => horaedb}/types.go (99%) rename {ceresdb => horaedb}/utils.go (98%) rename {ceresdb => horaedb}/value.go (99%) diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index c7e74f2..0000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,18 +0,0 @@ -## 1.1.0 [2023-02-28] -- Features - - Update proto to v1.0.0 [37](https://github.com/CeresDB/ceresdb-client-go/pull/37) - - Add API `Row.columns() []Column` [36](https://github.com/CeresDB/ceresdb-client-go/pull/36) -- Fixes - - Fix `Route not found for table` [33](https://github.com/CeresDB/ceresdb-client-go/pull/33) -- Breaking Changes - - Move package `types` to `ceresdb` [34](https://github.com/CeresDB/ceresdb-client-go/pull/34) - - Move `Row.ColumnValue(string) Value` to `Row.Column(string) (Column, bool)` - - Move `Value.Value() interface{}` to `Value.AnyValue() interface{}` - -## 1.0.1 [2023-02-23] -- Fixes - - Remove `tools.go` to fix [#27](https://github.com/CeresDB/ceresdb-client-go/pull/27) - -## 1.0.0 [2023-02-22] -- Features - - The [Ceresdb](https://github.com/CeresDB/ceresdb/tree/main) Golang client version of the API allowing for the reading, writing, and managing of data tables. diff --git a/examples/read_write.go b/examples/read_write.go index d9f26b6..0a89fd5 100644 --- a/examples/read_write.go +++ b/examples/read_write.go @@ -22,19 +22,19 @@ import ( "os" "time" - "github.com/CeresDB/ceresdb-client-go/ceresdb" + "github.com/CeresDB/horaedb-client-go/horaedb" ) var endpoint = "127.0.0.1:8831" func init() { - if v := os.Getenv("CERESDB_ADDR"); v != "" { + if v := os.Getenv("HORAEDB_ADDR"); v != "" { endpoint = v } } -func existsTable(client ceresdb.Client) error { - req := ceresdb.SQLQueryRequest{ +func existsTable(client horaedb.Client) error { + req := horaedb.SQLQueryRequest{ Tables: []string{"demo"}, SQL: "EXISTS TABLE demo", } @@ -47,14 +47,14 @@ func existsTable(client ceresdb.Client) error { return nil } -func createTable(client ceresdb.Client) error { +func createTable(client horaedb.Client) error { createTableSQL := `CREATE TABLE IF NOT EXISTS demo ( name string TAG, value double, t timestamp NOT NULL, TIMESTAMP KEY(t)) ENGINE=Analytic with (enable_ttl=false)` - req := ceresdb.SQLQueryRequest{ + req := horaedb.SQLQueryRequest{ Tables: []string{"demo"}, SQL: createTableSQL, } @@ -67,9 +67,9 @@ func createTable(client ceresdb.Client) error { return nil } -func dropTable(client ceresdb.Client) error { +func dropTable(client horaedb.Client) error { dropTableSQL := `DROP TABLE demo` - req := ceresdb.SQLQueryRequest{ + req := horaedb.SQLQueryRequest{ Tables: []string{"demo"}, SQL: dropTableSQL, } @@ -82,21 +82,21 @@ func dropTable(client ceresdb.Client) error { return nil } -func writeTable(client ceresdb.Client) error { +func writeTable(client horaedb.Client) error { nowInMs := time.Now().UnixNano() / int64(time.Millisecond) - points := make([]ceresdb.Point, 0, 2) + points := make([]horaedb.Point, 0, 2) for i := 0; i < 2; i++ { - point, err := ceresdb.NewPointBuilder("demo"). + point, err := horaedb.NewPointBuilder("demo"). SetTimestamp(nowInMs). - AddTag("name", ceresdb.NewStringValue("test_tag1")). - AddField("value", ceresdb.NewDoubleValue(0.4242)). + AddTag("name", horaedb.NewStringValue("test_tag1")). + AddField("value", horaedb.NewDoubleValue(0.4242)). Build() if err != nil { return err } points = append(points, point) } - req := ceresdb.WriteRequest{ + req := horaedb.WriteRequest{ Points: points, } resp, err := client.Write(context.Background(), req) @@ -112,9 +112,9 @@ func writeTable(client ceresdb.Client) error { return nil } -func queryTable(client ceresdb.Client) error { +func queryTable(client horaedb.Client) error { querySQL := `SELECT * FROM demo` - req := ceresdb.SQLQueryRequest{ + req := horaedb.SQLQueryRequest{ Tables: []string{"demo"}, SQL: querySQL, } @@ -130,9 +130,9 @@ func queryTable(client ceresdb.Client) error { func main() { fmt.Println("------------------------------------------------------------------") fmt.Println("### new client:") - client, err := ceresdb.NewClient(endpoint, ceresdb.Direct, - ceresdb.WithDefaultDatabase("public"), - ceresdb.EnableLoggerDebug(true), + client, err := horaedb.NewClient(endpoint, horaedb.Direct, + horaedb.WithDefaultDatabase("public"), + horaedb.EnableLoggerDebug(true), ) if err != nil { fmt.Printf("new ceresdb client fail, err: %v\n", err) diff --git a/go.mod b/go.mod index 1683e97..f790c26 100644 --- a/go.mod +++ b/go.mod @@ -1,11 +1,12 @@ -module github.com/CeresDB/ceresdb-client-go +module github.com/CeresDB/horaedb-client-go go 1.17 require ( - github.com/CeresDB/ceresdbproto/golang v0.0.0-20230228090856-37ba6214b131 + github.com/CeresDB/horaedbproto/golang v0.0.0-20231129131648-5d5d868218c3 github.com/apache/arrow/go/arrow v0.0.0-20211112161151-bc219186db40 github.com/hashicorp/golang-lru v1.0.2 + github.com/pkg/errors v0.9.1 github.com/stretchr/testify v1.8.1 google.golang.org/grpc v1.47.0 ) @@ -20,8 +21,6 @@ require ( require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/golang/protobuf v1.5.2 // indirect - github.com/google/go-cmp v0.5.8 // indirect - github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect golang.org/x/net v0.5.0 // indirect golang.org/x/sys v0.4.0 // indirect diff --git a/go.sum b/go.sum index e4e4af0..14e39e4 100644 --- a/go.sum +++ b/go.sum @@ -4,8 +4,8 @@ dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7 gioui.org v0.0.0-20210308172011-57750fc8a0a6/go.mod h1:RSH6KIUZ0p2xy5zHDxgAM4zumjgTw83q2ge/PI+yyw8= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/CeresDB/ceresdbproto/golang v0.0.0-20230228090856-37ba6214b131 h1:ePzWeIoLOT4FsdjNrmEVrrtm412H2xHM6ZNLamB0bqk= -github.com/CeresDB/ceresdbproto/golang v0.0.0-20230228090856-37ba6214b131/go.mod h1:qLTh6jtSu2ZLIFsU3iiDIKvkrQvyY/Csg6Mk0Ub0QZ4= +github.com/CeresDB/horaedbproto/golang v0.0.0-20231129131648-5d5d868218c3 h1:RgOKVfdbnF4W5/TVFf7cIahom5HcV1v0GP2BYDc0BEM= +github.com/CeresDB/horaedbproto/golang v0.0.0-20231129131648-5d5d868218c3/go.mod h1:RHgzmQBZC4P5+Jm58flXMynMFGbiVQrw1t2ce3wLVas= github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/apache/arrow/go/arrow v0.0.0-20211112161151-bc219186db40 h1:q4dksr6ICHXqG5hm0ZW5IHyeEJXoIJSOZeBLmWPNeIQ= @@ -67,9 +67,8 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c= diff --git a/ceresdb/client.go b/horaedb/client.go similarity index 98% rename from ceresdb/client.go rename to horaedb/client.go index 9c6b2bd..f8e527e 100644 --- a/ceresdb/client.go +++ b/horaedb/client.go @@ -14,7 +14,7 @@ * limitations under the License. */ -package ceresdb +package horaedb import ( "context" diff --git a/ceresdb/client_impl.go b/horaedb/client_impl.go similarity index 97% rename from ceresdb/client_impl.go rename to horaedb/client_impl.go index 3b0e7ca..416c077 100644 --- a/ceresdb/client_impl.go +++ b/horaedb/client_impl.go @@ -14,7 +14,7 @@ * limitations under the License. */ -package ceresdb +package horaedb import ( "context" @@ -42,7 +42,7 @@ func newClient(endpoint string, routeMode RouteMode, opts options) (Client, erro func shouldClearRoute(err error) bool { if err != nil { - if ceresdbErr, ok := err.(*Error); ok && ceresdbErr.ShouldClearRoute() { + if unwrapErr, ok := err.(*Error); ok && unwrapErr.ShouldClearRoute() { return true } else if strings.Contains(err.Error(), "connection error") { // TODO: Find a better way to check if err means remote endpoint is down. diff --git a/ceresdb/code.go b/horaedb/code.go similarity index 95% rename from ceresdb/code.go rename to horaedb/code.go index 74334a6..9dcecac 100644 --- a/ceresdb/code.go +++ b/horaedb/code.go @@ -14,7 +14,7 @@ * limitations under the License. */ -package ceresdb +package horaedb import ( "errors" @@ -49,7 +49,7 @@ type Error struct { } func (e *Error) Error() string { - return fmt.Sprintf("ceresdb rpc failed, code:%d, err:%s", e.Code, e.Err) + return fmt.Sprintf("HoraeDB RPC failed, code:%d, err:%s", e.Code, e.Err) } // TODO: may retry in sdk while code is 302 or 310 diff --git a/ceresdb/options.go b/horaedb/options.go similarity index 99% rename from ceresdb/options.go rename to horaedb/options.go index 1a85817..7cfd267 100644 --- a/ceresdb/options.go +++ b/horaedb/options.go @@ -14,7 +14,7 @@ * limitations under the License. */ -package ceresdb +package horaedb import ( "io" diff --git a/ceresdb/point.go b/horaedb/point.go similarity index 96% rename from ceresdb/point.go rename to horaedb/point.go index 54bbb7e..db81924 100644 --- a/ceresdb/point.go +++ b/horaedb/point.go @@ -14,7 +14,7 @@ * limitations under the License. */ -package ceresdb +package horaedb import ( "fmt" @@ -88,7 +88,7 @@ func checkPoint(point Point) error { for tagK := range point.Tags { if isReservedColumn(tagK) { - return fmt.Errorf("tag name is reserved column name in ceresdb, name:%s", tagK) + return fmt.Errorf("tag name is reserved column name in horaedb, name:%s", tagK) } } diff --git a/ceresdb/route.go b/horaedb/route.go similarity index 99% rename from ceresdb/route.go rename to horaedb/route.go index 945ec4e..abd7898 100644 --- a/ceresdb/route.go +++ b/horaedb/route.go @@ -14,7 +14,7 @@ * limitations under the License. */ -package ceresdb +package horaedb import ( "fmt" diff --git a/ceresdb/rpc.go b/horaedb/rpc.go similarity index 99% rename from ceresdb/rpc.go rename to horaedb/rpc.go index b3a4689..27283ea 100644 --- a/ceresdb/rpc.go +++ b/horaedb/rpc.go @@ -14,7 +14,7 @@ * limitations under the License. */ -package ceresdb +package horaedb import ( "bytes" @@ -24,7 +24,7 @@ import ( "io" "sync" - "github.com/CeresDB/ceresdbproto/golang/pkg/storagepb" + "github.com/CeresDB/horaedbproto/golang/pkg/storagepb" "github.com/apache/arrow/go/arrow" "github.com/apache/arrow/go/arrow/array" "github.com/apache/arrow/go/arrow/ipc" diff --git a/ceresdb/types.go b/horaedb/types.go similarity index 99% rename from ceresdb/types.go rename to horaedb/types.go index 4c9a80f..22a70af 100644 --- a/ceresdb/types.go +++ b/horaedb/types.go @@ -14,7 +14,7 @@ * limitations under the License. */ -package ceresdb +package horaedb type RequestContext struct { Database string diff --git a/ceresdb/utils.go b/horaedb/utils.go similarity index 98% rename from ceresdb/utils.go rename to horaedb/utils.go index 55a3222..1304be5 100644 --- a/ceresdb/utils.go +++ b/horaedb/utils.go @@ -14,7 +14,7 @@ * limitations under the License. */ -package ceresdb +package horaedb import ( "fmt" diff --git a/ceresdb/value.go b/horaedb/value.go similarity index 99% rename from ceresdb/value.go rename to horaedb/value.go index cc72d24..ae9a989 100644 --- a/ceresdb/value.go +++ b/horaedb/value.go @@ -14,7 +14,7 @@ * limitations under the License. */ -package ceresdb +package horaedb type DataType int diff --git a/test/base_test.go b/test/base_test.go index 3d0930c..20ca234 100644 --- a/test/base_test.go +++ b/test/base_test.go @@ -23,14 +23,14 @@ import ( "testing" "time" - "github.com/CeresDB/ceresdb-client-go/ceresdb" + "github.com/CeresDB/horaedb-client-go/horaedb" "github.com/stretchr/testify/require" ) var endpoint = "127.0.0.1:8831" func init() { - if v := os.Getenv("CERESDB_ADDR"); v != "" { + if v := os.Getenv("HORAEDB_ADDR"); v != "" { endpoint = v } } @@ -42,43 +42,43 @@ func currentMS() int64 { func TestBaseWriteAndQuery(t *testing.T) { t.Skip("ignore local test") - client, err := ceresdb.NewClient(endpoint, ceresdb.Direct, ceresdb.WithDefaultDatabase("public")) - require.NoError(t, err, "init ceresdb client failed") + client, err := horaedb.NewClient(endpoint, horaedb.Direct, horaedb.WithDefaultDatabase("public")) + require.NoError(t, err, "init horaedb client failed") timestamp := currentMS() - testBaseWrite(t, client, "ceresdb_test", timestamp, 2) - testBaseQuery(t, client, "ceresdb_test", timestamp, 2) + testBaseWrite(t, client, "horaedb_test", timestamp, 2) + testBaseQuery(t, client, "horaedb_test", timestamp, 2) } func TestNoDatabaseSelected(t *testing.T) { t.Skip("ignore local test") - client, err := ceresdb.NewClient(endpoint, ceresdb.Direct) - require.NoError(t, err, "init ceresdb client failed") + client, err := horaedb.NewClient(endpoint, horaedb.Direct) + require.NoError(t, err, "init horaedb client failed") points, err := buildTablePoints("test", currentMS(), 3) require.NoError(t, err, "build points failed") require.Equal(t, len(points), 3, "build points failed, not expected") - req := ceresdb.WriteRequest{ + req := horaedb.WriteRequest{ Points: points, } _, err = client.Write(context.Background(), req) - require.ErrorIs(t, err, ceresdb.ErrNoDatabaseSelected) + require.ErrorIs(t, err, horaedb.ErrNoDatabaseSelected) } func TestDatabaseInRequest(t *testing.T) { t.Skip("ignore local test") - client, err := ceresdb.NewClient(endpoint, ceresdb.Direct, ceresdb.WithDefaultDatabase("not_exist_db")) - require.NoError(t, err, "init ceresdb client failed") + client, err := horaedb.NewClient(endpoint, horaedb.Direct, horaedb.WithDefaultDatabase("not_exist_db")) + require.NoError(t, err, "init horaedb client failed") - points, err := buildTablePoints("ceresdb_test", currentMS(), 3) + points, err := buildTablePoints("horaedb_test", currentMS(), 3) require.NoError(t, err, "build points failed") require.Equal(t, len(points), 3, "build points failed, not expected") - req := ceresdb.WriteRequest{ - ReqCtx: ceresdb.RequestContext{ + req := horaedb.WriteRequest{ + ReqCtx: horaedb.RequestContext{ Database: "public", }, Points: points, @@ -89,26 +89,26 @@ func TestDatabaseInRequest(t *testing.T) { } // nolint -func buildTablePoints(table string, timestamp int64, count int) ([]ceresdb.Point, error) { - points := make([]ceresdb.Point, 0, count) +func buildTablePoints(table string, timestamp int64, count int) ([]horaedb.Point, error) { + points := make([]horaedb.Point, 0, count) for idx := 0; idx < count; idx++ { - point, err := ceresdb.NewPointBuilder(table). + point, err := horaedb.NewPointBuilder(table). SetTimestamp(timestamp). - AddTag("tagA", ceresdb.NewStringValue(fmt.Sprintf("tagA:%s:%d", table, idx))). - AddTag("tagB", ceresdb.NewStringValue(fmt.Sprintf("tagB:%s:%d", table, idx))). - AddField("vbool", ceresdb.NewBoolValue(true)). - AddField("vstring", ceresdb.NewStringValue(fmt.Sprintf("row%d", idx))). - AddField("vfloat64", ceresdb.NewDoubleValue(0.64)). - AddField("vfloat32", ceresdb.NewFloatValue(0.32)). - AddField("vint64", ceresdb.NewInt64Value(-64)). - AddField("vint32", ceresdb.NewInt32Value(-32)). - AddField("vint16", ceresdb.NewInt16Value(-16)). - AddField("vint8", ceresdb.NewInt8Value(-8)). - AddField("vuint64", ceresdb.NewUint64Value(64)). - AddField("vuint32", ceresdb.NewUint32Value(32)). - AddField("vuint16", ceresdb.NewUint16Value(16)). - AddField("vuint8", ceresdb.NewUint8Value(8)). - AddField("vbinary", ceresdb.NewVarbinaryValue([]byte{1, 2, 3})). + AddTag("tagA", horaedb.NewStringValue(fmt.Sprintf("tagA:%s:%d", table, idx))). + AddTag("tagB", horaedb.NewStringValue(fmt.Sprintf("tagB:%s:%d", table, idx))). + AddField("vbool", horaedb.NewBoolValue(true)). + AddField("vstring", horaedb.NewStringValue(fmt.Sprintf("row%d", idx))). + AddField("vfloat64", horaedb.NewDoubleValue(0.64)). + AddField("vfloat32", horaedb.NewFloatValue(0.32)). + AddField("vint64", horaedb.NewInt64Value(-64)). + AddField("vint32", horaedb.NewInt32Value(-32)). + AddField("vint16", horaedb.NewInt16Value(-16)). + AddField("vint8", horaedb.NewInt8Value(-8)). + AddField("vuint64", horaedb.NewUint64Value(64)). + AddField("vuint32", horaedb.NewUint32Value(32)). + AddField("vuint16", horaedb.NewUint16Value(16)). + AddField("vuint8", horaedb.NewUint8Value(8)). + AddField("vbinary", horaedb.NewVarbinaryValue([]byte{1, 2, 3})). Build() if err != nil { return nil, err @@ -119,12 +119,12 @@ func buildTablePoints(table string, timestamp int64, count int) ([]ceresdb.Point } // nolint -func testBaseWrite(t *testing.T, client ceresdb.Client, table string, timestamp int64, count int) { +func testBaseWrite(t *testing.T, client horaedb.Client, table string, timestamp int64, count int) { points, err := buildTablePoints(table, timestamp, count) require.NoError(t, err, "build points failed") require.Equal(t, len(points), count, "build points failed, not expected") - req := ceresdb.WriteRequest{ + req := horaedb.WriteRequest{ Points: points, } resp, err := client.Write(context.Background(), req) @@ -136,8 +136,8 @@ func testBaseWrite(t *testing.T, client ceresdb.Client, table string, timestamp } // nolint -func testBaseQuery(t *testing.T, client ceresdb.Client, table string, timestamp int64, count int) { - req := ceresdb.SQLQueryRequest{ +func testBaseQuery(t *testing.T, client horaedb.Client, table string, timestamp int64, count int) { + req := horaedb.SQLQueryRequest{ Tables: []string{table}, SQL: fmt.Sprintf("select * from %s where timestamp = %d", table, timestamp), } diff --git a/test/cluster_test.go b/test/cluster_test.go index 3150dc9..f37802b 100644 --- a/test/cluster_test.go +++ b/test/cluster_test.go @@ -21,14 +21,14 @@ import ( "os" "testing" - "github.com/CeresDB/ceresdb-client-go/ceresdb" + "github.com/CeresDB/horaedb-client-go/horaedb" "github.com/stretchr/testify/require" ) var clusterEndpoint = "127.0.0.1:8831" func init() { - if v := os.Getenv("CERESDB_CLUSTER_ADDR"); v != "" { + if v := os.Getenv("HORAEDB_CLUSTER_ADDR"); v != "" { clusterEndpoint = v } } @@ -36,22 +36,22 @@ func init() { func TestClusterMultiWriteAndQuery(t *testing.T) { t.Skip("ignore local test") - client, err := ceresdb.NewClient(clusterEndpoint, ceresdb.Direct, - ceresdb.EnableLoggerDebug(true), + client, err := horaedb.NewClient(clusterEndpoint, horaedb.Direct, + horaedb.EnableLoggerDebug(true), ) - require.NoError(t, err, "init ceresdb client failed") + require.NoError(t, err, "init horaedb client failed") timestamp := currentMS() - table1Points, err := buildTablePoints("ceresdb_route_test1", timestamp, 2) + table1Points, err := buildTablePoints("horaedb_route_test1", timestamp, 2) require.NoError(t, err, "build table1 points failed") - table2Points, err := buildTablePoints("ceresdb_route_test2", timestamp, 3) + table2Points, err := buildTablePoints("horaedb_route_test2", timestamp, 3) require.NoError(t, err, "build table2 points failed") table1Points = append(table1Points, table2Points...) - req := ceresdb.WriteRequest{ + req := horaedb.WriteRequest{ Points: table1Points, } resp, err := client.Write(context.Background(), req) @@ -59,7 +59,7 @@ func TestClusterMultiWriteAndQuery(t *testing.T) { require.Equal(t, resp.Success, uint32(5), "write success value is not expected") - testBaseQuery(t, client, "ceresdb_route_test1", timestamp, 2) - testBaseQuery(t, client, "ceresdb_route_test2", timestamp, 3) + testBaseQuery(t, client, "horaedb_route_test1", timestamp, 2) + testBaseQuery(t, client, "horaedb_route_test2", timestamp, 3) t.Log("multi table write is paas") } diff --git a/test/point_test.go b/test/point_test.go index f52434c..9f8068d 100644 --- a/test/point_test.go +++ b/test/point_test.go @@ -19,15 +19,15 @@ package test import ( "testing" - "github.com/CeresDB/ceresdb-client-go/ceresdb" + "github.com/CeresDB/horaedb-client-go/horaedb" "github.com/stretchr/testify/require" ) func TestPointBuilder(t *testing.T) { - point, err := ceresdb.NewPointBuilder("test"). + point, err := horaedb.NewPointBuilder("test"). SetTimestamp(currentMS()). - AddTag("tagA", ceresdb.NewStringValue("a")). - AddField("filedA", ceresdb.NewFloatValue(0.24)). + AddTag("tagA", horaedb.NewStringValue("a")). + AddField("filedA", horaedb.NewFloatValue(0.24)). Build() require.NoError(t, err) @@ -37,48 +37,48 @@ func TestPointBuilder(t *testing.T) { } func TestPointBuilderWithEmptyTableErr(t *testing.T) { - _, err := ceresdb.NewPointBuilder(""). + _, err := horaedb.NewPointBuilder(""). SetTimestamp(currentMS()). - AddTag("tagA", ceresdb.NewStringValue("a")). - AddField("filedA", ceresdb.NewFloatValue(0.24)). + AddTag("tagA", horaedb.NewStringValue("a")). + AddField("filedA", horaedb.NewFloatValue(0.24)). Build() - require.ErrorIs(t, err, ceresdb.ErrPointEmptyTable) + require.ErrorIs(t, err, horaedb.ErrPointEmptyTable) } func TestPointBuilderWithEmptyTimestampErr(t *testing.T) { - _, err := ceresdb.NewPointBuilder("test"). - AddTag("tagA", ceresdb.NewStringValue("a")). - AddField("filedA", ceresdb.NewFloatValue(0.24)). + _, err := horaedb.NewPointBuilder("test"). + AddTag("tagA", horaedb.NewStringValue("a")). + AddField("filedA", horaedb.NewFloatValue(0.24)). Build() - require.ErrorIs(t, err, ceresdb.ErrPointEmptyTimestamp) + require.ErrorIs(t, err, horaedb.ErrPointEmptyTimestamp) } func TestPointBuilderWithEmptyTagsErr(t *testing.T) { - _, err := ceresdb.NewPointBuilder("test"). + _, err := horaedb.NewPointBuilder("test"). SetTimestamp(currentMS()). - AddField("filedA", ceresdb.NewFloatValue(0.24)). + AddField("filedA", horaedb.NewFloatValue(0.24)). Build() - require.ErrorIs(t, err, ceresdb.ErrPointEmptyTags) + require.ErrorIs(t, err, horaedb.ErrPointEmptyTags) } func TestPointBuilderWithEmptyFieldsErr(t *testing.T) { - _, err := ceresdb.NewPointBuilder("test"). + _, err := horaedb.NewPointBuilder("test"). SetTimestamp(currentMS()). - AddTag("tagA", ceresdb.NewStringValue("a")). + AddTag("tagA", horaedb.NewStringValue("a")). Build() - require.ErrorIs(t, err, ceresdb.ErrPointEmptyFields) + require.ErrorIs(t, err, horaedb.ErrPointEmptyFields) } func TestPointBuilderWithReservedColumn(t *testing.T) { - _, err := ceresdb.NewPointBuilder("test"). + _, err := horaedb.NewPointBuilder("test"). SetTimestamp(currentMS()). - AddTag("tsid", ceresdb.NewStringValue("a")). - AddField("filedA", ceresdb.NewFloatValue(0.24)). + AddTag("tsid", horaedb.NewStringValue("a")). + AddField("filedA", horaedb.NewFloatValue(0.24)). Build() - require.ErrorContains(t, err, "tag name is reserved column name in ceresdb") + require.ErrorContains(t, err, "tag name is reserved column name in horaedb") } diff --git a/test/route_test.go b/test/route_test.go index 7d3ad90..6ce30d5 100644 --- a/test/route_test.go +++ b/test/route_test.go @@ -20,34 +20,34 @@ import ( "testing" "time" - "github.com/CeresDB/ceresdb-client-go/ceresdb" + "github.com/CeresDB/horaedb-client-go/horaedb" "github.com/stretchr/testify/require" ) func TestRouteGc(t *testing.T) { t.Skip("ignore local test") - client, err := ceresdb.NewClient(clusterEndpoint, ceresdb.Direct, - ceresdb.EnableLoggerDebug(true), - ceresdb.WithRouteMaxCacheSize(3), + client, err := horaedb.NewClient(clusterEndpoint, horaedb.Direct, + horaedb.EnableLoggerDebug(true), + horaedb.WithRouteMaxCacheSize(3), ) - require.NoError(t, err, "init ceresdb client failed") + require.NoError(t, err, "init horaedb client failed") timestamp := currentMS() - testBaseWrite(t, client, "ceresdb_route_test1", timestamp, 1) + testBaseWrite(t, client, "horaedb_route_test1", timestamp, 1) time.Sleep(time.Second) - testBaseWrite(t, client, "ceresdb_route_test2", timestamp, 2) + testBaseWrite(t, client, "horaedb_route_test2", timestamp, 2) time.Sleep(time.Second) - testBaseWrite(t, client, "ceresdb_route_test3", timestamp, 3) - testBaseQuery(t, client, "ceresdb_route_test2", timestamp, 2) + testBaseWrite(t, client, "horaedb_route_test3", timestamp, 3) + testBaseQuery(t, client, "horaedb_route_test2", timestamp, 2) time.Sleep(time.Second) - testBaseWrite(t, client, "ceresdb_route_test4", timestamp, 4) + testBaseWrite(t, client, "horaedb_route_test4", timestamp, 4) time.Sleep(time.Second) - testBaseWrite(t, client, "ceresdb_route_test5", timestamp, 5) + testBaseWrite(t, client, "horaedb_route_test5", timestamp, 5) // Under single-threaded test conditions, - // the expected result is that the routes of ceresdb_route_test1 and table ceresdb_route_test3 are cleaned up + // the expected result is that the routes of horaedb_route_test1 and table horaedb_route_test3 are cleaned up time.Sleep(12 * time.Second) } @@ -55,12 +55,12 @@ func TestRouteGc(t *testing.T) { func TestRouteProxy(t *testing.T) { t.Skip("ignore local test") - client, err := ceresdb.NewClient(clusterEndpoint, ceresdb.Proxy, - ceresdb.EnableLoggerDebug(true), - ceresdb.WithRouteMaxCacheSize(3), + client, err := horaedb.NewClient(clusterEndpoint, horaedb.Proxy, + horaedb.EnableLoggerDebug(true), + horaedb.WithRouteMaxCacheSize(3), ) - require.NoError(t, err, "init ceresdb client failed") + require.NoError(t, err, "init horaedb client failed") timestamp := currentMS() - testBaseWrite(t, client, "ceresdb_route_test1", timestamp, 1) + testBaseWrite(t, client, "horaedb_route_test1", timestamp, 1) } From 416a5f8e4f5e8ad57238465b0bd73a3ad35a8df6 Mon Sep 17 00:00:00 2001 From: tison Date: Wed, 29 Nov 2023 23:17:14 +0800 Subject: [PATCH 4/4] f Makefile Signed-off-by: tison --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 8d50457..58ca699 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ lint: revive -formatter friendly -config revive.toml ./... check-license: - docker run --rm -v $(pwd):/github/workspace ghcr.io/korandoru/hawkeye-native:v3 check + docker run --rm -v $(shell pwd):/github/workspace ghcr.io/korandoru/hawkeye-native:v3 check test: go test -timeout 5m -race -cover ./...