Skip to content

Commit 199a425

Browse files
committed
style:fix import order and add license header
1 parent c2ec703 commit 199a425

File tree

6 files changed

+54
-21
lines changed

6 files changed

+54
-21
lines changed

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,5 @@ require (
3535
google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect
3636
google.golang.org/grpc v1.55.0 // indirect
3737
google.golang.org/protobuf v1.30.0
38+
gopkg.in/yaml.v2 v2.4.0
3839
)

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0
7272
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
7373
google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng=
7474
google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
75+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
7576
gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8=
7677
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
78+
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
7779
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=

store/postgresql/config.go

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,33 +18,34 @@
1818
package postgresql
1919

2020
import (
21-
"encoding/json"
2221
"fmt"
2322
"io/ioutil"
2423
"os"
24+
25+
"gopkg.in/yaml.v2"
2526
)
2627

2728
type Pgsql struct {
28-
//Pgsql账号
29+
// Pgsql账号
2930
Username string `json:"username"`
30-
//Pgsql密码
31+
// Pgsql密码
3132
Password string `json:"password"`
32-
//Pgsql地址
33+
// Pgsql地址
3334
Address string `json:"address"`
34-
//Pgsql端口
35+
// Pgsql端口
3536
Port int `json:"port"`
36-
//数据库名称
37+
// 数据库名称
3738
Database string `json:"database"`
38-
//表名称
39+
// 表名称
3940
Table string `json:"table"`
40-
//账号字段名称
41+
// 账号字段名称
4142
AccountField string `json:"accountField"`
42-
//密码字段名称
43+
// 密码字段名称
4344
PwdField string `json:"pwdField"`
4445
}
4546

4647
// 配置文件路径
47-
var ConfigPath string = "config/config.json"
48+
var ConfigPath string = "config/config.yaml"
4849

4950
// postgresql配置信息缓存
5051
var PgsqlData *Pgsql
@@ -64,7 +65,7 @@ func Init() {
6465
os.Exit(1)
6566
}
6667
//使用json转换至config对象中
67-
err = json.Unmarshal(bytes, PgsqlData)
68+
err = yaml.Unmarshal(bytes, PgsqlData)
6869
if err != nil {
6970
fmt.Println("json unmarshal:", err)
7071
os.Exit(1)

store/postgresql/config.json

Lines changed: 0 additions & 10 deletions
This file was deleted.

store/postgresql/config.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Tencent is pleased to support the open source community by making Polaris available.
2+
#
3+
# Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
4+
#
5+
# Licensed under the BSD 3-Clause License (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# https: //opensource.org/licenses/BSD-3-Clause
10+
#
11+
# Unless required by applicable law or agreed to in writing, software distributed
12+
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
13+
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
14+
# specific language governing permissions and limitations under the License.
15+
16+
username: "***"
17+
password: "*********"
18+
address: localhost
19+
port: 5432
20+
database: "***"
21+
table: "***"
22+
accountField: "***"
23+
pwdField: "***"

store/postgresql/scripts/polaris_server.sql

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* Tencent is pleased to support the open source community by making Polaris available.
3+
*
4+
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
5+
*
6+
* Licensed under the BSD 3-Clause License (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* https://opensource.org/licenses/BSD-3-Clause
11+
*
12+
* Unless required by applicable law or agreed to in writing, software distributed
13+
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
14+
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
15+
* specific language governing permissions and limitations under the License.
16+
*/
117
/*
218
Navicat Premium Data Transfer
319

0 commit comments

Comments
 (0)