You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to manipulate RQLite through beego/orm. I
add the blank import _ "github.com/rqlite/gorqlite/stdlib"
excute orm.RegisterDataBase("default", "rqlite", "http://127.0.0.1:4001/?charset=utf8")
and it works fine with simple CRUD operations.
However, RQLite supports transactions only in a single batch. One can group many statements into a single transaction, but one must submit them as a single unit. One cannot start a transaction, send some statements, come back later and submit some more, and then later commit.
I noticed that beego/orm supports 2 kinds of transactions, the first is:
// Beego will manage the transaction's lifecycle// if the @param task return error, the transaction will be rollback// or the transaction will be committederr:=o.DoTx(func(ctx context.Context, txOrm orm.TxOrmer) error {
// datauser:=new(User)
user.Name="test_transaction"// insert data// Using txOrm to execute SQL_, e:=txOrm.Insert(user)
// if e != nil the transaction will be rollback// or it will be committedreturne
})
and the second is through classic Begin(), Commit() and Rollback() (which is not supported by RQLite).
I wonder whether the single-batch transaction is supported and if supported, how to realize it through beego/orm?
The text was updated successfully, but these errors were encountered:
bee version
)?go1.21.6, beegov2.1.6
go env
)?GO111MODULE='on'
GOARCH='amd64'
GOBIN=''
GOCACHE='/root/.cache/go-build'
GOENV='/root/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/root/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/root/go'
GOPRIVATE=''
GOPROXY='https://goproxy.cn'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.21.6'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/dev/null'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1461063096=/tmp/go-build -gno-record-gcc-switches'
I am trying to manipulate RQLite through beego/orm. I
_ "github.com/rqlite/gorqlite/stdlib"
orm.RegisterDataBase("default", "rqlite", "http://127.0.0.1:4001/?charset=utf8")
and it works fine with simple CRUD operations.
However, RQLite supports transactions only in a single batch. One can group many statements into a single transaction, but one must submit them as a single unit. One cannot start a transaction, send some statements, come back later and submit some more, and then later commit.
I noticed that beego/orm supports 2 kinds of transactions, the first is:
and the second is through classic
Begin()
,Commit()
andRollback()
(which is not supported by RQLite).I wonder whether the single-batch transaction is supported and if supported, how to realize it through beego/orm?
The text was updated successfully, but these errors were encountered: