mongo

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mongo

type Mongo struct {
	mongodriver.MongoDriverConfig

	Connection *mongodriver.MongoConnection
	// contains filtered or unexported fields
}

func NewMongoStore added in v0.11.0

func NewMongoStore(_ context.Context, cfg config.MongoDB) (m *Mongo, err error)

NewMongoStore creates a new Mongo object encapsulating a connection to the mongo server/cluster with the given configuration, and a health client to check the health of the mongo server/cluster

func (*Mongo) AddPolicy added in v0.5.0

func (m *Mongo) AddPolicy(ctx context.Context, policy *models.Policy) (*models.Policy, error)

AddPolicy inserts new policy to data store

func (*Mongo) Checker

func (m *Mongo) Checker(ctx context.Context, state *healthcheck.CheckState) error

Checker is called by the healthcheck library to check the health state of this mongoDB instance

func (*Mongo) Close

func (m *Mongo) Close(ctx context.Context) error

Close the mongo session and returns any error It is an error to call m.Close if m.Init() returned an error, and there is no open connection

func (*Mongo) DeletePolicy added in v0.8.0

func (m *Mongo) DeletePolicy(ctx context.Context, id string) error

DeletePolicy deletes a policy given its id

func (*Mongo) GetAllBundlePolicies added in v0.5.0

func (m *Mongo) GetAllBundlePolicies(ctx context.Context) ([]*models.BundlePolicy, error)

GetAllBundlePolicies returns all policy documents for a permissions bundle, without pagination

func (*Mongo) GetAllRoles added in v0.5.0

func (m *Mongo) GetAllRoles(ctx context.Context) ([]*models.Role, error)

GetAllRoles returns all role documents, without pagination

func (*Mongo) GetPolicy added in v0.5.0

func (m *Mongo) GetPolicy(ctx context.Context, id string) (*models.Policy, error)

GetPolicy returns a policy given its id

func (*Mongo) GetRole added in v0.3.0

func (m *Mongo) GetRole(ctx context.Context, id string) (*models.Role, error)

GetRole retrieves a role document by its ID

func (*Mongo) GetRoles added in v0.4.0

func (m *Mongo) GetRoles(ctx context.Context, offset, limit int) (*models.Roles, error)

GetRoles retrieves all role documents from Mongo, according to the provided limit and offset. Offset and limit need to be positive or zero.

func (*Mongo) UpdatePolicy added in v0.8.0

func (m *Mongo) UpdatePolicy(ctx context.Context, policy *models.Policy) (*models.UpdateResult, error)

UpdatePolicy updates the given policy, or inserts/creates the given policy if it does not exist

Jump to

Keyboard shortcuts

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