Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
judell committed Sep 22, 2023
1 parent ee27069 commit 45dd095
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 30 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ go 1.19

require (
github.com/alexbrainman/odbc v0.0.0-20230814102256-1421b829acc9
github.com/turbot/go-kit v0.6.0
github.com/turbot/steampipe-plugin-sdk/v5 v5.5.0
)

Expand Down Expand Up @@ -79,7 +80,6 @@ require (
github.com/spf13/cast v1.5.0 // indirect
github.com/stevenle/topsort v0.2.0 // indirect
github.com/tkrajina/go-reflector v0.5.6 // indirect
github.com/turbot/go-kit v0.6.0 // indirect
github.com/ulikunitz/xz v0.5.10 // indirect
github.com/zclconf/go-cty v1.12.1 // indirect
go.opencensus.io v0.23.0 // indirect
Expand Down
12 changes: 0 additions & 12 deletions odbc/connection_config.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package odbc

import (
"strings"

"github.com/turbot/steampipe-plugin-sdk/v5/plugin"
"github.com/turbot/steampipe-plugin-sdk/v5/plugin/schema"
)
Expand Down Expand Up @@ -30,13 +28,3 @@ func GetConfig(connection *plugin.Connection) odbcConfig {
config, _ := connection.Config.(odbcConfig)
return config
}

// Additional helper function to split data source and table from a string
func splitDataSourceAndTable(s string) (string, string) {
parts := strings.SplitN(s, ":", 2)
if len(parts) != 2 {
// Handle this case, maybe return an error or default values
return "", ""
}
return parts[0], parts[1]
}
8 changes: 2 additions & 6 deletions odbc/table_code_odbc.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,13 @@ package odbc
import (
"context"

//"encoding/json"
"fmt"
//"os"
"strings"

"database/sql"
_ "github.com/alexbrainman/odbc"

"github.com/turbot/go-kit/helpers"

//"fmt"
_ "github.com/alexbrainman/odbc"
"github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto"
"github.com/turbot/steampipe-plugin-sdk/v5/plugin"
"github.com/turbot/steampipe-plugin-sdk/v5/plugin/transform"
Expand Down Expand Up @@ -65,7 +61,7 @@ func tableODBC(ctx context.Context, connection *plugin.Connection) (*plugin.Tabl

return &plugin.Table{
Name: strings.ToLower(dsn) + "_" + tablename,
Description: dsn,
Description: dsn + ":" + tablename,
List: &plugin.ListConfig{
Hydrate: listODBC,
},
Expand Down
20 changes: 9 additions & 11 deletions odbc/utils.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
package odbc

// Convert column index number to corresponding letter
// For example, 1:a, 2:b, 27:aa, 55:bc
func intToLetters(colIndex int) (letter string) {
colIndex--
if firstLetter := colIndex / 26; firstLetter > 0 {
letter += intToLetters(firstLetter)
letter += string(rune('a' + colIndex%26))
} else {
letter += string(rune('a' + colIndex))
}
import (
"strings"
)

return
func splitDataSourceAndTable(s string) (string, string) {
parts := strings.SplitN(s, ":", 2)
if len(parts) != 2 {
return "", ""
}
return parts[0], parts[1]
}

0 comments on commit 45dd095

Please sign in to comment.