Documentation ¶
Index ¶
- func SetLinkTableMapper(mapper IDataMapper)
- func SetMockOwnershipMapper(mapper IDataMapper)
- func SetOrganizationMapper(mapper IDataMapper)
- func SetSharedGlobalMapper(mapper IDataMapper)
- type DataMapper
- func (mapper *DataMapper) CreateMany(db *gorm.DB, who models.UserIDFetchable, typeString string, ...) (*MapperRet, *webrender.RetError)
- func (mapper *DataMapper) CreateOne(db *gorm.DB, who models.UserIDFetchable, typeString string, ...) (*MapperRet, *webrender.RetError)
- func (mapper *DataMapper) DeleteMany(db *gorm.DB, who models.UserIDFetchable, typeString string, ...) (*MapperRet, *webrender.RetError)
- func (mapper *DataMapper) DeleteOne(db *gorm.DB, who models.UserIDFetchable, typeString string, id *datatypes.UUID, ...) (*MapperRet, *webrender.RetError)
- func (mapper *DataMapper) PatchMany(db *gorm.DB, who models.UserIDFetchable, typeString string, ...) (*MapperRet, *webrender.RetError)
- func (mapper *DataMapper) PatchOne(db *gorm.DB, who models.UserIDFetchable, typeString string, jsonPatch []byte, ...) (*MapperRet, *webrender.RetError)
- func (mapper *DataMapper) ReadMany(db *gorm.DB, who models.UserIDFetchable, typeString string, ...) (*MapperRet, []models.UserRole, *int, *webrender.RetError)
- func (mapper *DataMapper) ReadOne(db *gorm.DB, who models.UserIDFetchable, typeString string, id *datatypes.UUID, ...) (*MapperRet, models.UserRole, *webrender.RetError)
- func (mapper *DataMapper) UpdateMany(db *gorm.DB, who models.UserIDFetchable, typeString string, ...) (*MapperRet, *webrender.RetError)
- func (mapper *DataMapper) UpdateOne(db *gorm.DB, who models.UserIDFetchable, typeString string, ...) (*MapperRet, *webrender.RetError)
- type HandlerFetcher
- type IDataMapper
- type MapperRet
- type UserMapper
- func (mapper *UserMapper) CreateMany(db *gorm.DB, who models.UserIDFetchable, typeString string, ...) (*MapperRet, *webrender.RetError)
- func (mapper *UserMapper) CreateOne(db *gorm.DB, who models.UserIDFetchable, typeString string, ...) (*MapperRet, *webrender.RetError)
- func (mapper *UserMapper) DeleteMany(db *gorm.DB, who models.UserIDFetchable, typeString string, ...) (*MapperRet, *webrender.RetError)
- func (mapper *UserMapper) DeleteOne(db *gorm.DB, who models.UserIDFetchable, typeString string, id *datatypes.UUID, ...) (*MapperRet, *webrender.RetError)
- func (mapper *UserMapper) PatchMany(db *gorm.DB, who models.UserIDFetchable, typeString string, ...) (*MapperRet, *webrender.RetError)
- func (mapper *UserMapper) PatchOne(db *gorm.DB, who models.UserIDFetchable, typeString string, jsonPatch []byte, ...) (*MapperRet, *webrender.RetError)
- func (mapper *UserMapper) ReadMany(db *gorm.DB, who models.UserIDFetchable, typeString string, ...) (*MapperRet, []models.UserRole, *int, *webrender.RetError)
- func (mapper *UserMapper) ReadOne(db *gorm.DB, who models.UserIDFetchable, typeString string, id *datatypes.UUID, ...) (*MapperRet, models.UserRole, *webrender.RetError)
- func (mapper *UserMapper) UpdateMany(db *gorm.DB, who models.UserIDFetchable, typeString string, ...) (*MapperRet, *webrender.RetError)
- func (mapper *UserMapper) UpdateOne(db *gorm.DB, who models.UserIDFetchable, typeString string, ...) (*MapperRet, *webrender.RetError)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetLinkTableMapper ¶ added in v0.4.48
func SetLinkTableMapper(mapper IDataMapper)
SetLinkTableMapper allows one to mock LinkTableMapper for testing
func SetMockOwnershipMapper ¶ added in v0.4.48
func SetMockOwnershipMapper(mapper IDataMapper)
SetMockOwnershipMapper allows one to mock OrganizationMapper for testing
func SetOrganizationMapper ¶ added in v0.4.48
func SetOrganizationMapper(mapper IDataMapper)
SetOrganizationMapper allows one to mock OrganizationMapper for testing
func SetSharedGlobalMapper ¶ added in v0.4.48
func SetSharedGlobalMapper(mapper IDataMapper)
SetSharedGlobalMapper allows one to mock SharedGlobalMapper for testing
Types ¶
type DataMapper ¶ added in v0.9.0
DataMapper is a basic CRUD manager
func (*DataMapper) CreateMany ¶ added in v0.9.0
func (mapper *DataMapper) CreateMany(db *gorm.DB, who models.UserIDFetchable, typeString string, modelObjs []models.IModel, options map[urlparam.Param]interface{}, cargo *hookhandler.Cargo) (*MapperRet, *webrender.RetError)
CreateMany creates an instance of this model based on json and store it in db
func (*DataMapper) CreateOne ¶ added in v0.9.0
func (mapper *DataMapper) CreateOne(db *gorm.DB, who models.UserIDFetchable, typeString string, modelObj models.IModel, options map[urlparam.Param]interface{}, cargo *hookhandler.Cargo) (*MapperRet, *webrender.RetError)
CreateOne creates an instance of this model based on json and store it in db
func (*DataMapper) DeleteMany ¶ added in v0.9.0
func (mapper *DataMapper) DeleteMany(db *gorm.DB, who models.UserIDFetchable, typeString string, modelObjs []models.IModel, options map[urlparam.Param]interface{}, cargo *hookhandler.Cargo) (*MapperRet, *webrender.RetError)
DeleteMany deletes multiple models
func (*DataMapper) DeleteOne ¶ added in v0.9.0
func (mapper *DataMapper) DeleteOne(db *gorm.DB, who models.UserIDFetchable, typeString string, id *datatypes.UUID, options map[urlparam.Param]interface{}, cargo *hookhandler.Cargo) (*MapperRet, *webrender.RetError)
DeleteOne delete the model TODO: delete the groups associated with this record?
func (*DataMapper) PatchMany ¶ added in v0.9.0
func (mapper *DataMapper) PatchMany(db *gorm.DB, who models.UserIDFetchable, typeString string, jsonIDPatches []models.JSONIDPatch, options map[urlparam.Param]interface{}, cargo *hookhandler.Cargo) (*MapperRet, *webrender.RetError)
PatchMany patches multiple models
func (*DataMapper) PatchOne ¶ added in v0.9.0
func (mapper *DataMapper) PatchOne(db *gorm.DB, who models.UserIDFetchable, typeString string, jsonPatch []byte, id *datatypes.UUID, options map[urlparam.Param]interface{}, cargo *hookhandler.Cargo) (*MapperRet, *webrender.RetError)
PatchOne updates model based on this json
func (*DataMapper) ReadOne ¶ added in v0.9.0
func (mapper *DataMapper) ReadOne(db *gorm.DB, who models.UserIDFetchable, typeString string, id *datatypes.UUID, options map[urlparam.Param]interface{}, cargo *hookhandler.Cargo) (*MapperRet, models.UserRole, *webrender.RetError)
ReadOne get one model object based on its type and its id string
func (*DataMapper) UpdateMany ¶ added in v0.9.0
func (mapper *DataMapper) UpdateMany(db *gorm.DB, who models.UserIDFetchable, typeString string, modelObjs []models.IModel, options map[urlparam.Param]interface{}, cargo *hookhandler.Cargo) (*MapperRet, *webrender.RetError)
UpdateMany updates multiple models
func (*DataMapper) UpdateOne ¶ added in v0.9.0
func (mapper *DataMapper) UpdateOne(db *gorm.DB, who models.UserIDFetchable, typeString string, modelObj models.IModel, id *datatypes.UUID, options map[urlparam.Param]interface{}, cargo *hookhandler.Cargo) (*MapperRet, *webrender.RetError)
UpdateOne updates model based on this json
type HandlerFetcher ¶ added in v0.9.2
type HandlerFetcher struct {
// contains filtered or unexported fields
}
func NewHandlerFetcher ¶ added in v0.9.2
func NewHandlerFetcher(handlerMap *handlermap.HandlerMap) *HandlerFetcher
NewHandlerFetcher maintains a list of instantiated handlers, if not, instantiate it. Where as NewHandlerMap only handles hookhandler creation
func (*HandlerFetcher) FetchHandlersForOpAndHook ¶ added in v0.9.2
func (c *HandlerFetcher) FetchHandlersForOpAndHook(op hookhandler.RESTOp, hook string) []hookhandler.IHookhandler
FetchHandlersForOpAndHook fetches the releveant hookhandler for this method and hook. If there is any hookhandler whose first hook is this one, instantiate it. If there are already instantiated hookhandler which handles this hook, fetch it as well. hook can be JBAT
func (*HandlerFetcher) GetAllInstantiatedHanders ¶ added in v0.9.2
func (c *HandlerFetcher) GetAllInstantiatedHanders() []hookhandler.IHookhandler
func (*HandlerFetcher) HasRegisteredHandler ¶ added in v0.9.2
func (c *HandlerFetcher) HasRegisteredHandler() bool
type IDataMapper ¶ added in v0.3.3
type IDataMapper interface { CreateMany(db *gorm.DB, who models.UserIDFetchable, typeString string, modelObj []models.IModel, options map[urlparam.Param]interface{}, cargo *hookhandler.Cargo) (*MapperRet, *webrender.RetError) CreateOne(db *gorm.DB, who models.UserIDFetchable, typeString string, modelObj models.IModel, options map[urlparam.Param]interface{}, cargo *hookhandler.Cargo) (*MapperRet, *webrender.RetError) ReadMany(db *gorm.DB, who models.UserIDFetchable, typeString string, options map[urlparam.Param]interface{}, cargo *hookhandler.Cargo) (*MapperRet, []models.UserRole, *int, *webrender.RetError) ReadOne(db *gorm.DB, who models.UserIDFetchable, typeString string, id *datatypes.UUID, options map[urlparam.Param]interface{}, cargo *hookhandler.Cargo) (*MapperRet, models.UserRole, *webrender.RetError) UpdateMany(db *gorm.DB, who models.UserIDFetchable, typeString string, modelObjs []models.IModel, options map[urlparam.Param]interface{}, cargo *hookhandler.Cargo) (*MapperRet, *webrender.RetError) UpdateOne(db *gorm.DB, who models.UserIDFetchable, typeString string, modelobj models.IModel, id *datatypes.UUID, options map[urlparam.Param]interface{}, cargo *hookhandler.Cargo) (*MapperRet, *webrender.RetError) PatchMany(db *gorm.DB, who models.UserIDFetchable, typeString string, jsonIDPatches []models.JSONIDPatch, options map[urlparam.Param]interface{}, cargo *hookhandler.Cargo) (*MapperRet, *webrender.RetError) PatchOne(db *gorm.DB, who models.UserIDFetchable, typeString string, jsonPatch []byte, id *datatypes.UUID, options map[urlparam.Param]interface{}, cargo *hookhandler.Cargo) (*MapperRet, *webrender.RetError) DeleteMany(db *gorm.DB, who models.UserIDFetchable, typeString string, modelObjs []models.IModel, options map[urlparam.Param]interface{}, cargo *hookhandler.Cargo) (*MapperRet, *webrender.RetError) DeleteOne(db *gorm.DB, who models.UserIDFetchable, typeString string, id *datatypes.UUID, options map[urlparam.Param]interface{}, cargo *hookhandler.Cargo) (*MapperRet, *webrender.RetError) }
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 MapperRet ¶ added in v0.9.0
type MapperRet struct { Ms []models.IModel // if for cardinality 1, only contains one element Fetcher *HandlerFetcher }
type UserMapper ¶
UserMapper is a User CRUD manager
func SharedUserMapper ¶
func SharedUserMapper() *UserMapper
SharedUserMapper creats a singleton of Crud object
func (*UserMapper) CreateMany ¶ added in v0.1.24
func (mapper *UserMapper) CreateMany(db *gorm.DB, who models.UserIDFetchable, typeString string, modelObj []models.IModel, options map[urlparam.Param]interface{}, cargo *hookhandler.Cargo) (*MapperRet, *webrender.RetError)
CreateMany :-
func (*UserMapper) CreateOne ¶
func (mapper *UserMapper) CreateOne(db *gorm.DB, who models.UserIDFetchable, typeString string, modelObj models.IModel, options map[urlparam.Param]interface{}, cargo *hookhandler.Cargo) (*MapperRet, *webrender.RetError)
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.UserIDFetchable, typeString string, modelObjs []models.IModel, options map[urlparam.Param]interface{}, cargo *hookhandler.Cargo) (*MapperRet, *webrender.RetError)
DeleteMany :-
func (*UserMapper) DeleteOne ¶ added in v0.5.0
func (mapper *UserMapper) DeleteOne(db *gorm.DB, who models.UserIDFetchable, typeString string, id *datatypes.UUID, options map[urlparam.Param]interface{}, cargo *hookhandler.Cargo) (*MapperRet, *webrender.RetError)
DeleteOne deletes the user with the ID
func (*UserMapper) PatchMany ¶ added in v0.3.3
func (mapper *UserMapper) PatchMany(db *gorm.DB, who models.UserIDFetchable, typeString string, jsonIDPatches []models.JSONIDPatch, options map[urlparam.Param]interface{}, cargo *hookhandler.Cargo) (*MapperRet, *webrender.RetError)
PatchMany :-
func (*UserMapper) PatchOne ¶ added in v0.5.0
func (mapper *UserMapper) PatchOne(db *gorm.DB, who models.UserIDFetchable, typeString string, jsonPatch []byte, id *datatypes.UUID, options map[urlparam.Param]interface{}, cargo *hookhandler.Cargo) (*MapperRet, *webrender.RetError)
PatchOne updates model based on this json
func (*UserMapper) ReadMany ¶ added in v0.5.0
func (mapper *UserMapper) ReadMany(db *gorm.DB, who models.UserIDFetchable, typeString string, options map[urlparam.Param]interface{}, cargo *hookhandler.Cargo) (*MapperRet, []models.UserRole, *int, *webrender.RetError)
ReadMany :-
func (*UserMapper) ReadOne ¶ added in v0.5.0
func (mapper *UserMapper) ReadOne(db *gorm.DB, who models.UserIDFetchable, typeString string, id *datatypes.UUID, options map[urlparam.Param]interface{}, cargo *hookhandler.Cargo) (*MapperRet, models.UserRole, *webrender.RetError)
ReadOne get one model object based on its type and its id string
func (*UserMapper) UpdateMany ¶ added in v0.3.3
func (mapper *UserMapper) UpdateMany(db *gorm.DB, who models.UserIDFetchable, typeString string, modelObjs []models.IModel, options map[urlparam.Param]interface{}, cargo *hookhandler.Cargo) (*MapperRet, *webrender.RetError)
UpdateMany :-
func (*UserMapper) UpdateOne ¶ added in v0.5.0
func (mapper *UserMapper) UpdateOne(db *gorm.DB, who models.UserIDFetchable, typeString string, modelObj models.IModel, id *datatypes.UUID, options map[urlparam.Param]interface{}, cargo *hookhandler.Cargo) (*MapperRet, *webrender.RetError)
UpdateOne updates model based on this json