-
-
Notifications
You must be signed in to change notification settings - Fork 58
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
Connect to specific table #3
Comments
Currently Xorm will automatically name the table after the struct being stored. based on Xorm docs. The struct is: type CasbinRule struct {
PType string `xorm:"varchar(100)"`
V0 string `xorm:"varchar(100)"`
V1 string `xorm:"varchar(100)"`
V2 string `xorm:"varchar(100)"`
V3 string `xorm:"varchar(100)"`
V4 string `xorm:"varchar(100)"`
V5 string `xorm:"varchar(100)"`
} So the default table name would be |
I was wondering if there's a way to reconfigure the names of the tables and its columns. I saw the struct you've posted already in the code but found no way to change it. So I can't change the used database name. That's alright for me. |
I don't understand. The DB for SQLite is the .db file, which is controlled by you.
I think the simplest and most direct way to do it is renaming the struct |
Thank you very much. I will try that. |
By the way, it worked. Renaming the struct |
How do I connect to a specific table inside an sqlite database?
adapter := xormadapter.NewAdapter("sqlite3", "./database.db", true)
connects successfully with my sqlite database, but creates a default table casbin_rules.adapter := xormadapter.NewAdapter("sqlite3", "./database.db/mytable", true)
unfortunately interpretsdatabase.db
as directory.The text was updated successfully, but these errors were encountered: