{"repo":"apache/casbin-gorm-adapter","free":true,"listed":false,"github":"https://github.com/apache/casbin-gorm-adapter","clone":"git clone https://github.com/apache/casbin-gorm-adapter.git","description":"GORM adapter for Casbin, see extended version of GORM Adapter Ex at: https://github.com/casbin/gorm-adapter-ex","language":"Go","stars":753,"topics":["casbin","adapter","storage-driver","gorm","orm","access-control","authorization","acl","rbac","abac"],"license":"Apache-2.0","category":"databases-storage","readme_excerpt":"Gorm Adapter ==== In v3.0.3, method NewAdapterByDB creates table named casbin rules , we fix it to casbin rule after that. If you used v3.0.3 and less, and you want to update it, you might need to migrate data manually. Find out more at: https://github.com/casbin/gorm-adapter/issues/78 Gorm Adapter is the Gorm adapter for Casbin. With this library, Casbin can load policy from Gorm supported database or save policy to it. Based on Officially Supported Databases, The current supported databases are: - MySQL - PostgreSQL - SQL Server - Sqlite3 gorm-adapter use github.com/glebarez/sqlite instead of gorm official sqlite driver gorm.io/driver/sqlite because the latter needs cgo support. But there is almost no difference between the two driver. If there is a difference in use, please submit an issue. - other 3rd-party supported DBs in Gorm website or other places. Installation go get github.com/casbin/gorm-adapter/v3 Simple Example Simple PostgreSQL Example Turn off AutoMigrate New an adapter will use AutoMigrate by default for create table, if you want to turn it off, please use API TurnOffAutoMigrate(db gorm.DB) gorm.DB . See example: Find out more details at gorm-adapter#162 Customize table columns example You can change the gorm struct tags, but the table structure must stay the same. Transaction You can modify policies within a transaction. See the example below: ConditionsToGormQuery ConditionsToGormQuery() is a function that converts multiple query conditions into a GORM quer","default_branch":null,"files":null,"tree":[],"storefront":"/r/apache","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/apache/casbin-gorm-adapter/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}