Skip to content

Commit

Permalink
feat: wip! analyse v2
Browse files Browse the repository at this point in the history
  • Loading branch information
adrienaury committed Dec 11, 2023
1 parent d16372a commit c591b7d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
16 changes: 6 additions & 10 deletions pkg/analyse/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit c591b7d

Please sign in to comment.