Documentation ¶
Index ¶
- func CreateContent(coll string, content *model.Content) (*mongo.InsertOneResult, error)
- func CreateContentType(ct *model.ContentType) (*mongo.InsertOneResult, error)
- func CreateRole(r *model.Role) (*mongo.InsertOneResult, error)
- func CreateUser(user *model.User) (*mongo.InsertOneResult, error)
- func DeleteContent(coll string, id string) (*mongo.DeleteResult, error)
- func DeleteContentType(id string) (*mongo.DeleteResult, error)
- func DeleteRole(id string) (*mongo.DeleteResult, error)
- func DeleteRoleFromPermissions(rID primitive.ObjectID, ct *model.ContentType) (*mongo.UpdateResult, error)
- func DeleteRoleFromUser(rID primitive.ObjectID, user *model.User) (*mongo.UpdateResult, error)
- func DeleteUser(id string) (*mongo.DeleteResult, error)
- func GetContent(coll string, filter interface{}) ([]*model.Content, error)
- func GetContentById(coll string, id string) (*model.Content, error)
- func GetContentEntry(coll string, filter interface{}) (*model.Content, error)
- func GetContentType(filter interface{}) (*model.ContentType, error)
- func GetContentTypeByCollection(coll string) (*model.ContentType, error)
- func GetContentTypeById(id string) (*model.ContentType, error)
- func GetContentTypes(filter interface{}) ([]*model.ContentType, error)
- func GetCustomFields(coll string) (map[string]interface{}, error)
- func GetRole(filter interface{}) (*model.Role, error)
- func GetRoleById(id string) (*model.Role, error)
- func GetRoleByName(name string) (*model.Role, error)
- func GetRoleByTag(tag string) (*model.Role, error)
- func GetRoleNames(roleIDs []primitive.ObjectID) ([]string, error)
- func GetRoles(filter interface{}) ([]*model.Role, error)
- func GetUser(filter interface{}) (*model.User, error)
- func GetUserByEmail(e string) (*model.User, error)
- func GetUserById(id string) (*model.User, error)
- func GetUserByUsername(u string) (*model.User, error)
- func GetUserPasswordHash(id string) (string, error)
- func GetUsers(filter interface{}) ([]*model.User, error)
- func InitAdminUser() error
- func InitContentTypes() error
- func InitRoles() error
- func IsValidContentCollection(coll string) bool
- func IsValidRole(role string) bool
- func UpdateContent(coll string, id string, input *model.ContentUpdate) (*mongo.UpdateResult, error)
- func UpdateContentType(id string, input *model.ContentTypeUpdate) (*mongo.UpdateResult, error)
- func UpdateRole(id string, input *model.Role) (*mongo.UpdateResult, error)
- func UpdateUser(id string, input *model.UserUpdate) (*mongo.UpdateResult, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateContent ¶
Insert content entry in collection coll with provided Parameters
func CreateContentType ¶
func CreateContentType(ct *model.ContentType) (*mongo.InsertOneResult, error)
Insert content type with provided Parameters in DB
func CreateRole ¶
func CreateRole(r *model.Role) (*mongo.InsertOneResult, error)
Insert role with provided Parameters in DB
func CreateUser ¶
func CreateUser(user *model.User) (*mongo.InsertOneResult, error)
Insert user with provided Parameters in DB
func DeleteContent ¶
func DeleteContent(coll string, id string) (*mongo.DeleteResult, error)
Delete content entry provided ID in DB
func DeleteContentType ¶
func DeleteContentType(id string) (*mongo.DeleteResult, error)
Delete content type with provided ID in DB
func DeleteRole ¶
func DeleteRole(id string) (*mongo.DeleteResult, error)
Delete role with provided filter in DB
func DeleteRoleFromPermissions ¶
func DeleteRoleFromPermissions(rID primitive.ObjectID, ct *model.ContentType) (*mongo.UpdateResult, error)
Delete one role from content type permissions.
func DeleteRoleFromUser ¶
Delete only one role from user.
func DeleteUser ¶
func DeleteUser(id string) (*mongo.DeleteResult, error)
Delete user with provided ID in DB
func GetContent ¶
Return all content entries from collection coll that match the filter
func GetContentById ¶
Return Content from collection coll with provided ID
func GetContentEntry ¶
Return a single content entry from collection coll that matches the filter. Filter must be structured in bson types.
func GetContentType ¶
func GetContentType(filter interface{}) (*model.ContentType, error)
Return a single ContentType that matches the filter
func GetContentTypeByCollection ¶
func GetContentTypeByCollection(coll string) (*model.ContentType, error)
Returns a content type basing on a collection
func GetContentTypeById ¶
func GetContentTypeById(id string) (*model.ContentType, error)
Return a single ContentType with provided ID
func GetContentTypes ¶
func GetContentTypes(filter interface{}) ([]*model.ContentType, error)
Return all ContentTypes that match the filter
func GetCustomFields ¶
Returns the Custom fields of a contenttype as map Takes the collection of a content type as input
func GetRoleById ¶
Returns the role Object with provided ID
func GetRoleByName ¶
Returns the role with provided role name
func GetRoleByTag ¶
Return the role with provided role tag
func GetRoleNames ¶
Returns slice of role names of provided role ObjectsIDs
func GetUserByEmail ¶
Return a single user that matches the email input
func GetUserById ¶
Return a single user that matches the id input
func GetUserByUsername ¶
Return a single user that matches the username input
func GetUserPasswordHash ¶
Return hashed Password of User with provided ID
func InitContentTypes ¶
func InitContentTypes() error
Initialize collection ContentTypes with 'blogposts' and 'events'
func IsValidContentCollection ¶
Returns true if the a contenttype with exists, where the `collection` field value is `coll`
func IsValidRole ¶
Return true if the a role with given string role name exists
func UpdateContent ¶
func UpdateContent(coll string, id string, input *model.ContentUpdate) (*mongo.UpdateResult, error)
Update content entry in collection coll with provided parameters
func UpdateContentType ¶
func UpdateContentType(id string, input *model.ContentTypeUpdate) (*mongo.UpdateResult, error)
Update content type with provided parameters
func UpdateRole ¶
Update role with provided parameters
func UpdateUser ¶
func UpdateUser(id string, input *model.UserUpdate) (*mongo.UpdateResult, error)
Update user with provided Parameters in DB
Types ¶
This section is empty.