Documentation
¶
Index ¶
- type StringController
- func (s *StringController) CreateOne(c *gin.Context)
- func (s *StringController) DeleteById(c *gin.Context)
- func (s *StringController) FindAll(c *gin.Context)
- func (s *StringController) RegisterRoutes(router *gin.RouterGroup)
- func (s *StringController) UpdateName(c *gin.Context)
- func (s *StringController) UpdateOrder(c *gin.Context)
- type StringInteractor
- type StringOrderDTO
- type StringRepository
- func (s *StringRepository) CreateOne(coreString core.String) (core.String, error)
- func (s *StringRepository) DeleteAllByThread(threadId uuid.UUID) error
- func (s *StringRepository) DeleteById(id uuid.UUID) error
- func (s *StringRepository) FindAll() ([]core.String, error)
- func (s *StringRepository) FindAllByThread(threadId uuid.UUID) ([]core.String, error)
- func (s *StringRepository) UpdateName(stringId uuid.UUID, name string) error
- func (s *StringRepository) UpdateOrder(stringOrders []core.StringOrder) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type StringController ¶
type StringController struct { Interactor StringInteractor Logger logging.Logger }
StringController is the api object that allows for http requests into our application
func (*StringController) CreateOne ¶
func (s *StringController) CreateOne(c *gin.Context)
CreateOne creates a single string object
func (*StringController) DeleteById ¶
func (s *StringController) DeleteById(c *gin.Context)
DeleteById deletes a string by a string uuid passed as part of the req uri path
func (*StringController) FindAll ¶
func (s *StringController) FindAll(c *gin.Context)
FindAll fetches all strings or all strings associated with a certain thread if you pass a uuid as a `thread` query param
func (*StringController) RegisterRoutes ¶
func (s *StringController) RegisterRoutes(router *gin.RouterGroup)
RegisterRoutes creates a gin route grouping for the `/string` routes
func (*StringController) UpdateName ¶
func (s *StringController) UpdateName(c *gin.Context)
UpdateName takes a string `id` and `name` as query params to update the name of that string.
func (*StringController) UpdateOrder ¶
func (s *StringController) UpdateOrder(c *gin.Context)
UpdateOrder takes a list of id and order values and updates the strings
type StringInteractor ¶
type StringInteractor interface { FindAll() ([]core.String, error) FindAllByThread(threadId uuid.UUID) ([]core.String, error) CreateOne(core.String) (core.String, error) UpdateName(stringId uuid.UUID, name string) error UpdateOrder(stringOrders []core.StringOrder) error DeleteById(id uuid.UUID) error }
StringInteractor defines the service interface the controller will usee
type StringOrderDTO ¶
StringOrderDTO is needed to bind the request body. The core.StringOrder struct defines `Id` as an uuid.UUID which gin cannot bind. So I needed to create a DTO struct to bind to and then convert to the core struct
type StringRepository ¶
func (*StringRepository) DeleteAllByThread ¶
func (s *StringRepository) DeleteAllByThread(threadId uuid.UUID) error
func (*StringRepository) DeleteById ¶
func (s *StringRepository) DeleteById(id uuid.UUID) error
func (*StringRepository) FindAllByThread ¶
func (*StringRepository) UpdateName ¶
func (s *StringRepository) UpdateName(stringId uuid.UUID, name string) error
func (*StringRepository) UpdateOrder ¶
func (s *StringRepository) UpdateOrder(stringOrders []core.StringOrder) error