From 61e838f0bdaa315b85cdc225bb70feec46d6a8ad Mon Sep 17 00:00:00 2001 From: Fritz Larco Date: Wed, 2 Oct 2024 08:10:48 -0300 Subject: [PATCH] clean up, update go.mod --- core/dbio/connection/connection_discover.go | 29 --------------------- core/dbio/iop/datatype_test.go | 2 +- core/sling/task_run_write.go | 2 +- go.mod | 3 ++- go.sum | 2 ++ 5 files changed, 6 insertions(+), 32 deletions(-) diff --git a/core/dbio/connection/connection_discover.go b/core/dbio/connection/connection_discover.go index 2c4a59444..ed3ee03d2 100644 --- a/core/dbio/connection/connection_discover.go +++ b/core/dbio/connection/connection_discover.go @@ -2,7 +2,6 @@ package connection import ( "context" - "sort" "strings" "time" @@ -12,8 +11,6 @@ import ( "github.com/slingdata-io/sling-cli/core/dbio/database" "github.com/slingdata-io/sling-cli/core/dbio/filesys" "github.com/slingdata-io/sling-cli/core/dbio/iop" - "github.com/slingdata-io/sling-cli/core/env" - "github.com/spf13/cast" ) func (c *Connection) Test() (ok bool, err error) { @@ -244,29 +241,3 @@ func (c *Connection) Discover(opt *DiscoverOptions) (ok bool, nodes filesys.File return } - -func EnvFileConnectionEntries(ef env.EnvFile, sourceName string) (entries ConnEntries, err error) { - m := g.M() - if err = g.JSONConvert(ef, &m); err != nil { - return entries, g.Error(err) - } - - connsMap := map[string]ConnEntry{} - profileConns, err := ReadConnections(m) - for _, conn := range profileConns { - c := ConnEntry{ - Name: strings.ToUpper(conn.Info().Name), - Description: conn.Type.NameLong(), - Source: sourceName, - Connection: conn, - } - connsMap[c.Name] = c - } - - entries = lo.Values(connsMap) - sort.Slice(entries, func(i, j int) bool { - return cast.ToString(entries[i].Name) < cast.ToString(entries[j].Name) - }) - - return -} diff --git a/core/dbio/iop/datatype_test.go b/core/dbio/iop/datatype_test.go index 7addf806e..d9a50b675 100755 --- a/core/dbio/iop/datatype_test.go +++ b/core/dbio/iop/datatype_test.go @@ -64,7 +64,7 @@ func initProcessRow(name string) (columns []Column, row []interface{}) { } else if name == "int64" { row = []interface{}{int64(48714719874194)} } else if name == "string" { - row = []interface{}{g.RandString(g.AplhanumericRunes, 1000)} + row = []interface{}{g.RandString(g.AlphaNumericRunes, 1000)} } else if name == "timestamp" || name == "timestampz" { row = []interface{}{time.Now()} // row = []interface{}{"17-OCT-20 07.01.59.000000 PM"} diff --git a/core/sling/task_run_write.go b/core/sling/task_run_write.go index ef7a1112c..28aee7ed0 100644 --- a/core/sling/task_run_write.go +++ b/core/sling/task_run_write.go @@ -169,7 +169,7 @@ func (t *TaskExecution) WriteToDb(cfg *Config, df *iop.Dataflow, tgtConn databas } // some weird column / commit error, not picking up latest columns - suffix2 := g.RandString(g.NumericRunes, 1) + g.RandString(g.AplhanumericRunes, 1) + suffix2 := g.RandString(g.NumericRunes, 1) + g.RandString(g.AlphaNumericRunes, 1) suffix2 = lo.Ternary( tgtConn.GetType().DBNameUpperCase(), strings.ToUpper(suffix2), diff --git a/go.mod b/go.mod index aff1d872b..8031eee50 100644 --- a/go.mod +++ b/go.mod @@ -22,7 +22,7 @@ require ( github.com/dustin/go-humanize v1.0.1 github.com/fatih/color v1.17.0 github.com/flarco/bigquery v0.0.9 - github.com/flarco/g v0.1.122 + github.com/flarco/g v0.1.123 github.com/getsentry/sentry-go v0.27.0 github.com/go-sql-driver/mysql v1.8.1 github.com/gobwas/glob v0.2.3 @@ -192,6 +192,7 @@ require ( github.com/montanaflynn/stats v0.7.0 // indirect github.com/mtibben/percent v0.2.1 // indirect github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect + github.com/nalgeon/redka v0.5.2 // indirect github.com/nats-io/nats.go v1.36.0 // indirect github.com/nats-io/nkeys v0.4.7 // indirect github.com/nats-io/nuid v1.0.1 // indirect diff --git a/go.sum b/go.sum index f7a11f0ec..bff71042e 100644 --- a/go.sum +++ b/go.sum @@ -474,6 +474,8 @@ github.com/mtibben/percent v0.2.1 h1:5gssi8Nqo8QU/r2pynCm+hBQHpkB/uNK7BJCFogWdzs github.com/mtibben/percent v0.2.1/go.mod h1:KG9uO+SZkUp+VkRHsCdYQV3XSZrrSpR3O9ibNBTZrns= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+SVif2QVs3tOP0zanoHgBEVAwHxUSIzRqU= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/nalgeon/redka v0.5.2 h1:CX71v88kYj55EwJ10zq7U2eJdH0xcLAIjvKFvUMoM0o= +github.com/nalgeon/redka v0.5.2/go.mod h1:vLxjY3XS9IwBID2YEFWeeMiN4Ar/DtKd4JW62JTAxuU= github.com/nats-io/nats.go v1.36.0 h1:suEUPuWzTSse/XhESwqLxXGuj8vGRuPRoG7MoRN/qyU= github.com/nats-io/nats.go v1.36.0/go.mod h1:Ubdu4Nh9exXdSz0RVWRFBbRfrbSxOYd26oF0wkWclB8= github.com/nats-io/nkeys v0.4.7 h1:RwNJbbIdYCoClSDNY7QVKZlyb/wfT6ugvFCiKy6vDvI=