demo

package
v0.0.0-...-128a1fa Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(r *gin.Engine) error

Types

type DemoApi

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

func NewDemoApi

func NewDemoApi() *DemoApi

func (*DemoApi) Demo

func (api *DemoApi) Demo(c *gin.Context)

Demo godoc @Summary 获取所有用户 @Description 获取所有用户 @Produce json @Tags demo @Success 200 array []UserDTO @Router /demo/demo [get]

func (*DemoApi) Demo2

func (api *DemoApi) Demo2(c *gin.Context)

Demo godoc @Summary 获取所有学生 @Description 获取所有学生 @Produce json @Tags demo @Success 200 array []UserDTO @Router /demo/demo2 [get]

func (*DemoApi) DemoPost

func (api *DemoApi) DemoPost(c *gin.Context)

type Repository

type Repository struct {
}

func NewRepository

func NewRepository() *Repository

func (*Repository) GetUserByIds

func (r *Repository) GetUserByIds([]int) []UserModel

func (*Repository) GetUserIds

func (r *Repository) GetUserIds() []int

type Service

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

func NewService

func NewService() *Service

func (*Service) GetUsers

func (s *Service) GetUsers() []UserModel

type UserDTO

type UserDTO struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

func StudentsToUserDTOs

func StudentsToUserDTOs(students []demo.Student) []UserDTO

func UserModelsToUserDTOs

func UserModelsToUserDTOs(models []UserModel) []UserDTO

type UserModel

type UserModel struct {
	UserId int
	Name   string
	Age    int
}

Jump to

Keyboard shortcuts

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