百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
C

casbin-xorm-adapter

> 数据库
开源

用于 Casbin 的 Xorm 适配器

382 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

用于 Casbin 的 Xorm 适配器

Xorm Adapter

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:

  • Mysql: github.com/go-sql-driver/mysql
  • MyMysql: github.com/ziutek/mymysql
  • Postgres: github.com/lib/pq
  • Tidb: github.com/pingcap/tidb
  • SQLite: github.com/mattn/go-sqlite3
  • MsSql: github.com/denisenkom/go-mssqldb
  • Oracle: github.com/mattn/go-oci8 (experiment)

Installation

go get github.com/apache/casbin-xorm-adapter/v3

Simple MySQL Example

…

Simple Postgres Example

…

Context Adapter

xormadapter supports adapter with context, the following is a timeout control implemented using context

go
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)
}

Getting Help

  • Casbin

License

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

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Goaccess-controladapterauthorizationcasbin

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类数据库
定价开源

> 相关工具

P
PostgreSQL
功能强大的开源关系型数据库
R
Redis
内存数据结构存储,常用作缓存与队列
M
MySQL
广泛使用的开源关系型数据库