demo

package
v0.0.0-...-af619fd Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2022 License: MIT Imports: 8 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)

Demo2 for godoc @Summary 获取所有学生 @Description 获取所有学生,不进行分页 @Produce json @Tags demo @Success 200 {array} UserDTO @Router /demo/demo2 [get]

func (*DemoApi) DemoCache

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

DemoCache cache的简单例子

func (*DemoApi) DemoGoroutine

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

DemoGoroutine goroutine 的使用示例

func (*DemoApi) DemoOrm

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

DemoOrm Orm的路由方法

func (*DemoApi) DemoPost

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

func (*DemoApi) DemoRedis

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

DemoRedis redis的路由方法

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 User

type User struct {
	ID           uint
	Name         string
	Email        *string
	Age          uint8
	Birthday     *time.Time
	MemberNumber sql.NullString
	ActivatedAt  sql.NullTime
	CreatedAt    time.Time
	UpdatedAt    time.Time
}

User is gorm model

type UserDTO

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

func StudentsToUserDTOs

func StudentsToUserDTOs(students []demoService.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