Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
C
casbin-pg-adapter
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abby Cin
casbin-pg-adapter
Commits
841f1fd0
Commit
841f1fd0
authored
Jul 04, 2020
by
Philipp Seitz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update readme
parent
56c866ff
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
0 deletions
+25
-0
README.md
README.md
+25
-0
No files found.
README.md
View file @
841f1fd0
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment