add table prefix and suffix for multi-tenant environment support
This closes #125.
This commit is contained in:
parent
c29f0afd2b
commit
87cc6c9e93
9 changed files with 100 additions and 0 deletions
|
|
@ -42,6 +42,16 @@ func (a ActorTable) FromSchema(schemaName string) *ActorTable {
|
|||
return newActorTable(schemaName, a.TableName(), a.Alias())
|
||||
}
|
||||
|
||||
// WithPrefix creates new ActorTable with assigned table prefix
|
||||
func (a ActorTable) WithPrefix(prefix string) *ActorTable {
|
||||
return newActorTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
|
||||
}
|
||||
|
||||
// WithSuffix creates new ActorTable with assigned table suffix
|
||||
func (a ActorTable) WithSuffix(suffix string) *ActorTable {
|
||||
return newActorTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
|
||||
}
|
||||
|
||||
func newActorTable(schemaName, tableName, alias string) *ActorTable {
|
||||
return &ActorTable{
|
||||
actorTable: newActorTableImpl(schemaName, tableName, alias),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue