Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] sessions/sessiondb/badger package not compatible with badger v1.6.0 #1367

Open
bastengao opened this issue Sep 28, 2019 · 3 comments

Comments

@bastengao
Copy link

commented Sep 28, 2019

Describe the bug

import (
	"github.com/kataras/iris"
	"github.com/kataras/iris/sessions"
	"github.com/kataras/iris/sessions/sessiondb/badger"
)

func init() {
	db, err := badger.New("tmp/badger_data")
	if err != nil {
		panic(err)
	}
	sess.UseDatabase(db)
}

go.mod like this

require (
	github.com/dgraph-io/badger v1.6.0 // indirect
	github.com/kataras/iris v11.1.1+incompatible
        // ...
)

run go run or go build will print these errors

# github.com/kataras/iris/sessions/sessiondb/badger
../../../../go/pkg/mod/github.com/kataras/iris@v11.1.1+incompatible/sessions/sessiondb/badger/database.go:56:6: opts.Dir undefined (type func(string) badger.Options has no field or method Dir)
../../../../go/pkg/mod/github.com/kataras/iris@v11.1.1+incompatible/sessions/sessiondb/badger/database.go:57:6: opts.ValueDir undefined (type func(string) badger.Options has no field or method ValueDir)
../../../../go/pkg/mod/github.com/kataras/iris@v11.1.1+incompatible/sessions/sessiondb/badger/database.go:59:29: cannot use opts (type func(string) badger.Options) as type badger.Options in argument to badger.Open
../../../../go/pkg/mod/github.com/kataras/iris@v11.1.1+incompatible/sessions/sessiondb/badger/database.go:81:18: too many arguments in call to txn.Commit
	have (nil)
	want ()
../../../../go/pkg/mod/github.com/kataras/iris@v11.1.1+incompatible/sessions/sessiondb/badger/database.go:94:13: txn.SetWithTTL undefined (type *badger.Txn has no field or method SetWithTTL)
../../../../go/pkg/mod/github.com/kataras/iris@v11.1.1+incompatible/sessions/sessiondb/badger/database.go:132:13: txn.SetWithTTL undefined (type *badger.Txn has no field or method SetWithTTL)
../../../../go/pkg/mod/github.com/kataras/iris@v11.1.1+incompatible/sessions/sessiondb/badger/database.go:154:19: assignment mismatch: 2 variables but item.Value returns 1 values
../../../../go/pkg/mod/github.com/kataras/iris@v11.1.1+incompatible/sessions/sessiondb/badger/database.go:154:32: not enough arguments in call to item.Value
	have ()
	want (func([]byte) error)
../../../../go/pkg/mod/github.com/kataras/iris@v11.1.1+incompatible/sessions/sessiondb/badger/database.go:195:19: assignment mismatch: 2 variables but item.Value returns 1 values
../../../../go/pkg/mod/github.com/kataras/iris@v11.1.1+incompatible/sessions/sessiondb/badger/database.go:195:32: not enough arguments in call to item.Value
	have ()
	want (func([]byte) error)
../../../../go/pkg/mod/github.com/kataras/iris@v11.1.1+incompatible/sessions/sessiondb/badger/database.go:195:19: too many errors

Expected behavior
Use badger as session db correctly.

Desktop (please complete the following information):

  • OS: macOS Mojave

Additional context
go version 1.13

I see badger 1.6.0 contains break changes https://github.com/dgraph-io/badger/releases/tag/v1.6.0, it is not compatible with sessions/sessiondb/badger package.

When I change badger version to v1.5.5 in go.mod file, it works.

require (
	github.com/dgraph-io/badger v1.5.5 // indirect
	github.com/kataras/iris v11.1.1+incompatible
        // ...
)
@kataras

This comment has been minimized.

Copy link
Owner

commented Sep 28, 2019

@bastengao Iris is compatible with latest badger, don't worry. The problem here is that you are using an older version. Just go get github.com/kataras/iris@v11.2.8 https://github.com/kataras/iris/wiki/Installation

@kataras kataras removed the type:bug label Sep 28, 2019
@kataras kataras removed their assignment Sep 28, 2019
@bastengao

This comment has been minimized.

Copy link
Author

commented Sep 28, 2019

I tried it, but produced this issue #1355

@kataras

This comment has been minimized.

Copy link
Owner

commented Oct 3, 2019

@bastengao Please vote at: #1370

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.