Documentation
¶
Index ¶
- Constants
- func GetMongoClientFromContext(ctx context.Context) (types.IMongoClient, error)
- func MongoClientInjectorMiddleware(collections types.IMongoClient) mux.MiddlewareFunc
- func RetrieveUserBindingsAndRoles(logger *logrus.Entry, req *http.Request, env config.EnvironmentVariables) (types.User, error)
- func RolesIDsFromBindings(bindings []types.Binding) []string
- func WithMongoClient(ctx context.Context, mongoClient types.IMongoClient) context.Context
- type MongoClient
- func (mongoClient *MongoClient) Disconnect() error
- func (mongoClient *MongoClient) FindMany(ctx context.Context, collectionName string, query map[string]interface{}) ([]interface{}, error)
- func (mongoClient *MongoClient) FindOne(ctx context.Context, collectionName string, query map[string]interface{}) (interface{}, error)
- func (mongoClient *MongoClient) RetrieveRoles(ctx context.Context) ([]types.Role, error)
- func (mongoClient *MongoClient) RetrieveUserBindings(ctx context.Context, user *types.User) ([]types.Binding, error)
- func (mongoClient *MongoClient) RetrieveUserRolesByRolesID(ctx context.Context, userRolesId []string) ([]types.Role, error)
Constants ¶
View Source
const PUBLIC string = "PUBLIC"
View Source
const STATE string = "__STATE__"
Variables ¶
This section is empty.
Functions ¶
func GetMongoClientFromContext ¶
func GetMongoClientFromContext(ctx context.Context) (types.IMongoClient, error)
GetMongoClientFromContext extracts mongo collections adapter struct from provided context.
func MongoClientInjectorMiddleware ¶
func MongoClientInjectorMiddleware(collections types.IMongoClient) mux.MiddlewareFunc
MongoClientInjectorMiddleware will inject into request context the mongo collections.
func RolesIDsFromBindings ¶
func WithMongoClient ¶
Types ¶
type MongoClient ¶
type MongoClient struct {
// contains filtered or unexported fields
}
func NewMongoClient ¶
func NewMongoClient(env config.EnvironmentVariables, logger *logrus.Logger) (*MongoClient, error)
func (*MongoClient) Disconnect ¶
func (mongoClient *MongoClient) Disconnect() error
func (*MongoClient) RetrieveRoles ¶
func (*MongoClient) RetrieveUserBindings ¶
func (*MongoClient) RetrieveUserRolesByRolesID ¶
Click to show internal directories.
Click to hide internal directories.