controllers

package
v0.0.0-...-e345738 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Module exported for initializing application

Functions

func OnError

func OnError(c *gin.Context, err error)

OnError make a error response

func OnSuccess

func OnSuccess(c *gin.Context, data interface{})

OnSuccess make a success response

Types

type ApiHandler

type ApiHandler = func(c *gin.Context) *Response

ApiHandler is a api handler function

type EchoController

type EchoController struct {
}

EchoController struct

func NewEchoController

func NewEchoController() *EchoController

NesEchoController creates new controller

func (*EchoController) Echo

func (s *EchoController) Echo(c *gin.Context)

Echo echo user's input param

type JWTAuthController

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

JWTAuthController struct

func NewJWTAuthController

func NewJWTAuthController(
	service *services.JWTAuthService,
	userService *services.UserService,
) *JWTAuthController

NewJWTAuthController creates new controller

func (*JWTAuthController) Register

func (jwt *JWTAuthController) Register(c *gin.Context)

Register registers user

func (*JWTAuthController) SignIn

func (jwt *JWTAuthController) SignIn(c *gin.Context)

SignIn signs in user

type Response

type Response struct {
	Data    interface{} `json:"data"`
	Code    int         `json:"code"`
	Message string      `json:"message"`
}

Response common api response struct

type UserController

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

UserController data type

func NewUserController

func NewUserController(userService *services.UserService) *UserController

NewUserController creates new user controller

func (*UserController) DeleteUser

func (u *UserController) DeleteUser(c *gin.Context)

DeleteUser deletes user

func (*UserController) GetOneUser

func (u *UserController) GetOneUser(c *gin.Context)

GetOneUser gets one user

func (*UserController) GetUser

func (u *UserController) GetUser(c *gin.Context)

GetUser gets the user

func (*UserController) SaveUser

func (u *UserController) SaveUser(c *gin.Context)

SaveUser saves the user

func (*UserController) UpdateUser

func (u *UserController) UpdateUser(c *gin.Context)

UpdateUser updates user

Jump to

Keyboard shortcuts

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