From c591b7dfecc66d1581f60d0ee701bd2eafd2a934 Mon Sep 17 00:00:00 2001 From: Adrien Aury <44274230+adrienaury@users.noreply.github.com> Date: Mon, 11 Dec 2023 17:37:22 +0100 Subject: [PATCH] feat: wip! analyse v2 --- go.mod | 2 +- go.sum | 4 ++-- pkg/analyse/driver.go | 16 ++++++---------- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/go.mod b/go.mod index 38cb319b..fe70231e 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/adrienaury/zeromdc v0.0.0-20221116212822-6a366c26ee61 github.com/awalterschulze/gographviz v2.0.3+incompatible github.com/cgi-fr/jsonline v0.5.0 - github.com/cgi-fr/rimo v0.3.0 + github.com/cgi-fr/rimo v0.4.0 github.com/docker/docker-credential-helpers v0.8.0 github.com/go-sql-driver/mysql v1.7.1 github.com/gorilla/mux v1.8.1 diff --git a/go.sum b/go.sum index 2234f14c..80637184 100644 --- a/go.sum +++ b/go.sum @@ -70,8 +70,8 @@ github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cgi-fr/jsonline v0.5.0 h1:UFLDJauppXLXWlUXFgAKqlZaKt0g1gRq3tLJUj95ohY= github.com/cgi-fr/jsonline v0.5.0/go.mod h1:2eo1zPtPXeGiGCEI+Y2m0GYlQgmRikVeQOwLwOZtWXQ= -github.com/cgi-fr/rimo v0.3.0 h1:l65zqZ1RgYneWJF7nlZ91MFGmSv3qkosoYumgmIUYLg= -github.com/cgi-fr/rimo v0.3.0/go.mod h1:ODmtunptLWlHpLvGM5DFNOI3ykmUh1joAfWRGqSXN4M= +github.com/cgi-fr/rimo v0.4.0 h1:swgGEHOk3OoL2+c/qzNq8vS1V55LUSimIwT1O6UhidA= +github.com/cgi-fr/rimo v0.4.0/go.mod h1:ODmtunptLWlHpLvGM5DFNOI3ykmUh1joAfWRGqSXN4M= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= diff --git a/pkg/analyse/driver.go b/pkg/analyse/driver.go index 3ba9d091..0e727e9d 100644 --- a/pkg/analyse/driver.go +++ b/pkg/analyse/driver.go @@ -50,6 +50,9 @@ func NewDriver(datasource DataSource, exf ExtractorFactory, w Writer) *Driver { } } +func (d *Driver) Open() error { return nil } +func (d *Driver) Close() error { return nil } + // Analyse performs statistics on datasource. func (d *Driver) Analyse() error { return d.analyser.AnalyseBase(d, d) //nolint:wrapcheck @@ -90,21 +93,14 @@ func (d *Driver) Next() bool { return d.curTable < len(d.tables) && len(d.columns) > 0 } -//nolint:ireturn -func (d *Driver) Col() (rimo.ColReader, error) { - vi := &ValueIterator{ +func (d *Driver) Col() (rimo.ColReader, error) { //nolint:ireturn + return &ValueIterator{ Extractor: d.exf.New(d.tables[d.curTable], d.columns[d.curColumn]), tableName: d.tables[d.curTable], colName: d.columns[d.curColumn], nextValue: nil, err: nil, - } - - if err := vi.Open(); err != nil { - return nil, err - } - - return vi, nil + }, nil } func (d *Driver) Export(base *model.Base) error {