Documentation ¶
Index ¶
- Variables
- type Controller
- type DeleteResponseDto
- type Entity
- type GetResponseDto
- type PatchRequestDto
- type PatchResponseDto
- type PostRequestDto
- type PostResponseDto
- type Query
- type QueryImpl
- type Repository
- type RepositoryImpl
- func (r *RepositoryImpl) CountById(id string) int64
- func (r *RepositoryImpl) Create(req *Entity) (*Entity, error)
- func (r *RepositoryImpl) DeleteById(id string) error
- func (r *RepositoryImpl) FindById(id string) (*Entity, error)
- func (r *RepositoryImpl) UpdateById(fields map[string]interface{}, id string) error
- type Service
Constants ¶
This section is empty.
Variables ¶
var ( MaxCountUnlimited = -1 RankLowest = 2147483647 )
var ( FieldsAll = []string{ "id", "name", "rank", "max_count", } FieldsAllExceptId = []string{ "name", "rank", "max_count", } FieldsMaxCount = []string{ "max_count", } FieldsPatchable = []string{ "name", "rank", "max_count", } )
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller struct { ConfigService *config.Service LocalErrorService *localerror.Service RoleService *Service }
func NewController ¶
func NewController(cfg *config.Service, les *localerror.Service, svc *Service) *Controller
func (*Controller) Delete ¶
func (c *Controller) Delete(w http.ResponseWriter, r *http.Request)
Delete Roles : HTTP endpoint to delete roles @Tags Roles @Description Delete a role @Produce json @Param id path string true "Role ID" @Success 200 {object} DeleteResponseDto "Success Response" @Failure 400 "BadRequest" @Failure 500 "InternalServerError" @Router /roles/{id} [DELETE]
func (*Controller) Get ¶
func (c *Controller) Get(w http.ResponseWriter, r *http.Request)
Get Roles : HTTP endpoint to get a role @Tags Roles @Description Get a role @Produce json @Param id path string true "Role ID" @Success 200 {object} GetResponseDto "Success Response" @Failure 400 "BadRequest" @Failure 500 "InternalServerError" @Router /roles/{id} [GET]
func (*Controller) Patch ¶
func (c *Controller) Patch(w http.ResponseWriter, r *http.Request)
Patch Roles : HTTP endpoint to patch a role @Tags Roles @Description Patch a role @Accept json @Produce json @Param id path string true "Role ID" @Param data body PatchRequestDto true "Role Patch Request" @Success 200 {object} PatchResponseDto "Success Response" @Failure 400 "BadRequest" @Failure 500 "InternalServerError" @Router /roles/{id} [PATCH]
func (*Controller) Post ¶
func (c *Controller) Post(w http.ResponseWriter, r *http.Request)
Post Roles : HTTP endpoint to post new roles @Tags Roles @Description Post a new role @Accept json @Produce json @Param data body PostRequestDto true "Role Request" @Success 200 {object} PostResponseDto "Success Response" @Failure 400 "BadRequest" @Failure 500 "InternalServerError" @Router /roles [POST]
type DeleteResponseDto ¶
type DeleteResponseDto = dtorespwithoutdata.Class
type GetResponseDto ¶
type GetResponseDto = dtorespwithdata.Class[Entity]
type PatchRequestDto ¶
type PatchRequestDto struct {
Fields map[string]interface{} `json:"fields"`
}
type PatchResponseDto ¶
type PatchResponseDto = dtorespwithoutdata.Class
type PostRequestDto ¶
type PostResponseDto ¶
type PostResponseDto = dtorespwithdata.Class[Entity]
type Repository ¶
type Repository interface { Create(req *Entity) (*Entity, error) FindById(id string) (*Entity, error) UpdateById(fields map[string]interface{}, ehid string) error DeleteById(id string) error CountById(id string) int64 }
func NewRepository ¶
func NewRepository(cfg *config.Service) Repository
type RepositoryImpl ¶
func (*RepositoryImpl) CountById ¶
func (r *RepositoryImpl) CountById(id string) int64
func (*RepositoryImpl) DeleteById ¶
func (r *RepositoryImpl) DeleteById(id string) error
func (*RepositoryImpl) UpdateById ¶
func (r *RepositoryImpl) UpdateById( fields map[string]interface{}, id string, ) error
type Service ¶
type Service struct { ConfigService *config.Service RoleRepository Repository }
func NewService ¶
func NewService( cfg *config.Service, r Repository, ) *Service