Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Modules = fx.Options( service.Modules, fx.Provide(NewHelloController, NewValidateController, NewUserController), fx.Invoke(BindHelloRoutes, BindValidateRoutes, BindAdminRoutes), )
Functions ¶
func BindAdminRoutes ¶
func BindAdminRoutes(_ config.Type, e *echo.Echo, c *UserController)
func BindHelloRoutes ¶
func BindHelloRoutes(e *echo.Echo, c *HelloController)
func BindValidateRoutes ¶
func BindValidateRoutes(e *echo.Echo, c *ValidateController)
Types ¶
type Address ¶
type Address struct {
Street string `validate:"required"`
City string `validate:"required"`
Planet string `validate:"required"`
Phone string `validate:"required"`
}
Address houses a users address information
type HelloController ¶
type HelloController struct {
// contains filtered or unexported fields
}
func NewHelloController ¶
func NewHelloController(logger *zap.Logger, helloService *service.HelloService) *HelloController
func (HelloController) Hello ¶
func (controller HelloController) Hello(c echo.Context) error
ShowAccount godoc
@Summary Show an account
@Description get string by ID
@Tags accounts
@Accept json
@Produce json
@Param id path int true "Account ID"
@Success 200 {object} types.FileDef
@Router /hello/{id} [get]
type User ¶
type User struct {
FirstName string `validate:"required"`
LastName string `validate:"required"`
Age uint8 `validate:"gte=0,lte=130"`
Email string `validate:"required,email"`
Gender string `validate:"oneof=male female prefer_not_to"`
FavouriteColor string `validate:"iscolor"` // alias for 'hexcolor|rgb|rgba|hsl|hsla'
Addresses []*Address `validate:"required,dive,required"` // a person can have a home and cottage...
}
User contains user information
type UserController ¶
type UserController struct {
// contains filtered or unexported fields
}
func NewUserController ¶
func NewUserController(logger *zap.Logger, userService *service.UserService) *UserController
func (UserController) Info ¶
func (controller UserController) Info(c echo.Context) error
Info godoc
@Summary User info
@Description User info
@Tags user
@Accept json
@Produce json
@Success 200 {object} protocol.Response{data=types.KV}
@Router /user/info [get]
func (UserController) Login ¶
func (controller UserController) Login(c echo.Context) error
Login godoc
@Summary User login
@Description User login with username and password
@Tags user
@Accept json
@Produce json
@Param body body types.UserLoginRequest true "Login credentials"
@Success 200 {object} protocol.Response{data=types.UserLoginResponse}
@Router /user/login [post]
type ValidateController ¶
type ValidateController struct {
}
func NewValidateController ¶
func NewValidateController() *ValidateController
Click to show internal directories.
Click to hide internal directories.