Skip to content
This repository has been archived by the owner on Sep 7, 2021. It is now read-only.
This repository is currently being migrated. It's locked while the migration is in progress.

how to open session autoclose flag with xorm.engine #1458

Open
godcong opened this issue Oct 14, 2019 · 1 comment
Open

how to open session autoclose flag with xorm.engine #1458

godcong opened this issue Oct 14, 2019 · 1 comment

Comments

@godcong
Copy link

godcong commented Oct 14, 2019

now i used engine.Where("") to create an autoclose session.

but, the souce looks not very good.
does any suggestions for this?

if has some function like:

engine.NewAutoCloseSession()

or

session.AutoClose()

that is great!

@lunny
Copy link
Member

lunny commented Oct 14, 2019

It's unnecessary to close session manually if you use engine.Where.... Only when you use sess := engine.NewSession(), you should ensure you revoked sess.Close() before you leave the scope.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants