Awesome Open Source
Awesome Open Source

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:[email protected](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.

Related Awesome Lists
Top Programming Languages
Top Projects

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
Go (163,592
Database (92,888
Mysql (31,512
Postgresql (23,947
Adapter (11,183
Orm (5,933
Gdb (2,205
Casbin (296
Gf (27