Documentation ¶
Index ¶
- Variables
- type Controller
- type DeleteResponseDto
- type Entity
- type GetResponseDto
- type PatchRequestDto
- type PatchResponseDto
- type PostRequestDto
- type PostResponseDto
- type Query
- type QueryImpl
- func (q *QueryImpl) ByEhidAndEndDateIsNull(ehid string) *gorm.DB
- func (q *QueryImpl) ByEhidAndIntersectingDates(ehid string, startDate string, endDate string) *gorm.DB
- func (q *QueryImpl) SelectActiveByEhid(fields []string, ehid string) *gorm.DB
- func (q *QueryImpl) SelectByEhid(fields []string, ehid string) *gorm.DB
- func (q *QueryImpl) SelectByEhidOrderByStartDate(fields []string, ehid string, orderDir string) *gorm.DB
- func (q *QueryImpl) SelectById(fields []string, id int) *gorm.DB
- type Repository
- type RepositoryImpl
- func (r *RepositoryImpl) CountEndDateIsNull(ehid string) (int64, error)
- func (r *RepositoryImpl) CountIntersectingDates(ehid string, startDate string, endDate string) (int64, error)
- func (r *RepositoryImpl) Create(req *Entity) (*Entity, error)
- func (r *RepositoryImpl) DeleteById(id int) error
- func (r *RepositoryImpl) FindByEhidOrderByStartDate(ehid string, orderDir string) ([]Entity, error)
- func (r *RepositoryImpl) FindById(id int) (*Entity, error)
- func (r *RepositoryImpl) FindCurrentByEhid(ehid string) (*Entity, error)
- func (r *RepositoryImpl) UpdateById(fields map[string]interface{}, id int) error
- type Service
- func (s *Service) Create(req PostRequestDto) (*ViewEntity, error)
- func (s *Service) DeleteById(id int) error
- func (s *Service) RetrieveByEhidOrderByStartDate(ehid string, orderDir string) ([]ViewEntity, error)
- func (s *Service) RetrieveById(id int) (*ViewEntity, error)
- func (s *Service) RetrieveCurrentByEhid(ehid string) (*ViewEntity, error)
- func (s *Service) UpdateById(fields map[string]interface{}, id int) error
- type ViewEntity
Constants ¶
This section is empty.
Variables ¶
var ( FieldsAll = []string{ "id", "ehid", "start_date", "end_date", "title", } FieldsAllExceptId = []string{ "ehid", "start_date", "end_date", "title", } FieldsAllExceptIdAndEndDate = []string{ "ehid", "start_date", "title", } FieldsPatchable = []string{ "title", "end_date", } OrderAsc = "ASC" OrderDesc = "DESC" OrderNone = "" )
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller struct { ConfigService *config.Service LocalErrorService *localerror.Service TitlingService *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 Titlings : HTTP endpoint to delete titlings @Tags Titlings @Description Delete a titling @Produce json @Param id path string true "Titling ID" @Success 200 {object} DeleteResponseDto "Success Response" @Failure 400 "BadRequest" @Failure 500 "InternalServerError" @Router /titlings/{id} [DELETE]
func (*Controller) Get ¶
func (c *Controller) Get(w http.ResponseWriter, r *http.Request)
Get Titlings : HTTP endpoint to get titlings @Tags Titlings @Description Get a titling @Produce json @Param id path string true "Titling ID" @Success 200 {object} GetResponseDto "Success Response" @Failure 400 "BadRequest" @Failure 500 "InternalServerError" @Router /titlings/{id} [GET]
func (*Controller) Patch ¶
func (c *Controller) Patch(w http.ResponseWriter, r *http.Request)
Patch Titlings : HTTP endpoint to patch a titling @Tags Titlings @Description Patch a titling @Accept json @Produce json @Param id path string true "Titling ID" @Param data body PatchRequestDto true "Titling Patch Request" @Success 200 {object} PatchResponseDto "Success Response" @Failure 400 "BadRequest" @Failure 500 "InternalServerError" @Router /titlings/{id} [PATCH]
func (*Controller) Post ¶
func (c *Controller) Post(w http.ResponseWriter, r *http.Request)
Post Titlings : HTTP endpoint to post new titlings @Tags Titlings @Description Post a new titlings @Accept json @Produce json @Param data body PostRequestDto true "Titling Request" @Success 200 {object} PostResponseDto "Success Response" @Failure 400 "BadRequest" @Failure 500 "InternalServerError" @Router /titlings [POST]
type DeleteResponseDto ¶
type DeleteResponseDto = dtorespwithoutdata.Class
type GetResponseDto ¶
type GetResponseDto = dtorespwithdata.Class[ViewEntity]
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[ViewEntity]
type Query ¶
type Query interface { SelectById(fields []string, id int) *gorm.DB SelectByEhid(fields []string, ehid string) *gorm.DB SelectByEhidOrderByStartDate(fields []string, ehid string, orderDir string) *gorm.DB SelectActiveByEhid(fields []string, ehid string) *gorm.DB ByEhidAndIntersectingDates(ehid string, startDate string, endDate string) *gorm.DB ByEhidAndEndDateIsNull(ehid string) *gorm.DB }
type QueryImpl ¶
func (*QueryImpl) ByEhidAndEndDateIsNull ¶
func (*QueryImpl) ByEhidAndIntersectingDates ¶
func (*QueryImpl) SelectActiveByEhid ¶
func (*QueryImpl) SelectByEhid ¶
func (*QueryImpl) SelectByEhidOrderByStartDate ¶
type Repository ¶
type Repository interface { Create(req *Entity) (*Entity, error) FindById(id int) (*Entity, error) UpdateById(fields map[string]interface{}, id int) error DeleteById(id int) error FindByEhidOrderByStartDate(ehid string, orderDir string) ([]Entity, error) FindCurrentByEhid(ehid string) (*Entity, error) CountIntersectingDates(ehid string, startDate string, endDate string) (int64, error) CountEndDateIsNull(endDate string) (int64, error) }
func NewRepository ¶
func NewRepository(cfg *config.Service) Repository
type RepositoryImpl ¶
func (*RepositoryImpl) CountEndDateIsNull ¶
func (r *RepositoryImpl) CountEndDateIsNull(ehid string) (int64, error)
func (*RepositoryImpl) CountIntersectingDates ¶
func (*RepositoryImpl) DeleteById ¶
func (r *RepositoryImpl) DeleteById(id int) error
func (*RepositoryImpl) FindByEhidOrderByStartDate ¶
func (r *RepositoryImpl) FindByEhidOrderByStartDate(ehid string, orderDir string) ([]Entity, error)
func (*RepositoryImpl) FindCurrentByEhid ¶
func (r *RepositoryImpl) FindCurrentByEhid(ehid string) (*Entity, error)
func (*RepositoryImpl) UpdateById ¶
func (r *RepositoryImpl) UpdateById(fields map[string]interface{}, id int) error
type Service ¶
type Service struct { ConfigService *config.Service TitlingRepository Repository }
func NewService ¶
func NewService( cfg *config.Service, r Repository, ) *Service
func (*Service) Create ¶
func (s *Service) Create(req PostRequestDto) (*ViewEntity, error)
func (*Service) DeleteById ¶
func (*Service) RetrieveByEhidOrderByStartDate ¶
func (s *Service) RetrieveByEhidOrderByStartDate(ehid string, orderDir string) ([]ViewEntity, error)
func (*Service) RetrieveById ¶
func (s *Service) RetrieveById(id int) (*ViewEntity, error)
func (*Service) RetrieveCurrentByEhid ¶
func (s *Service) RetrieveCurrentByEhid(ehid string) (*ViewEntity, error)