|
|
@@ -16,15 +16,15 @@ const (
|
|
|
)
|
|
|
|
|
|
var (
|
|
|
- dataSourceMap = map[string]any{
|
|
|
- "type": "postgres",
|
|
|
- "user_name": "test",
|
|
|
- "password": "123456",
|
|
|
- "address": "localhost",
|
|
|
- "port": "30432",
|
|
|
- "database": "test",
|
|
|
- "max_connections": 40,
|
|
|
- "max_idle_connections": 10,
|
|
|
+ dataSourceSpec = sdk.DataSourceDatabaseSpec{
|
|
|
+ Type: sdk.DataSourceDatabaseTypePostgres,
|
|
|
+ UserName: "test",
|
|
|
+ Password: "123456",
|
|
|
+ Address: "localhost",
|
|
|
+ Port: "30432",
|
|
|
+ Database: "test",
|
|
|
+ MaxConnections: 40,
|
|
|
+ MaxIdleConnections: 10,
|
|
|
}
|
|
|
|
|
|
dataContainerSpec = sdk.DataContainerDatabaseSpec{
|
|
|
@@ -65,7 +65,7 @@ func main() {
|
|
|
err := sdk.InitInstance(token, baseUrl, namespace, &sdk.DataSourceOption{
|
|
|
Name: dataSource,
|
|
|
Type: sdk.DataSourceTypeDatabase,
|
|
|
- Spec: dataSourceMap,
|
|
|
+ Spec: dataSourceSpec.ToMap(),
|
|
|
})
|
|
|
if err != nil {
|
|
|
panic(err)
|