Skip to content

vance-liu/gdb-adapter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gdb adapter Build Status Coverage Status Godoc

GF ORM adapter for Casbin.

Based on GF ORM, and tested in:

  • MySQL
  • PostgreSQL

Installation

go get github.com/vance-liu/gdb-adapter

Usage example

opts := &Adapter{
    DriverName: "mysql",
    DataSourceName: "root:1234@tcp(127.0.0.1:3306)/casbin",
    TableName: "casbin_rule",
    // or reuse an existing connection:
    // Db: yourDBConn,
}

a := NewAdapterFromOptions(opts)
e := casbin.NewEnforcer("examples/rbac_model.conf", a)

Notice

you should create the database on your own.

Getting Help

License

This project is under Apache 2.0 License. See the LICENSE file for the full license text.