controller

package
v0.0.0-...-44cb80a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 21, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// API represents the group of API.
	API = "/api"
	// APIBook represents the group of book management API.
	APIBooks = API + "/books"
	// APIBooksID represents the API to get book data using id.
	APIBooksID = APIBooks + "/:id"
	// APICategory represents the group of category management API.
	APICategories = API + "/categories"
	// APIFormat represents the group of format management API.
	APIFormats = API + "/formats"
)
View Source
const (
	// APIAccount represents the group of auth management API.
	APIAccount = API + "/auth"
	// APIAccountLoginStatus represents the API to get the status of logged in account.
	APIAccountLoginStatus = APIAccount + "/loginStatus"
	// APIAccountLoginAccount represents the API to get the logged in account.
	APIAccountLoginAccount = APIAccount + "/loginAccount"
	// APIAccountLogin represents the API to login by session authentication.
	APIAccountLogin = APIAccount + "/login"
	// APIAccountLogout represents the API to logout.
	APIAccountLogout = APIAccount + "/logout"
)
View Source
const (
	// APIHealth represents the API to get the status of this application.
	APIHealth = API + "/health"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	Code    int
	Message string
}

APIError has a error code and a message.

type AccountController

type AccountController struct {
	// contains filtered or unexported fields
}

AccountController is a controller for managing user account.

func NewAccountController

func NewAccountController(context mycontext.Context) *AccountController

NewAccountController is constructor.

func (*AccountController) GetLoginAccount

func (controller *AccountController) GetLoginAccount(c echo.Context) error

GetLoginAccount returns the account data of logged in user.

func (*AccountController) GetLoginStatus

func (controller *AccountController) GetLoginStatus(c echo.Context) error

GetLoginStatus returns the status of login.

func (*AccountController) Login

func (controller *AccountController) Login(c echo.Context) error

Login is the method to login using username and password by http post.

func (*AccountController) Logout

func (controller *AccountController) Logout(c echo.Context) error

Logout is the method to logout by http post.

type BookController

type BookController struct {
	// contains filtered or unexported fields
}

BookController is a controller for managing books.

func NewBookController

func NewBookController(context mycontext.Context) *BookController

NewBookController is constructor.

func (*BookController) CreateBook

func (controller *BookController) CreateBook(c echo.Context) error

CreateBook create a new book by http post.

func (*BookController) DeleteBook

func (controller *BookController) DeleteBook(c echo.Context) error

DeleteBook deletes the existing book by http post.

func (*BookController) GetBook

func (controller *BookController) GetBook(c echo.Context) error

GetBook returns one record matched book's id.

func (*BookController) GetBookList

func (controller *BookController) GetBookList(c echo.Context) error

GetBookList returns the list of matched books by searching.

func (*BookController) UpdateBook

func (controller *BookController) UpdateBook(c echo.Context) error

UpdateBook update the existing book by http post.

type CategoryController

type CategoryController struct {
	// contains filtered or unexported fields
}

CategoryController is a controller for managing category data.

func NewCategoryController

func NewCategoryController(context mycontext.Context) *CategoryController

NewCategoryController is constructor.

func (*CategoryController) GetCategoryList

func (controller *CategoryController) GetCategoryList(c echo.Context) error

GetCategoryList returns the list of all categories.

type ErrorController

type ErrorController struct {
	// contains filtered or unexported fields
}

ErrorController is a controller for handling errors.

func NewErrorController

func NewErrorController(context mycontext.Context) *ErrorController

NewErrorController is constructor.

func (*ErrorController) JSONError

func (controller *ErrorController) JSONError(err error, c echo.Context)

JSONError is cumstomize error handler

type FormatController

type FormatController struct {
	// contains filtered or unexported fields
}

FormatController is a controller for managing format data.

func NewFormatController

func NewFormatController(context mycontext.Context) *FormatController

NewFormatController is constructor.

func (*FormatController) GetFormatList

func (controller *FormatController) GetFormatList(c echo.Context) error

GetFormatList returns the list of all formats.

type HealthController

type HealthController struct {
	// contains filtered or unexported fields
}

HealthController is a controller returns the current status of this application.

func NewHealthController

func NewHealthController(context mycontext.Context) *HealthController

NewHealthController is constructor.

func (*HealthController) GetHealthCheck

func (controller *HealthController) GetHealthCheck(c echo.Context) error

GetHealthCheck returns whether this application is alive or not.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL