Documentation ¶
Index ¶
- func HTTPErrorPtr(err error, msg string, status int) *api2go.HTTPError
- func HTTPErrorPtrWithStatus(err error, msg string) *api2go.HTTPError
- func StatusByError(err error) int
- type LinkResource
- func (c *LinkResource) Create(obj interface{}, _ api2go.Request) (api2go.Responder, error)
- func (c *LinkResource) Delete(id string, _ api2go.Request) (api2go.Responder, error)
- func (c *LinkResource) FindAll(r api2go.Request) (api2go.Responder, error)
- func (c *LinkResource) FindOne(ID string, _ api2go.Request) (api2go.Responder, error)
- func (c *LinkResource) Update(obj interface{}, _ api2go.Request) (api2go.Responder, error)
- type Page
- type Response
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HTTPErrorPtr ¶
HTTPErrorPtr makes an *api2go.HTTPError by the given function arguments, where err is an error that had occurred, msg is a text that you might want to show to the visitor, status is a http status you want to return along with the error message
func HTTPErrorPtrWithStatus ¶
HTTPErrorPtrWithStatus is a shortcut to HTTPErrorPtr that uses StatusByError for the given error to define the http status
func StatusByError ¶
StatusByError gives a http error for a particular go error
Types ¶
type LinkResource ¶
type LinkResource struct { LinkStorage linkstorage.Storage // contains filtered or unexported fields }
LinkResource for api2go routes
func NewLinkResource ¶
func NewLinkResource(linkStorage linkstorage.Storage) *LinkResource
NewLinkResource creates a new LinkResource instance for a given link storage
func (*LinkResource) Create ¶
Create a new link @Summary Create a new link @Description add by link json @Tags links @Accept json-api @Produce json-api @Param link body jsonapi.CreateLink true "Add link" @Success 201 {object} jsonapi.CreatedLink @Router /links [post]
func (*LinkResource) Delete ¶
Delete a link :( @Summary Delete a link @Description Delete by link ID @Tags links @Accept json-api @Produce json-api @Param id path int true "Link ID" @Success 204 @Router /links/{id} [delete]
func (*LinkResource) FindAll ¶
FindAll links @Summary List links @Description get links @Tags links @Accept json-api @Produce json-api @Param page[number] query int false "Page number" default(1) @Param page[size] query int false "Page size" default(10) maximum(1000) @Success 200 {object} jsonapi.Links @Router /links [get]
func (*LinkResource) FindOne ¶
FindOne link @Summary Get a link @Description get link by ID @Tags links @Accept json-api @Produce json-api @Param id path string true "Link ID" @Success 200 {object} jsonapi.Link @Router /links/{id} [get]
func (*LinkResource) Update ¶
Update a link @Summary Update a link @Description Update by link json @Tags links @Accept json-api @Produce json-api @Param id path int true "Link ID" @Param account body jsonapi.CreateLink true "Update link" @Success 200 {object} jsonapi.CreatedLink @Router /links/{id} [patch]