用于 Casbin 的 Xorm 适配器
Xorm Adapter is the Xorm adapter for Casbin. With this library, Casbin can load policy from Xorm supported database or save policy to it.
Based on Xorm Drivers Support, The current supported databases are:
go get github.com/apache/casbin-xorm-adapter/v3……xormadapter supports adapter with context, the following is a timeout control implemented using context
a, _ := xormadapter.NewAdapter("mysql", "mysql_username:mysql_password@tcp(127.0.0.1:3306)/") // Your driver and data source.
// Limited time 300s
ctx, cancel := context.WithTimeout(context.Background(), 300*time.Microsecond)
defer cancel()
err := a.AddPolicyCtx(ctx, "p", "p", []string{"alice", "data1", "read"})
if err != nil {
panic(err)
}This project is under Apache 2.0 License. See the LICENSE file for the full license text.
暂无开放 Issues,或尚未同步最近议题。