Documentation ¶
Index ¶
- func NewAdapter(url string, timeout ...interface{}) (persist.BatchAdapter, error)
- func NewAdapterWithClientOption(clientOption *options.ClientOptions, databaseName string, ...) (persist.BatchAdapter, error)
- func NewAdapterWithCollectionName(clientOption *options.ClientOptions, databaseName string, ...) (persist.BatchAdapter, error)
- func NewAdapterWithMongoClient(client *mongo.Client, timeout ...interface{}) (persist.BatchAdapter, error)
- func NewFilteredAdapter(url string) (persist.FilteredAdapter, error)
- type CasbinRule
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAdapter ¶
func NewAdapter(url string, timeout ...interface{}) (persist.BatchAdapter, error)
NewAdapter is the constructor for Adapter. If database name is not provided in the Mongo URL, 'casbin' will be used as database name. 'casbin_rule' will be used as a collection name.
func NewAdapterWithClientOption ¶
func NewAdapterWithClientOption(clientOption *options.ClientOptions, databaseName string, timeout ...interface{}) (persist.BatchAdapter, error)
NewAdapterWithClientOption is an alternative constructor for Adapter that does the same as NewAdapter, but uses mongo.ClientOption instead of a Mongo URL + a databaseName option
func NewAdapterWithCollectionName ¶
func NewAdapterWithCollectionName(clientOption *options.ClientOptions, databaseName string, collectionName string, timeout ...interface{}) (persist.BatchAdapter, error)
NewAdapterWithCollectionName is an alternative constructor for Adapter that does the same as NewAdapterWithClientOption, but with an extra collectionName option
func NewAdapterWithMongoClient ¶
func NewAdapterWithMongoClient(client *mongo.Client, timeout ...interface{}) (persist.BatchAdapter, error)
func NewFilteredAdapter ¶
func NewFilteredAdapter(url string) (persist.FilteredAdapter, error)
NewFilteredAdapter is the constructor for FilteredAdapter. Casbin will not automatically call LoadPolicy() for a filtered adapter.