Closed mirusky closed 2 years ago
The core part which impacts the database pattern is in the TenantStore
interface
https://github.com/Goxiaoy/go-saas/blob/5a4eb8da2153a394b7989aa314201cd5b70bfb41/common/tenant_store.go#L10-L13
In the test example https://github.com/Goxiaoy/go-saas/blob/5a4eb8da2153a394b7989aa314201cd5b70bfb41/gorm/sqlite_db_test.go#L71-L77
Tenant Test2
overrides additional connection string which affects the data access layer later
https://github.com/Goxiaoy/go-saas/blob/5a4eb8da2153a394b7989aa314201cd5b70bfb41/common/multi_tenancy_conn_str_resolver.go#L39-L51
There is no need to explicit configure DatabaseStyleType
, but it's a preserved option for further usage
Alright, so if I understood, I could create a tenant store item with many connections and then it will be resolved by the MultiTenancyConnStrResolver
... Something like this:
ts := common.NewMemoryTenantStore(
[]common.TenantConfig{
{ID: "1", Name: "Tenant1"},
{ID: "2", Name: "Tenant2", Conn: map[string]string{
"1": "connStr1",
"2": "connStr2",
}},
})
How it will be resolved ? Like I reciveed a cookie with Tenant2 it will connect where ?
Hello contributors, that was an incredible well done job. I was reading and it was better than what I did in some projects. But I getting confused with multi-tenant mode, like where I need to configure to get a Single-tenancy, Multi-tenancy, Hybrid mode?
I've saw this part but I dont know how it suppose to work, could u provide some examples with the 3 ways?