Documentation
¶
Index ¶
- func MapEntityToData(entity interface{}) interface{}
- func ResponseFailed(message string) map[string]interface{}
- func ResponseFailedWithData(message string, data interface{}) map[string]interface{}
- func ResponseSuccess(message string, data interface{}) map[string]interface{}
- func ResponseSuccessWithoutData(message string) map[string]interface{}
- type AddressData
- type BookData
- type BookQueryRequest
- type BookRequest
- type BookResponse
- type BookUpdateRequest
- type BooksResponse
- type DuplicateKeyError
- type Error
- type ErrorCredential
- type ErrorNotFound
- type PagedDataResponse
- type PaginationData
- type PaginationResponse
- type RentData
- type RentRequest
- type RentResponse
- type RentsResponse
- type ResponseFailedBody
- type ResponseSuccessBody
- type ResponseSuccessWithoutDataBody
- type ReturnBookRequest
- type UserData
- type UserRequest
- type UserResponse
- type UsersResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MapEntityToData ¶
func MapEntityToData(entity interface{}) interface{}
func ResponseFailed ¶
func ResponseFailedWithData ¶
func ResponseSuccess ¶
Types ¶
type AddressData ¶
type BookData ¶
type BookData struct {
ID uint `json:"id" example:"1"`
Title string `json:"title" example:"The Lord of the Rings"`
Isbn string `json:"isbn" example:"123456789"`
Author string `json:"author" example:"J.R.R. Tolkien"`
Publisher string `json:"publisher" example:"HarperCollins"`
Description string `` /* 136-byte string literal not displayed */
Cover string `json:"cover" example:"https://example.com/cover.jpg"`
CreatedAt string `json:"created_at" example:"2020-01-01T00:00:00Z"`
UpdatedAt string `json:"updated_at" example:"2020-01-01T00:00:00Z"`
Category string `json:"category" example:"Fiction"`
Owner UserData `json:"owner"`
} //@name Book
type BookQueryRequest ¶
type BookRequest ¶
type BookRequest struct {
Title string `json:"title" example:"The Lord of the Rings" format:"int64"`
Isbn string `json:"isbn" example:"123456789"`
Author string `json:"author" example:"J.R.R. Tolkien"`
Publisher string `json:"publisher" example:"HarperCollins"`
Category string `json:"category" example:"Fiction"`
Cover string `json:"cover" example:"https://example.com/cover.jpg"`
Description string `` /* 136-byte string literal not displayed */
OwnerID uint `json:"owner_id" example:"1" format:"int64"`
PublishDate string `json:"publish_date" example:"2020-01-01" format:"date"`
} //@name BookRequest
type BookResponse ¶
type BookUpdateRequest ¶
type BookUpdateRequest struct {
ID uint `json:"id" example:"1" format:"int64"`
Title string `json:"title" example:"The Lord of the Rings"`
Isbn string `json:"isbn" example:"123456789"`
Author string `json:"author" example:"J.R.R. Tolkien"`
Publisher string `json:"publisher" example:"HarperCollins"`
Category string `json:"category" example:"Fiction"`
Cover string `json:"cover" example:"https://example.com/cover.jpg"`
Description string `` /* 136-byte string literal not displayed */
OwnerID uint `json:"owner_id" example:"1" format:"int64"`
PublishDate string `json:"publish_date" example:"2020-01-01" format:"date"`
} //@name BookUpdateRequest
type BooksResponse ¶
type DuplicateKeyError ¶
func (DuplicateKeyError) Error ¶
func (e DuplicateKeyError) Error() string
type Error ¶
type Error interface {
Error() string
}
func NewDuplicateKeyError ¶
func NewErrorCredential ¶
func NewErrorNotFound ¶
type ErrorCredential ¶
type ErrorCredential struct {
Message string
}
func (ErrorCredential) Error ¶
func (e ErrorCredential) Error() string
type ErrorNotFound ¶
type ErrorNotFound struct {
Name string
}
func (ErrorNotFound) Error ¶
func (e ErrorNotFound) Error() string
type PagedDataResponse ¶
type PagedDataResponse struct {
Data []BookData `json:"data"`
Pagination PaginationData `json:"pagination"`
}
type PaginationData ¶
type PaginationResponse ¶
type PaginationResponse struct {
Status string `json:"status" example:"success"`
Message string `json:"message" example:"success"`
PagedDataResponse
} //@name PaginationResponse
type RentData ¶
type RentData struct {
ID uint `json:"id" example:"1"`
User UserData `json:"user"`
Book BookData `json:"book"`
Status string `json:"status" example:"received"`
RentAt string `json:"rent_at" example:"2020-01-01T00:00:00Z"`
ReturnAt string `json:"return_at" example:"2020-01-01T00:00:00Z"`
Address AddressData `json:"address"`
} //@name Rent
type RentRequest ¶
type RentRequest struct {
UserID uint `json:"user_id" example:"1"`
BookID uint `json:"book_id" example:"1"`
Address AddressData `json:"address"`
ReturnAt string `json:"return_at" example:"2020-01-01T00:00:00Z"`
} //@name RentRequest
type RentResponse ¶
type RentsResponse ¶
type ResponseFailedBody ¶
type ResponseSuccessBody ¶
type ReturnBookRequest ¶
type ReturnBookRequest struct {
BookID uint `json:"book_id" example:"1" format:"int64"`
} //@name ReturnBookRequest
type UserData ¶
type UserData struct {
ID uint `json:"id" example:"1"`
Name string `json:"name" example:"John Doe"`
Email string `json:"email" example:"foo@bar.com"`
CreatedAt string `json:"created_at" example:"2020-01-01T00:00:00Z"`
UpdatedAt string `json:"updated_at" example:"2020-01-01T00:00:00Z"`
} //@name User
type UserRequest ¶
type UserResponse ¶
type UsersResponse ¶
Click to show internal directories.
Click to hide internal directories.