35 lines
871 B
Go
35 lines
871 B
Go
package common
|
|
|
|
type Error struct {
|
|
Message string `json:"message,omitempty"`
|
|
Metadata interface{} `json:"metadata,omitempty"`
|
|
}
|
|
|
|
type Response struct {
|
|
Data interface{} `json:"data"`
|
|
Error *Error `json:"error,omitempty"`
|
|
Status int `json:"status,omitempty"`
|
|
}
|
|
|
|
type Page struct {
|
|
TotalElements int `json:"totalElements"`
|
|
TotalPages int64 `json:"totalPages"`
|
|
PageSize int `json:"pageSize"`
|
|
SortDirection SortDirection `json:"sort,omitempty"`
|
|
PageNumber int64 `json:"pageNumber"`
|
|
}
|
|
|
|
// PaginatedResponse can be used for paginated response
|
|
type PaginatedResponse struct {
|
|
Data interface{} `json:"data"`
|
|
Page Page `json:"pages,omitempty"`
|
|
Status int `json:"status,omitempty"`
|
|
}
|
|
|
|
type SortDirection string
|
|
|
|
const (
|
|
DESC SortDirection = "desc"
|
|
ASC SortDirection = "asc"
|
|
)
|