handlers

package
v0.0.0-...-d1be498 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidAuthValue = errors.New("invalid auth header value")
View Source
var ErrNoAuthValue = errors.New("no auth value")
View Source
var ErrNotSupportedAuthType = errors.New("not supported auth type")

Functions

func IsAuthError

func IsAuthError(e error) bool

func ShouldBind

func ShouldBind[T any](gc *gin.Context, obj T) error

Types

type Auth

type Auth struct {
	User     string `json:"user"`
	Password string `json:"password"`
}

func GetAuthInfo

func GetAuthInfo(gc *gin.Context) (*Auth, error)

type Handler

type Handler gin.HandlerFunc

type Handlers

type Handlers []Handler

type HealthGetHandler

type HealthGetHandler struct{}

Get health check

func NewHealthGetHandler

func NewHealthGetHandler() *HealthGetHandler

func (*HealthGetHandler) Handle

func (h *HealthGetHandler) Handle(gc *gin.Context)

type HealthGetResponse

type HealthGetResponse struct {
	Message string `json:"message"`
}

Get health check

type UserCreateHandler

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

Create user

func NewUserCreateHandler

func NewUserCreateHandler(
	txm port.TransactionManager,
	passwordManager port.PasswordManager,
	userInteractor interactor.UserInteractor,
) *UserCreateHandler

func (*UserCreateHandler) Handle

func (h *UserCreateHandler) Handle(gc *gin.Context)

type UserCreateRequest

type UserCreateRequest struct {
	Name  string `json:"name" form:"name" binding:"required"`
	Email string `json:"email" form:"email" binding:"required"`
}

Create user

type UserCreateResponse

type UserCreateResponse struct {
	ID    string `json:"id"`
	Name  string `json:"name"`
	Email string `json:"email"`
}

Create user

type UserFindHandler

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

Find users

func NewUserFindHandler

func NewUserFindHandler(
	txm port.TransactionManager,
	userInteractor interactor.UserInteractor,
) *UserFindHandler

func (*UserFindHandler) Handle

func (h *UserFindHandler) Handle(gc *gin.Context)

type UserFindRequest

type UserFindRequest struct {
	Email *string `json:"email" form:"email"`
}

Find users

type UserFindResponse

type UserFindResponse struct {
	Users []*UserFindResponseUser `json:"users"`
}

Find users

type UserFindResponseUser

type UserFindResponseUser struct {
	ID    string `json:"id"`
	Name  string `json:"name"`
	Email string `json:"email"`
}

Find users

type UserGetHandler

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

Get user

func NewUserGetHandler

func NewUserGetHandler(
	txm port.TransactionManager,
	userInteractor interactor.UserInteractor,
) *UserGetHandler

func (*UserGetHandler) Handle

func (h *UserGetHandler) Handle(gc *gin.Context)

type UserGetRequest

type UserGetRequest struct {
	ID string `json:"id" uri:"id" binding:"required"`
}

Get user

type UserGetResponse

type UserGetResponse struct {
	ID    string `json:"id"`
	Name  string `json:"name"`
	Email string `json:"email"`
}

Get user

type UserUpdateHandler

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

Update user

func NewUserUpdateHandler

func NewUserUpdateHandler(
	txm port.TransactionManager,
	userInteractor interactor.UserInteractor,
) *UserUpdateHandler

func (*UserUpdateHandler) Handle

func (h *UserUpdateHandler) Handle(gc *gin.Context)

type UserUpdateRequest

type UserUpdateRequest struct {
	ID    string `json:"id" uri:"id" binding:"required"`
	Name  string `json:"name" form:"name" binding:"required"`
	Email string `json:"email" form:"email" binding:"required"`
}

Update user

type UserUpdateResponse

type UserUpdateResponse struct {
	ID    string `json:"id"`
	Name  string `json:"name"`
	Email string `json:"email"`
}

Update user

Jump to

Keyboard shortcuts

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