mgo

package module
v0.4.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 9, 2021 License: Unlicense Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetRetryTimeout

func SetRetryTimeout(d time.Duration) collectionOption

SetRetryTimeout controls how long it will wait before retry watch change stream

func WithLogger

func WithLogger(log logr.Logger) collectionOption

WithLogger set a logger for the collection to use with

Types

type GroupingPersister

type GroupingPersister struct {
	// contains filtered or unexported fields
}

GroupingPersister is a GroupingPersister backed by mongodb

func NewGrouping

func NewGrouping(coll *mgo.Collection, opts ...collectionOption) (*GroupingPersister, error)

NewGrouping uses the given mongodb collection as backend to persist grouping polices

func (*GroupingPersister) Insert

func (p *GroupingPersister) Insert(ent types.Entity, grp types.Group) error

Insert inserts a policy to the persister

func (*GroupingPersister) List

List all policies from the persister

func (*GroupingPersister) Remove

func (p *GroupingPersister) Remove(ent types.Entity, grp types.Group) error

Remove a policy from the persister

func (*GroupingPersister) Watch

Watch any changes occurred about the policies in the persister

type PermissionPersister

type PermissionPersister struct {
	// contains filtered or unexported fields
}

PermissionPersister is a PermissionPersister backed by mongodb

func NewPermission

func NewPermission(coll *mgo.Collection, opts ...collectionOption) (*PermissionPersister, error)

NewPermission uses the given mongodb collection as backend to persist grouping polices

func (*PermissionPersister) Insert

func (p *PermissionPersister) Insert(sub types.Subject, obj types.Object, act types.Action) error

Insert a permission policy to the persister

func (*PermissionPersister) List

List all polices from the persister

func (*PermissionPersister) Remove

func (p *PermissionPersister) Remove(sub types.Subject, obj types.Object) error

Remove a permission policy from the persister

func (*PermissionPersister) Update

func (p *PermissionPersister) Update(sub types.Subject, obj types.Object, act types.Action) error

Update a permission policy to the persister

func (*PermissionPersister) Watch

Watch any changes occurred about the polices in the persister

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL