Skip to content

Commit

Permalink
♻️ refactor: updated examples #2
Browse files Browse the repository at this point in the history
  • Loading branch information
arisnguyen215 committed Dec 10, 2023
1 parent 51f2e9d commit 12b9e67
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion example/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,17 @@ func main() {
SetUsername("XXXX").
SetDebugMode(false)

postgresConfigs := []postgres.MultiTenantPostgresConfig{
{Key: "postgres_tenant_1", Config: *postgres.GetPostgresConfigSample()},
{Key: "postgres_tenant_2", Config: *postgres.GetPostgresConfigSample()},
}

connector1 := dbresolver.NewPostgresConnector(*config_1)
connector2 := dbresolver.NewPostgresConnector(*config_2)

resolver := dbresolver.NewMultiTenantDBResolver()

resolver.AddConnector("psql_node1", connector1).AddConnector("psql_node2", connector2)
resolver.AddConnector("psql_node1", connector1).AddConnector("psql_node2", connector2).AddPsqlConnectors(postgresConfigs...)

_, s1 := resolver.GetConnector("psql_node1")

Expand Down

0 comments on commit 12b9e67

Please sign in to comment.