Documentation ¶
Index ¶
- Variables
- type BaseService
- func (serv *BaseService) CreateOneCore(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, ...) (models.IModel, error)
- func (serv *BaseService) DeleteOneCore(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, ...) (models.IModel, error)
- func (serv *BaseService) GetOneWithIDCore(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, ...) (models.IModel, models.UserRole, error)
- func (serv *BaseService) UpdateOneCore(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, ...) (modelObj2 models.IModel, err error)
- type GlobalService
- func (serv *GlobalService) GetAllQueryContructCore(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string) (*gorm.DB, error)
- func (serv *GlobalService) GetAllRolesCore(dbChained *gorm.DB, dbClean *gorm.DB, oid *datatypes.UUID, scope *string, ...) ([]models.UserRole, error)
- func (service *GlobalService) GetManyWithIDsCore(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, ...) ([]models.IModel, []models.UserRole, error)
- func (service *GlobalService) GetOneWithIDCore(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, ...) (models.IModel, models.UserRole, error)
- func (serv *GlobalService) HookBeforeCreateMany(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, ...) ([]models.IModel, error)
- func (serv *GlobalService) HookBeforeCreateOne(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, ...) (models.IModel, error)
- func (serv *GlobalService) HookBeforeDeleteMany(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, ...) ([]models.IModel, error)
- func (serv *GlobalService) HookBeforeDeleteOne(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, ...) (models.IModel, error)
- func (serv *GlobalService) UpdateOneCore(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, ...) (modelObj2 models.IModel, err error)
- type IService
- type LinkTableService
- func (serv *LinkTableService) GetAllQueryContructCore(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string) (*gorm.DB, error)
- func (serv *LinkTableService) GetAllRolesCore(dbChained *gorm.DB, dbClean *gorm.DB, oid *datatypes.UUID, scope *string, ...) ([]models.UserRole, error)
- func (serv *LinkTableService) GetManyWithIDsCore(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, ...) ([]models.IModel, []models.UserRole, error)
- func (service *LinkTableService) GetOneWithIDCore(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, ...) (models.IModel, models.UserRole, error)
- func (serv *LinkTableService) HookBeforeCreateMany(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, ...) ([]models.IModel, error)
- func (serv *LinkTableService) HookBeforeCreateOne(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, ...) (models.IModel, error)
- func (serv *LinkTableService) HookBeforeDeleteMany(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, ...) ([]models.IModel, error)
- func (serv *LinkTableService) HookBeforeDeleteOne(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, ...) (models.IModel, error)
- func (serv *LinkTableService) UpdateOneCore(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, ...) (modelObj2 models.IModel, err error)
- type OrganizationService
- func (serv *OrganizationService) GetAllQueryContructCore(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string) (*gorm.DB, error)
- func (serv *OrganizationService) GetAllRolesCore(dbChained *gorm.DB, dbClean *gorm.DB, oid *datatypes.UUID, scope *string, ...) ([]models.UserRole, error)
- func (serv *OrganizationService) GetManyWithIDsCore(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, ...) ([]models.IModel, []models.UserRole, error)
- func (serv *OrganizationService) GetOneWithIDCore(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, ...) (models.IModel, models.UserRole, error)
- func (serv *OrganizationService) HookBeforeCreateMany(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, ...) ([]models.IModel, error)
- func (serv *OrganizationService) HookBeforeCreateOne(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, ...) (models.IModel, error)
- func (serv *OrganizationService) HookBeforeDeleteMany(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, ...) ([]models.IModel, error)
- func (serv *OrganizationService) HookBeforeDeleteOne(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, ...) (models.IModel, error)
- func (serv *OrganizationService) UpdateOneCore(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, ...) (modelObj2 models.IModel, err error)
- type OwnershipService
- func (serv *OwnershipService) CreateOneCore(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, ...) (models.IModel, error)
- func (serv *OwnershipService) GetAllQueryContructCore(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string) (*gorm.DB, error)
- func (serv *OwnershipService) GetAllRolesCore(dbChained *gorm.DB, dbClean *gorm.DB, oid *datatypes.UUID, scope *string, ...) ([]models.UserRole, error)
- func (serv *OwnershipService) GetManyWithIDsCore(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, ...) ([]models.IModel, []models.UserRole, error)
- func (serv *OwnershipService) GetOneWithIDCore(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, ...) (models.IModel, models.UserRole, error)
- func (serv *OwnershipService) HookBeforeCreateMany(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, ...) ([]models.IModel, error)
- func (serv *OwnershipService) HookBeforeCreateOne(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, ...) (models.IModel, error)
- func (serv *OwnershipService) HookBeforeDeleteMany(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, ...) ([]models.IModel, error)
- func (serv *OwnershipService) HookBeforeDeleteOne(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, ...) (models.IModel, error)
- func (serv *OwnershipService) UpdateOneCore(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, ...) (modelObj2 models.IModel, err error)
- type UserService
- func (serv *UserService) GetAllQueryContructCore(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string) (*gorm.DB, error)
- func (serv *UserService) GetAllRolesCore(dbChained *gorm.DB, dbClean *gorm.DB, oid *datatypes.UUID, scope *string, ...) ([]models.UserRole, error)
- func (serv *UserService) GetManyWithIDsCore(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, ...) ([]models.IModel, []models.UserRole, error)
- func (serv *UserService) GetOneWithIDCore(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, ...) (models.IModel, models.UserRole, error)
- func (serv *UserService) HookBeforeCreateMany(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, ...) ([]models.IModel, error)
- func (serv *UserService) HookBeforeCreateOne(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, ...) (models.IModel, error)
- func (serv *UserService) HookBeforeDeleteMany(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, ...) ([]models.IModel, error)
- func (serv *UserService) HookBeforeDeleteOne(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, ...) (models.IModel, error)
- func (serv *UserService) UpdateOneCore(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, ...) (modelObj2 models.IModel, err error)
Constants ¶
This section is empty.
Variables ¶
var ErrBatchUpdateOrPatchOneNotFound = errors.New("at least one not found")
var ErrIDEmpty = errors.New("cannot operate when ID is empty")
var ErrIDNotMatch = errors.New("cannot operate when ID in HTTP body and URL parameter not match")
var ErrPatch = errors.New("patch syntax error") // json: cannot unmarshal object into Go value of type jsonpatch.Patch
var ErrPermission = errors.New("permission denied")
Error
var ErrPermissionWrongEndPoint = errors.New("permission denied. Change it through the resource endpoint or unable to change your own role.")
Functions ¶
This section is empty.
Types ¶
type BaseService ¶
type BaseService struct { }
BaseService is the superclass of all services
func (*BaseService) CreateOneCore ¶
func (serv *BaseService) CreateOneCore(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, modelObj models.IModel, id *datatypes.UUID, oldModelObj models.IModel) (models.IModel, error)
CreateOneCoreBasic create something
func (*BaseService) DeleteOneCore ¶
func (*BaseService) GetOneWithIDCore ¶
func (*BaseService) UpdateOneCore ¶
func (serv *BaseService) UpdateOneCore(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, modelObj models.IModel, id *datatypes.UUID, oldModelObj models.IModel) (modelObj2 models.IModel, err error)
UpdateOneCore one, permissin should already be checked called for patch operation as well (after patch has already applied) Fuck, repeat the following code for now (you can't call the overriding method from the non-overriding one)
type GlobalService ¶
type GlobalService struct {
BaseService
}
func (*GlobalService) GetAllQueryContructCore ¶ added in v0.3.4
func (serv *GlobalService) GetAllQueryContructCore(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string) (*gorm.DB, error)
GetAllQueryContructCore construct the meat of the query
func (*GlobalService) GetAllRolesCore ¶ added in v0.3.4
func (serv *GlobalService) GetAllRolesCore(dbChained *gorm.DB, dbClean *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, modelObjs []models.IModel) ([]models.UserRole, error)
GetAllRolesCore gets all roles according to the criteria
func (*GlobalService) GetManyWithIDsCore ¶
func (*GlobalService) GetOneWithIDCore ¶
func (service *GlobalService) GetOneWithIDCore(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, id *datatypes.UUID) (models.IModel, models.UserRole, error)
GetOneWithIDCore get one model object based on its type and its id string
func (*GlobalService) HookBeforeCreateMany ¶
func (*GlobalService) HookBeforeCreateOne ¶
func (*GlobalService) HookBeforeDeleteMany ¶
func (*GlobalService) HookBeforeDeleteOne ¶
func (*GlobalService) UpdateOneCore ¶
func (serv *GlobalService) UpdateOneCore(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, modelObj models.IModel, id *datatypes.UUID, oldModelObj models.IModel) (modelObj2 models.IModel, err error)
UpdateOneCore one, permissin should already be checked called for patch operation as well (after patch has already applied) Fuck, repeat the following code for now (you can't call the overriding method from the non-overriding one)
type IService ¶
type IService interface { HookBeforeCreateOne(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, modelObj models.IModel) (models.IModel, error) HookBeforeCreateMany(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, modelObjs []models.IModel) ([]models.IModel, error) HookBeforeDeleteOne(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, modelObj models.IModel) (models.IModel, error) HookBeforeDeleteMany(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, modelObjs []models.IModel) ([]models.IModel, error) CreateOneCore(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, modelObj models.IModel, id *datatypes.UUID, oldModelObj models.IModel) (models.IModel, error) UpdateOneCore(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, modelObj models.IModel, id *datatypes.UUID, oldModelObj models.IModel) (modelObj2 models.IModel, err error) DeleteOneCore(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, modelObj models.IModel, id *datatypes.UUID, oldModelObjs models.IModel) (models.IModel, error) GetOneWithIDCore(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, id *datatypes.UUID) (models.IModel, models.UserRole, error) GetManyWithIDsCore(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, ids []*datatypes.UUID) ([]models.IModel, []models.UserRole, error) GetAllQueryContructCore(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string) (*gorm.DB, error) GetAllRolesCore(dbChained *gorm.DB, dbClean *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, modelObjs []models.IModel) ([]models.UserRole, error) }
IService provice basic data fetch for various type of table to user relationships
type LinkTableService ¶
type LinkTableService struct {
BaseService
}
func (*LinkTableService) GetAllQueryContructCore ¶ added in v0.3.4
func (serv *LinkTableService) GetAllQueryContructCore(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string) (*gorm.DB, error)
GetAllQueryContructCore construct query core
func (*LinkTableService) GetAllRolesCore ¶ added in v0.3.4
func (serv *LinkTableService) GetAllRolesCore(dbChained *gorm.DB, dbClean *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, modelObjs []models.IModel) ([]models.UserRole, error)
GetAllRolesCore gets all roles according to the criteria
func (*LinkTableService) GetManyWithIDsCore ¶
func (*LinkTableService) GetOneWithIDCore ¶
func (service *LinkTableService) GetOneWithIDCore(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, id *datatypes.UUID) (models.IModel, models.UserRole, error)
getOneWithIDCore get one model object based on its type and its id string since this is organizationMapper, need to make sure it's the same organization
func (*LinkTableService) HookBeforeCreateMany ¶
func (*LinkTableService) HookBeforeCreateOne ¶
func (*LinkTableService) HookBeforeDeleteMany ¶
func (*LinkTableService) HookBeforeDeleteOne ¶
func (*LinkTableService) UpdateOneCore ¶
func (serv *LinkTableService) UpdateOneCore(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, modelObj models.IModel, id *datatypes.UUID, oldModelObj models.IModel) (modelObj2 models.IModel, err error)
UpdateOneCore one, permissin should already be checked called for patch operation as well (after patch has already applied) Fuck, repeat the following code for now (you can't call the overriding method from the non-overriding one)
type OrganizationService ¶
type OrganizationService struct {
BaseService
}
OrganizationService handles all the ownership specific db calls
func (*OrganizationService) GetAllQueryContructCore ¶ added in v0.3.4
func (serv *OrganizationService) GetAllQueryContructCore(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string) (*gorm.DB, error)
GetAllQueryContructCore construct query core
func (*OrganizationService) GetAllRolesCore ¶ added in v0.3.4
func (serv *OrganizationService) GetAllRolesCore(dbChained *gorm.DB, dbClean *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, modelObjs []models.IModel) ([]models.UserRole, error)
GetAllRolesCore gets all roles according to the criteria
func (*OrganizationService) GetManyWithIDsCore ¶
func (*OrganizationService) GetOneWithIDCore ¶
func (serv *OrganizationService) GetOneWithIDCore(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, id *datatypes.UUID) (models.IModel, models.UserRole, error)
getOneWithIDCore get one model object based on its type and its id string since this is organizationMapper, need to make sure it's the same organization
func (*OrganizationService) HookBeforeCreateMany ¶
func (*OrganizationService) HookBeforeCreateOne ¶
func (*OrganizationService) HookBeforeDeleteMany ¶
func (*OrganizationService) HookBeforeDeleteOne ¶
func (*OrganizationService) UpdateOneCore ¶
func (serv *OrganizationService) UpdateOneCore(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, modelObj models.IModel, id *datatypes.UUID, oldModelObj models.IModel) (modelObj2 models.IModel, err error)
UpdateOneCore one, permissin should already be checked called for patch operation as well (after patch has already applied) Fuck, repeat the following code for now (you can't call the overriding method from the non-overriding one)
type OwnershipService ¶
type OwnershipService struct {
BaseService
}
OwnershipService handles all the ownership specific db calls
func (*OwnershipService) CreateOneCore ¶
func (serv *OwnershipService) CreateOneCore(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, modelObj models.IModel, id *datatypes.UUID, oldModelObj models.IModel) (models.IModel, error)
CreateOneCore creates the stuff
func (*OwnershipService) GetAllQueryContructCore ¶ added in v0.3.4
func (serv *OwnershipService) GetAllQueryContructCore(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string) (*gorm.DB, error)
GetAllQueryContructCore construct the meat of the query
func (*OwnershipService) GetAllRolesCore ¶ added in v0.3.4
func (serv *OwnershipService) GetAllRolesCore(dbChained *gorm.DB, dbClean *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, modelObjs []models.IModel) ([]models.UserRole, error)
GetAllRolesCore gets all roles according to the criteria
func (*OwnershipService) GetManyWithIDsCore ¶
func (serv *OwnershipService) GetManyWithIDsCore(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, ids []*datatypes.UUID) ([]models.IModel, []models.UserRole, error)
GetManyWithIDsCore -
func (*OwnershipService) GetOneWithIDCore ¶
func (serv *OwnershipService) GetOneWithIDCore(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, id *datatypes.UUID) (models.IModel, models.UserRole, error)
GetOneWithIDCore get one model object based on its type and its id string
func (*OwnershipService) HookBeforeCreateMany ¶
func (*OwnershipService) HookBeforeCreateOne ¶
func (*OwnershipService) HookBeforeDeleteMany ¶
func (serv *OwnershipService) HookBeforeDeleteMany(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, modelObjs []models.IModel) ([]models.IModel, error)
HookBeforeDeleteMany deletes link table because GORM isn't automatic here when we customize it with UUID or when we have role
func (*OwnershipService) HookBeforeDeleteOne ¶
func (*OwnershipService) UpdateOneCore ¶
func (serv *OwnershipService) UpdateOneCore(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, modelObj models.IModel, id *datatypes.UUID, oldModelObj models.IModel) (modelObj2 models.IModel, err error)
UpdateOneCore one, permissin should already be checked called for patch operation as well (after patch has already applied) Fuck, repeat the following code for now (you can't call the overriding method from the non-overriding one)
type UserService ¶
type UserService struct {
BaseService
}
func (*UserService) GetAllQueryContructCore ¶ added in v0.3.4
func (serv *UserService) GetAllQueryContructCore(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string) (*gorm.DB, error)
GetAllQueryContructCore :-
func (*UserService) GetAllRolesCore ¶ added in v0.3.4
func (serv *UserService) GetAllRolesCore(dbChained *gorm.DB, dbClean *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, modelObjs []models.IModel) ([]models.UserRole, error)
GetAllRolesCore :-
func (*UserService) GetManyWithIDsCore ¶
func (*UserService) GetOneWithIDCore ¶
func (serv *UserService) GetOneWithIDCore(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, id *datatypes.UUID) (models.IModel, models.UserRole, error)
GetOneWithIDCore get one model object based on its type and its id string getOneWithID get one model object based on its type and its id string without invoking read hookpoing
func (*UserService) HookBeforeCreateMany ¶
func (*UserService) HookBeforeCreateOne ¶
func (*UserService) HookBeforeDeleteMany ¶
func (*UserService) HookBeforeDeleteOne ¶
func (*UserService) UpdateOneCore ¶
func (serv *UserService) UpdateOneCore(db *gorm.DB, oid *datatypes.UUID, scope *string, typeString string, modelObj models.IModel, id *datatypes.UUID, oldModelObj models.IModel) (modelObj2 models.IModel, err error)
UpdateOneCore one, permissin should already be checked called for patch operation as well (after patch has already applied) Fuck, repeat the following code for now (you can't call the overriding method from the non-overriding one)