From 05fc18004c1d61734cdcdb00a973d219e379b190 Mon Sep 17 00:00:00 2001 From: Evgeniy Dammer Date: Thu, 23 Feb 2023 17:55:00 +0500 Subject: [PATCH] docs: add explanations on how to use an existing database in README (#46) Add explanations on how to use an existing database --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 251a047..027a4db 100644 --- a/README.md +++ b/README.md @@ -31,10 +31,12 @@ func main() { // Password: "...", // }) - // Or you can use an existing DB "abc" like this: // The adapter will use the table named "casbin_rule". // If it doesn't exist, the adapter will create it automatically. + // Or you can use an existing DB by adding a second string parameter with your database name to the NewAdapter(), like this: + // a, _ := pgadapter.NewAdapter("postgresql://username:password@postgres:5432/database?sslmode=disable", "your_database_name") + e := casbin.NewEnforcer("examples/rbac_model.conf", a) // Load the policy from DB.