datamapper

package
v0.1.29 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2020 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ICreateMapper added in v0.1.25

type ICreateMapper interface {
	CreateOne(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, modelObj models.IModel) (models.IModel, error)
	CreateMany(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, modelObj []models.IModel) ([]models.IModel, error)
}

ICreateMapper has a create one interface

type IDeleteMany

type IDeleteMany interface {
	DeleteMany(db *gorm.DB, oid *datatypes.UUID, scope *string,
		typeString string, modelObjs []models.IModel) ([]models.IModel, error)
}

IDeleteMany delete many records

type IDeleteOneWithID

type IDeleteOneWithID interface {
	DeleteOneWithID(db *gorm.DB, oid *datatypes.UUID, scope *string,
		typeString string, id datatypes.UUID) (models.IModel, error)
}

IDeleteOneWithID delete a record with the ID

type IGetAllMapper

type IGetAllMapper interface {
	ReadAll(db *gorm.DB, oid *datatypes.UUID, scope *string,
		typeString string, options map[string]interface{}) ([]models.IModel, []models.UserRole, error)
}

IGetAllMapper gets all record

type IGetOneWithIDMapper

type IGetOneWithIDMapper interface {
	GetOneWithID(db *gorm.DB, oid *datatypes.UUID, scope *string,
		typeString string, id datatypes.UUID) (models.IModel, models.UserRole, error)
	// contains filtered or unexported methods
}

IGetOneWithIDMapper gets a record with ID

type IPatchOneWithIDMapper

type IPatchOneWithIDMapper interface {
	PatchOneWithID(db *gorm.DB, oid *datatypes.UUID, scope *string,
		typeString string, jsonPatch []byte, id datatypes.UUID) (models.IModel, error)
}

IPatchOneWithIDMapper patch a record with the ID

type IUpdateManyMapper

type IUpdateManyMapper interface {
	UpdateMany(db *gorm.DB, oid *datatypes.UUID, scope *string,
		typeString string, modelObjs []models.IModel) ([]models.IModel, error)
}

IUpdateManyMapper updates many records

type IUpdateOneWithIDMapper

type IUpdateOneWithIDMapper interface {
	UpdateOneWithID(db *gorm.DB, oid *datatypes.UUID, scope *string,
		typeString string, modelobj models.IModel, id datatypes.UUID) (models.IModel, error)
}

IUpdateOneWithIDMapper updates a record with the ID

type OrganizationMapper added in v0.1.28

type OrganizationMapper struct {
}

OrganizationMapper is a basic CRUD manager

func SharedOrganizationMapper added in v0.1.28

func SharedOrganizationMapper() *OrganizationMapper

SharedOrganizationMapper creats a singleton of Crud object

func (*OrganizationMapper) CreateMany added in v0.1.28

func (mapper *OrganizationMapper) CreateMany(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, modelObjs []models.IModel) ([]models.IModel, error)

CreateMany creates an instance of this model based on json and store it in db

func (*OrganizationMapper) CreateOne added in v0.1.28

func (mapper *OrganizationMapper) CreateOne(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, modelObj models.IModel) (models.IModel, error)

CreateOne creates an instance of this model based on json and store it in db when creating, need to put yourself in OrganizationUser as well. Well check this!!

func (*OrganizationMapper) DeleteMany added in v0.1.28

func (mapper *OrganizationMapper) DeleteMany(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, modelObjs []models.IModel) ([]models.IModel, error)

DeleteMany deletes multiple models

func (*OrganizationMapper) DeleteOneWithID added in v0.1.28

func (mapper *OrganizationMapper) DeleteOneWithID(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, id datatypes.UUID) (models.IModel, error)

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

func (*OrganizationMapper) GetOneWithID added in v0.1.28

func (mapper *OrganizationMapper) GetOneWithID(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, id datatypes.UUID) (models.IModel, models.UserRole, error)

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

func (*OrganizationMapper) PatchOneWithID added in v0.1.28

func (mapper *OrganizationMapper) PatchOneWithID(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, jsonPatch []byte, id datatypes.UUID) (models.IModel, error)

PatchOneWithID updates model based on this json

func (*OrganizationMapper) ReadAll added in v0.1.28

func (mapper *OrganizationMapper) ReadAll(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, options map[string]interface{}) ([]models.IModel, []models.UserRole, error)

ReadAll 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 (*OrganizationMapper) UpdateMany added in v0.1.28

func (mapper *OrganizationMapper) UpdateMany(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, modelObjs []models.IModel) ([]models.IModel, error)

UpdateMany updates multiple models

func (*OrganizationMapper) UpdateOneWithID added in v0.1.28

func (mapper *OrganizationMapper) UpdateOneWithID(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, modelObj models.IModel, id datatypes.UUID) (models.IModel, error)

UpdateOneWithID updates model based on this json

type OwnershipMapper added in v0.1.18

type OwnershipMapper struct {
}

OwnershipMapper is a basic CRUD manager

func SharedOwnershipMapper added in v0.1.18

func SharedOwnershipMapper() *OwnershipMapper

SharedOwnershipMapper creats a singleton of Crud object

func (*OwnershipMapper) CreateMany added in v0.1.24

func (mapper *OwnershipMapper) CreateMany(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, modelObjs []models.IModel) ([]models.IModel, error)

CreateMany creates an instance of this model based on json and store it in db

func (*OwnershipMapper) CreateOne added in v0.1.18

func (mapper *OwnershipMapper) CreateOne(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, modelObj models.IModel) (models.IModel, error)

CreateOne creates an instance of this model based on json and store it in db

func (*OwnershipMapper) DeleteMany added in v0.1.18

func (mapper *OwnershipMapper) DeleteMany(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, modelObjs []models.IModel) ([]models.IModel, error)

DeleteMany deletes multiple models

func (*OwnershipMapper) DeleteOneWithID added in v0.1.18

func (mapper *OwnershipMapper) DeleteOneWithID(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, id datatypes.UUID) (models.IModel, error)

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

func (*OwnershipMapper) GetOneWithID added in v0.1.18

func (mapper *OwnershipMapper) GetOneWithID(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, id datatypes.UUID) (models.IModel, models.UserRole, error)

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

func (*OwnershipMapper) PatchOneWithID added in v0.1.18

func (mapper *OwnershipMapper) PatchOneWithID(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, jsonPatch []byte, id datatypes.UUID) (models.IModel, error)

PatchOneWithID updates model based on this json

func (*OwnershipMapper) ReadAll added in v0.1.18

func (mapper *OwnershipMapper) ReadAll(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, options map[string]interface{}) ([]models.IModel, []models.UserRole, error)

ReadAll 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 (*OwnershipMapper) UpdateMany added in v0.1.18

func (mapper *OwnershipMapper) UpdateMany(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, modelObjs []models.IModel) ([]models.IModel, error)

UpdateMany updates multiple models

func (*OwnershipMapper) UpdateOneWithID added in v0.1.18

func (mapper *OwnershipMapper) UpdateOneWithID(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, modelObj models.IModel, id datatypes.UUID) (models.IModel, error)

UpdateOneWithID updates model based on this json

type UserMapper

type UserMapper struct {
}

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, oid *datatypes.UUID, scope *string, typeString string, modelObjs []models.IModel) ([]models.IModel, error)

CreateMany is currently a dummy

func (*UserMapper) CreateOne

func (mapper *UserMapper) CreateOne(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, modelObj models.IModel) (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) DeleteOneWithID

func (mapper *UserMapper) DeleteOneWithID(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, id datatypes.UUID) (models.IModel, error)

DeleteOneWithID deletes the user with the ID

func (*UserMapper) GetOneWithID

func (mapper *UserMapper) GetOneWithID(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, id datatypes.UUID) (models.IModel, models.UserRole, error)

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

func (*UserMapper) UpdateOneWithID

func (mapper *UserMapper) UpdateOneWithID(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, modelObj models.IModel, id datatypes.UUID) (models.IModel, error)

UpdateOneWithID updates model based on this json

Jump to

Keyboard shortcuts

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