Commit 841f1fd0 authored by Philipp Seitz's avatar Philipp Seitz

update readme

parent 56c866ff
......@@ -76,6 +76,31 @@ func main() {
}
```
## Custom DB Connection
You can provide a custom table or database name with `pgadapter.NewAdapterByDB`
```go
package main
import (
"github.com/casbin/casbin/v2"
pgadapter "github.com/casbin/casbin-pg-adapter"
"github.com/go-pg/pg/v9"
)
func main() {
opts, _ := pg.ParseURL("postgresql://pguser:pgpassword@localhost:5432/pgdb?sslmode=disable")
db := pg.Connect(opts)
defer db.Close()
a, _ := pgadapter.NewAdapterByDB(db, pgadapter.WithTableName("custom_table"))
e, _ := casbin.NewEnforcer("examples/rbac_model.conf", a)
...
}
```
## Run all tests
docker-compose run --rm go
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment