-
-
Notifications
You must be signed in to change notification settings - Fork 156
Closed
Labels
Milestone
Description
Feature needed
Hi, there. I've read the wiki and learnt that the solution for jet to manage multi-tenant environment is to use the function:
Artist2 := Artist.FromSchema("chinook2")
As MySQL treats schema
the same as database
, I would like to have a multi-tenant environment based on the prefix or suffix of tables.
Suggested solution
Modify the generator by adding the functions like:
Artist2 := Artist.WithPrefix("chinook2")
Artist3 := Artist.WithSuffix("chinook2")
func (a {{tableTemplate.TypeName}}) WithPrefix(prefix string) {{tableTemplate.TypeName}} {
return new{{tableTemplate.TypeName}}(a.SchemaName(), prefix+a.TableName(), a.Alias())
}
Or simply export the function new{{tableTemplate.TypeName}}
.