casbin / casbin-pg-adapter

A go-pg adapter for casbin
https://github.com/casbin/casbin
Apache License 2.0
38 stars 28 forks source link

How to use existing database via connection string #45

Closed evgeniy-dammer closed 1 year ago

evgeniy-dammer commented 1 year ago

Hello, I use this case a, _ := pgadapter.NewAdapter("postgresql://username:password@postgres:5432/database?sslmode=disable") to create a new adapter, and I specify my existing database name in connection string. But a new casbin database with casbin_rule table is creating. What am I do wrong?

casbin-bot commented 1 year ago

@tangyang9464 @JalinWang @imp2002

evgeniy-dammer commented 1 year ago

I looked at the NewAdapter code. It turned out to be necessary to add second string parameter with my database name. I think, it should be added into example.

hsluoyz commented 1 year ago

@evgeniy-dammer hi, can you make a PR to update the README example?

evgeniy-dammer commented 1 year ago

Sure)