Documentation ¶
Index ¶
- Constants
- func NewAdapter(param interface{}) (persist.Adapter, error)
- func NewAdapterWithCollection(mCollection *mongo.Collection) (persist.Adapter, error)
- func NewAdapterWithDatabase(mDatabase *mongo.Database) (persist.Adapter, error)
- func NewFilteredAdapter(uri string) (persist.FilteredAdapter, error)
- type CasbinRule
Constants ¶
View Source
const CasbinMongodbCollectionname = "casbin_rule"
View Source
const CasbinMongodbDatabasename = "casbin"
View Source
const ContextTimeout = 30 * time.Second
Variables ¶
This section is empty.
Functions ¶
func NewAdapter ¶
NewAdapter is the constructor for Adapter. param can be a mongodb uri string, *mongo.Database or *mongo.Collection If database name is not provided in the Mongo URI, 'casbin' will be used as database name.
func NewAdapterWithCollection ¶ added in v0.2.0
func NewAdapterWithCollection(mCollection *mongo.Collection) (persist.Adapter, error)
NewAdapterWithDatabase is an alternative constructor for Adapter that does the same as NewAdapter, but uses *mongo.Collection instead of a Mongo URI
func NewAdapterWithDatabase ¶ added in v0.2.0
NewAdapterWithDatabase is an alternative constructor for Adapter that does the same as NewAdapter, but uses *mongo.Database instead of a Mongo URI
func NewFilteredAdapter ¶
func NewFilteredAdapter(uri string) (persist.FilteredAdapter, error)
NewFilteredAdapter is the constructor for FilteredAdapter. Casbin will not automatically call LoadPolicy() for a filtered adapter.
Types ¶
Click to show internal directories.
Click to hide internal directories.