datamapper

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2022 License: MIT Imports: 23 Imported by: 0

Documentation

Index

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 BaseMapper added in v0.3.3

type BaseMapper struct {
	Service service.IService
}

BaseMapper is a basic CRUD manager

func (*BaseMapper) CreateMany added in v0.3.3

func (mapper *BaseMapper) CreateMany(db *gorm.DB, who models.UserIDFetchable, typeString string, modelObjs []models.IModel,
	options map[urlparam.Param]interface{}, cargo *controller.Cargo) ([]models.IModel, *webrender.RetVal)

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.UserIDFetchable, typeString string, modelObj models.IModel,
	options map[urlparam.Param]interface{}, cargo *controller.Cargo) (models.IModel, *webrender.RetVal)

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.UserIDFetchable, typeString string, modelObjs []models.IModel,
	options map[urlparam.Param]interface{}, cargo *controller.Cargo) ([]models.IModel, *webrender.RetVal)

DeleteMany deletes multiple models

func (*BaseMapper) DeleteOne added in v0.5.0

func (mapper *BaseMapper) DeleteOne(db *gorm.DB, who models.UserIDFetchable, typeString string,
	id *datatypes.UUID, options map[urlparam.Param]interface{}, cargo *controller.Cargo) (models.IModel, *webrender.RetVal)

DeleteOne delete the model TODO: delete the groups associated with this record?

func (*BaseMapper) PatchMany added in v0.3.3

func (mapper *BaseMapper) PatchMany(db *gorm.DB, who models.UserIDFetchable, typeString string,
	jsonIDPatches []models.JSONIDPatch, options map[urlparam.Param]interface{},
	cargo *controller.Cargo) ([]models.IModel, *webrender.RetVal)

PatchMany patches multiple models

func (*BaseMapper) PatchOne added in v0.5.0

func (mapper *BaseMapper) PatchOne(db *gorm.DB, who models.UserIDFetchable, typeString string, jsonPatch []byte,
	id *datatypes.UUID, options map[urlparam.Param]interface{}, cargo *controller.Cargo) (models.IModel, *webrender.RetVal)

PatchOne updates model based on this json

func (*BaseMapper) ReadMany added in v0.5.0

func (mapper *BaseMapper) ReadMany(db *gorm.DB, who models.UserIDFetchable, typeString string,
	options map[urlparam.Param]interface{}, cargo *controller.Cargo) ([]models.IModel, []models.UserRole, *int, *webrender.RetVal)

func (*BaseMapper) ReadOne added in v0.5.0

func (mapper *BaseMapper) ReadOne(db *gorm.DB, who models.UserIDFetchable, typeString string, id *datatypes.UUID,
	options map[urlparam.Param]interface{}, cargo *controller.Cargo) (models.IModel, models.UserRole, *webrender.RetVal)

ReadOne get one model object based on its type and its id string

func (*BaseMapper) UpdateMany added in v0.3.3

func (mapper *BaseMapper) UpdateMany(db *gorm.DB, who models.UserIDFetchable, typeString string,
	modelObjs []models.IModel, options map[urlparam.Param]interface{},
	cargo *controller.Cargo) ([]models.IModel, *webrender.RetVal)

UpdateMany updates multiple models

func (*BaseMapper) UpdateOne added in v0.5.0

func (mapper *BaseMapper) UpdateOne(db *gorm.DB, who models.UserIDFetchable, typeString string,
	modelObj models.IModel, id *datatypes.UUID, options map[urlparam.Param]interface{}, cargo *controller.Cargo) (models.IModel, *webrender.RetVal)

UpdateOne updates model based on this json

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 *controller.Cargo) ([]models.IModel, *webrender.RetVal)

	CreateOne(db *gorm.DB, who models.UserIDFetchable, typeString string, modelObj models.IModel,
		options map[urlparam.Param]interface{}, cargo *controller.Cargo) (models.IModel, *webrender.RetVal)

	ReadMany(db *gorm.DB, who models.UserIDFetchable,
		typeString string, options map[urlparam.Param]interface{},
		cargo *controller.Cargo) ([]models.IModel, []models.UserRole, *int, *webrender.RetVal)

	ReadOne(db *gorm.DB, who models.UserIDFetchable,
		typeString string, id *datatypes.UUID, options map[urlparam.Param]interface{},
		cargo *controller.Cargo) (models.IModel, models.UserRole, *webrender.RetVal)

	UpdateMany(db *gorm.DB, who models.UserIDFetchable,
		typeString string, modelObjs []models.IModel,
		options map[urlparam.Param]interface{},
		cargo *controller.Cargo) ([]models.IModel, *webrender.RetVal)

	UpdateOne(db *gorm.DB, who models.UserIDFetchable,
		typeString string, modelobj models.IModel, id *datatypes.UUID,
		options map[urlparam.Param]interface{},
		cargo *controller.Cargo) (models.IModel, *webrender.RetVal)

	PatchMany(db *gorm.DB, who models.UserIDFetchable,
		typeString string, jsonIDPatches []models.JSONIDPatch,
		options map[urlparam.Param]interface{},
		cargo *controller.Cargo) ([]models.IModel, *webrender.RetVal)

	PatchOne(db *gorm.DB, who models.UserIDFetchable,
		typeString string, jsonPatch []byte, id *datatypes.UUID,
		options map[urlparam.Param]interface{},
		cargo *controller.Cargo) (models.IModel, *webrender.RetVal)

	DeleteMany(db *gorm.DB, who models.UserIDFetchable,
		typeString string, modelObjs []models.IModel,
		options map[urlparam.Param]interface{},
		cargo *controller.Cargo) ([]models.IModel, *webrender.RetVal)

	DeleteOne(db *gorm.DB, who models.UserIDFetchable,
		typeString string, id *datatypes.UUID, options map[urlparam.Param]interface{},
		cargo *controller.Cargo) (models.IModel, *webrender.RetVal)
}

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 UserMapper

type UserMapper struct {
	Service service.IService
}

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 *controller.Cargo) ([]models.IModel, *webrender.RetVal)

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 *controller.Cargo) (models.IModel, *webrender.RetVal)

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 *controller.Cargo) ([]models.IModel, *webrender.RetVal)

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 *controller.Cargo) (models.IModel, *webrender.RetVal)

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 *controller.Cargo) ([]models.IModel, *webrender.RetVal)

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 *controller.Cargo) (models.IModel, *webrender.RetVal)

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 *controller.Cargo) ([]models.IModel, []models.UserRole, *int, *webrender.RetVal)

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 *controller.Cargo) (models.IModel, models.UserRole, *webrender.RetVal)

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 *controller.Cargo) ([]models.IModel, *webrender.RetVal)

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 *controller.Cargo) (models.IModel, *webrender.RetVal)

UpdateOne updates model based on this json

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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