-
Notifications
You must be signed in to change notification settings - Fork 94
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
How can I set a table prefix from config??? #49
Comments
You can set the whole table name by implementing the TableModel interface: type TableModel interface {
TableName() string
} E.g. like func (ArtistDAO) TableName() string {
return "myprefix_artists";
} or // snip
return myDynamicPrefix()+"artists" but I do agree with you that a prefix would be very helpful. Currently having the same prob here. Maybe one should implement it and make a pull request. |
About to implement that. One topic I'd like to discuss: 251: func GetTableName(a interface{}) string {
...: // snip
268: } as a static function. Is there a reason to implement it statically instead of an instance method of *DB for example? The latter would allow to configure it in a clean way and also allow to use ozzo-dbx multiple times in a single process, possibly connecting to the same database instance only using different table prefixes. Comments? @qiangxue : maybe that topic could benefit by your opinion on that. |
Implemented with pull request #69 |
I use github.com/qiangxue/golang-restful-starter-kit bun can`t find, how can I set table_prefix from config
Error:
level=error msg="Error 1146: Table 'db.table' doesn't exist"
I need set table-prefix from config by this query "SELECT * FROM db.prefixTable ..."
The text was updated successfully, but these errors were encountered: