1+ // Copyright 2025 The DBQ Authors
2+ //
3+ // Licensed under the Apache License, Version 2.0 (the "License");
4+ // you may not use this file except in compliance with the License.
5+ // You may obtain a copy of the License at
6+ //
7+ // http://www.apache.org/licenses/LICENSE-2.0
8+ //
9+ // Unless required by applicable law or agreed to in writing, software
10+ // distributed under the License is distributed on an "AS IS" BASIS,
11+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+ // See the License for the specific language governing permissions and
13+ // limitations under the License.
14+
115package internal
216
317import (
@@ -17,11 +31,11 @@ type DbqCliApp interface {
1731 PingDataSource (srcId string ) (string , error )
1832 ImportDatasets (srcId string , filter string ) ([]string , error )
1933 ProfileDataset (srcId string , dataset string , sample bool ) (* dbqcore.TableMetrics , error )
34+ RunCheck (check * dbqcore.Check , dataSource * dbqcore.DataSource , dataset string , defaultWhere string ) (bool , string , error )
2035 GetDbqConfig () * dbqcore.DbqConfig
2136 SaveDbqConfig () error
22- FindDataSourceById (srcId string ) * dbqcore.DataSource
23- RunCheck (check * dbqcore.Check , dataSource * dbqcore.DataSource , dataset string , defaultWhere string ) (bool , string , error )
2437 SetLogLevel (level slog.Level )
38+ FindDataSourceById (srcId string ) * dbqcore.DataSource
2539}
2640
2741type DbqAppImpl struct {
@@ -57,6 +71,7 @@ func (app *DbqAppImpl) PingDataSource(srcId string) (string, error) {
5771
5872func (app * DbqAppImpl ) ImportDatasets (srcId string , filter string ) ([]string , error ) {
5973 var dataSource = app .FindDataSourceById (srcId )
74+
6075 cnn , err := getDbqConnector (* dataSource )
6176 if err != nil {
6277 return []string {}, err
@@ -67,10 +82,12 @@ func (app *DbqAppImpl) ImportDatasets(srcId string, filter string) ([]string, er
6782
6883func (app * DbqAppImpl ) ProfileDataset (srcId string , dataset string , sample bool ) (* dbqcore.TableMetrics , error ) {
6984 var dataSource = app .FindDataSourceById (srcId )
85+
7086 cnn , err := getDbqConnector (* dataSource )
7187 if err != nil {
7288 return nil , err
7389 }
90+
7491 return cnn .ProfileDataset (dataset , sample )
7592}
7693
0 commit comments