Documentation ¶
Index ¶
- type BaseMapper
- func (mapper *BaseMapper) CreateMany(db *gorm.DB, who models.Who, typeString string, modelObjs []models.IModel, ...) ([]models.IModel, error)
- func (mapper *BaseMapper) CreateOne(db *gorm.DB, who models.Who, typeString string, modelObj models.IModel, ...) (models.IModel, error)
- func (mapper *BaseMapper) DeleteMany(db *gorm.DB, who models.Who, typeString string, modelObjs []models.IModel, ...) ([]models.IModel, error)
- func (mapper *BaseMapper) DeleteOneWithID(db *gorm.DB, who models.Who, typeString string, id *datatypes.UUID, ...) (models.IModel, error)
- func (mapper *BaseMapper) GetAll(db *gorm.DB, who models.Who, typeString string, ...) ([]models.IModel, []models.UserRole, *int, error)
- func (mapper *BaseMapper) GetOneWithID(db *gorm.DB, who models.Who, typeString string, id *datatypes.UUID, ...) (models.IModel, models.UserRole, error)
- func (mapper *BaseMapper) PatchMany(db *gorm.DB, who models.Who, typeString string, ...) ([]models.IModel, error)
- func (mapper *BaseMapper) PatchOneWithID(db *gorm.DB, who models.Who, typeString string, jsonPatch []byte, ...) (models.IModel, error)
- func (mapper *BaseMapper) UpdateMany(db *gorm.DB, who models.Who, typeString string, modelObjs []models.IModel, ...) ([]models.IModel, error)
- func (mapper *BaseMapper) UpdateOneWithID(db *gorm.DB, who models.Who, typeString string, modelObj models.IModel, ...) (models.IModel, error)
- type IChangeEmailPasswordMapper
- type IDataMapper
- type IEmailVerificationMapper
- type IResetPasswordMapper
- type ISendPasswordResetEmail
- type ISendVerificationEmail
- type UserMapper
- func (mapper *UserMapper) ChangeEmailPasswordWithID(db *gorm.DB, who models.Who, typeString string, modelObj models.IModel, ...) (models.IModel, error)
- func (mapper *UserMapper) CreateMany(db *gorm.DB, who models.Who, typeString string, modelObj []models.IModel, ...) ([]models.IModel, error)
- func (mapper *UserMapper) CreateOne(db *gorm.DB, who models.Who, typeString string, modelObj models.IModel, ...) (models.IModel, error)
- func (mapper *UserMapper) DeleteMany(db *gorm.DB, who models.Who, typeString string, modelObjs []models.IModel, ...) ([]models.IModel, error)
- func (mapper *UserMapper) DeleteOneWithID(db *gorm.DB, who models.Who, typeString string, id *datatypes.UUID, ...) (models.IModel, error)
- func (mapper *UserMapper) GetAll(db *gorm.DB, who models.Who, typeString string, ...) ([]models.IModel, []models.UserRole, *int, error)
- func (mapper *UserMapper) GetOneWithID(db *gorm.DB, who models.Who, typeString string, id *datatypes.UUID, ...) (models.IModel, models.UserRole, error)
- func (mapper *UserMapper) PatchMany(db *gorm.DB, who models.Who, typeString string, ...) ([]models.IModel, error)
- func (mapper *UserMapper) PatchOneWithID(db *gorm.DB, who models.Who, typeString string, jsonPatch []byte, ...) (models.IModel, error)
- func (mapper *UserMapper) ResetPassword(db *gorm.DB, typeString string, modelObj models.IModel, id *datatypes.UUID, ...) error
- func (mapper *UserMapper) SendEmailResetPassword(db *gorm.DB, who models.Who, typeString string, modelObj models.IModel) error
- func (mapper *UserMapper) SendEmailVerification(db *gorm.DB, who models.Who, typeString string, modelObj models.IModel) error
- func (mapper *UserMapper) UpdateMany(db *gorm.DB, who models.Who, typeString string, modelObjs []models.IModel, ...) ([]models.IModel, error)
- func (mapper *UserMapper) UpdateOneWithID(db *gorm.DB, who models.Who, typeString string, modelObj models.IModel, ...) (models.IModel, error)
- func (mapper *UserMapper) VerifyEmail(db *gorm.DB, typeString string, id *datatypes.UUID, code string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseMapper ¶ added in v0.3.3
BaseMapper is a basic CRUD manager
func (*BaseMapper) CreateMany ¶ added in v0.3.3
func (mapper *BaseMapper) CreateMany(db *gorm.DB, who models.Who, typeString string, modelObjs []models.IModel, options *map[urlparam.Param]interface{}) ([]models.IModel, error)
CreateMany creates an instance of this model based on json and store it in db
func (*BaseMapper) CreateOne ¶ added in v0.3.3
func (mapper *BaseMapper) CreateOne(db *gorm.DB, who models.Who, typeString string, modelObj models.IModel, options *map[urlparam.Param]interface{}) (models.IModel, error)
CreateOne creates an instance of this model based on json and store it in db
func (*BaseMapper) DeleteMany ¶ added in v0.3.3
func (mapper *BaseMapper) DeleteMany(db *gorm.DB, who models.Who, typeString string, modelObjs []models.IModel, options *map[urlparam.Param]interface{}) ([]models.IModel, error)
DeleteMany deletes multiple models
func (*BaseMapper) DeleteOneWithID ¶ added in v0.3.3
func (mapper *BaseMapper) DeleteOneWithID(db *gorm.DB, who models.Who, typeString string, id *datatypes.UUID, options *map[urlparam.Param]interface{}) (models.IModel, error)
DeleteOneWithID delete the model TODO: delete the groups associated with this record?
func (*BaseMapper) GetAll ¶ added in v0.3.3
func (mapper *BaseMapper) GetAll(db *gorm.DB, who models.Who, typeString string, options *map[urlparam.Param]interface{}) ([]models.IModel, []models.UserRole, *int, error)
GetAll obtains a slice of models.DomainModel options can be string "offset" and "limit", both of type int This is very Javascript-esque. I would have liked Python's optional parameter more. Alas, no such feature in Go. https://stackoverflow.com/questions/2032149/optional-parameters-in-go How does Gorm do the following? Might want to check out its source code. Cancel offset condition with -1
db.Offset(10).Find(&users1).Offset(-1).Find(&users2)
func (*BaseMapper) GetOneWithID ¶ added in v0.3.3
func (mapper *BaseMapper) GetOneWithID(db *gorm.DB, who models.Who, typeString string, id *datatypes.UUID, options *map[urlparam.Param]interface{}) (models.IModel, models.UserRole, error)
GetOneWithID get one model object based on its type and its id string
func (*BaseMapper) PatchMany ¶ added in v0.3.3
func (mapper *BaseMapper) PatchMany(db *gorm.DB, who models.Who, typeString string, jsonIDPatches []models.JSONIDPatch, options *map[urlparam.Param]interface{}) ([]models.IModel, error)
PatchMany patches multiple models
func (*BaseMapper) PatchOneWithID ¶ added in v0.3.3
func (mapper *BaseMapper) PatchOneWithID(db *gorm.DB, who models.Who, typeString string, jsonPatch []byte, id *datatypes.UUID, options *map[urlparam.Param]interface{}) (models.IModel, error)
PatchOneWithID updates model based on this json
type IChangeEmailPasswordMapper ¶ added in v0.2.2
type IChangeEmailPasswordMapper interface { ChangeEmailPasswordWithID(db *gorm.DB, who models.Who, typeString string, modelobj models.IModel, id *datatypes.UUID) (models.IModel, error) }
IChangeEmailPasswordMapper changes email and password
type IDataMapper ¶ added in v0.3.3
type IDataMapper interface { CreateOne(db *gorm.DB, who models.Who, typeString string, modelObj models.IModel, options *map[urlparam.Param]interface{}) (models.IModel, error) CreateMany(db *gorm.DB, who models.Who, typeString string, modelObj []models.IModel, options *map[urlparam.Param]interface{}) ([]models.IModel, error) GetOneWithID(db *gorm.DB, who models.Who, typeString string, id *datatypes.UUID, options *map[urlparam.Param]interface{}) (models.IModel, models.UserRole, error) GetAll(db *gorm.DB, who models.Who, typeString string, options *map[urlparam.Param]interface{}) ([]models.IModel, []models.UserRole, *int, error) UpdateOneWithID(db *gorm.DB, who models.Who, typeString string, modelobj models.IModel, id *datatypes.UUID, options *map[urlparam.Param]interface{}) (models.IModel, error) UpdateMany(db *gorm.DB, who models.Who, typeString string, modelObjs []models.IModel, options *map[urlparam.Param]interface{}) ([]models.IModel, error) PatchOneWithID(db *gorm.DB, who models.Who, typeString string, jsonPatch []byte, id *datatypes.UUID, options *map[urlparam.Param]interface{}) (models.IModel, error) PatchMany(db *gorm.DB, who models.Who, typeString string, jsonIDPatches []models.JSONIDPatch, options *map[urlparam.Param]interface{}) ([]models.IModel, error) DeleteOneWithID(db *gorm.DB, who models.Who, typeString string, id *datatypes.UUID, options *map[urlparam.Param]interface{}) (models.IModel, error) DeleteMany(db *gorm.DB, who models.Who, typeString string, modelObjs []models.IModel, options *map[urlparam.Param]interface{}) ([]models.IModel, error) }
IDataMapper has all the crud interfaces
func SharedGlobalMapper ¶ added in v0.1.46
func SharedGlobalMapper() IDataMapper
SharedGlobalMapper creats a singleton of Crud object
func SharedLinkTableMapper ¶ added in v0.3.0
func SharedLinkTableMapper() IDataMapper
SharedLinkTableMapper creats a singleton of Crud object
func SharedOrganizationMapper ¶ added in v0.1.28
func SharedOrganizationMapper() IDataMapper
SharedOrganizationMapper creats a singleton of Crud object
func SharedOwnershipMapper ¶ added in v0.1.18
func SharedOwnershipMapper() IDataMapper
SharedOwnershipMapper creats a singleton of Crud object
type IEmailVerificationMapper ¶ added in v0.4.25
type IEmailVerificationMapper interface { SendEmailVerification(db *gorm.DB, who models.Who, typeString string, modelObj models.IModel) error VerifyEmail(db *gorm.DB, typeString string, id *datatypes.UUID, code string) error }
IEmailVerificationMapper does verification email
type IResetPasswordMapper ¶ added in v0.4.23
type IResetPasswordMapper interface { SendEmailResetPassword(db *gorm.DB, who models.Who, typeString string, modelObj models.IModel) error ResetPassword(db *gorm.DB, typeString string, modelObj models.IModel, id *datatypes.UUID, code string) error }
IResetPasswordMapper reset password in-case user forgotten it.
type ISendPasswordResetEmail ¶ added in v0.4.23
type ISendPasswordResetEmail interface { SendPasswordResetEmail(db *gorm.DB, who models.Who, typeString string, modelobj models.IModel) error }
ISendVerificationEmailHandler for sending verification email (Should be impelemented in model) This is for user model
type ISendVerificationEmail ¶ added in v0.4.23
type ISendVerificationEmail interface { SendVerificationEmail(db *gorm.DB, who models.Who, typeString string, modelobj models.IModel, actionType datatypes.VerificationActionType) error }
ISendVerificationEmailHandler for sending verification email (Should be impelemented in model) This is for user model
type UserMapper ¶
UserMapper is a User CRUD manager
func SharedUserMapper ¶
func SharedUserMapper() *UserMapper
SharedUserMapper creats a singleton of Crud object
func (*UserMapper) ChangeEmailPasswordWithID ¶ added in v0.2.2
func (mapper *UserMapper) ChangeEmailPasswordWithID(db *gorm.DB, who models.Who, typeString string, modelObj models.IModel, id *datatypes.UUID) (models.IModel, error)
ChangeEmailPasswordWithID changes email and/or password
func (*UserMapper) CreateMany ¶ added in v0.1.24
func (mapper *UserMapper) CreateMany(db *gorm.DB, who models.Who, typeString string, modelObj []models.IModel, options *map[urlparam.Param]interface{}) ([]models.IModel, error)
CreateMany :-
func (*UserMapper) CreateOne ¶
func (mapper *UserMapper) CreateOne(db *gorm.DB, who models.Who, typeString string, modelObj models.IModel, options *map[urlparam.Param]interface{}) (models.IModel, error)
CreateOne creates an user model based on json and store it in db Also creates a ownership with admin access
func (*UserMapper) DeleteMany ¶ added in v0.3.3
func (mapper *UserMapper) DeleteMany(db *gorm.DB, who models.Who, typeString string, modelObjs []models.IModel, options *map[urlparam.Param]interface{}) ([]models.IModel, error)
DeleteMany :-
func (*UserMapper) DeleteOneWithID ¶
func (mapper *UserMapper) DeleteOneWithID(db *gorm.DB, who models.Who, typeString string, id *datatypes.UUID, options *map[urlparam.Param]interface{}) (models.IModel, error)
DeleteOneWithID deletes the user with the ID
func (*UserMapper) GetAll ¶ added in v0.3.3
func (mapper *UserMapper) GetAll(db *gorm.DB, who models.Who, typeString string, options *map[urlparam.Param]interface{}) ([]models.IModel, []models.UserRole, *int, error)
GetAll :-
func (*UserMapper) GetOneWithID ¶
func (mapper *UserMapper) GetOneWithID(db *gorm.DB, who models.Who, typeString string, id *datatypes.UUID, options *map[urlparam.Param]interface{}) (models.IModel, models.UserRole, error)
GetOneWithID get one model object based on its type and its id string
func (*UserMapper) PatchMany ¶ added in v0.3.3
func (mapper *UserMapper) PatchMany(db *gorm.DB, who models.Who, typeString string, jsonIDPatches []models.JSONIDPatch, options *map[urlparam.Param]interface{}) ([]models.IModel, error)
PatchMany :-
func (*UserMapper) PatchOneWithID ¶ added in v0.3.3
func (mapper *UserMapper) PatchOneWithID(db *gorm.DB, who models.Who, typeString string, jsonPatch []byte, id *datatypes.UUID, options *map[urlparam.Param]interface{}) (models.IModel, error)
PatchOneWithID :-
func (*UserMapper) ResetPassword ¶ added in v0.4.23
func (*UserMapper) SendEmailResetPassword ¶ added in v0.4.25
func (mapper *UserMapper) SendEmailResetPassword(db *gorm.DB, who models.Who, typeString string, modelObj models.IModel) error
SendEmailResetPassword :- Calling this allow a way to change password by the verification code without logging in. But doens't mean the password is already invalidated
func (*UserMapper) SendEmailVerification ¶ added in v0.4.23
func (*UserMapper) UpdateMany ¶ added in v0.3.3
func (mapper *UserMapper) UpdateMany(db *gorm.DB, who models.Who, typeString string, modelObjs []models.IModel, options *map[urlparam.Param]interface{}) ([]models.IModel, error)
UpdateMany :-
func (*UserMapper) UpdateOneWithID ¶
func (mapper *UserMapper) UpdateOneWithID(db *gorm.DB, who models.Who, typeString string, modelObj models.IModel, id *datatypes.UUID, options *map[urlparam.Param]interface{}) (models.IModel, error)
UpdateOneWithID updates model based on this json Update DOESN'T change password. It'll load up the password hash and save the same. Update password require special endpoint