Documentation ¶
Index ¶
- func Register(r *gin.Engine) error
- type DemoApi
- func (api *DemoApi) Demo(c *gin.Context)
- func (api *DemoApi) Demo2(c *gin.Context)
- func (api *DemoApi) DemoCache(c *gin.Context)
- func (api *DemoApi) DemoGoroutine(c *gin.Context)
- func (api *DemoApi) DemoOrm(c *gin.Context)
- func (api *DemoApi) DemoPost(c *gin.Context)
- func (api *DemoApi) DemoRedis(c *gin.Context)
- type Repository
- type Service
- type User
- type UserDTO
- type UserModel
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DemoApi ¶
type DemoApi struct {
// contains filtered or unexported fields
}
func NewDemoApi ¶
func NewDemoApi() *DemoApi
func (*DemoApi) Demo ¶
Demo godoc @Summary 获取所有用户 @Description 获取所有用户 @Produce json @Tags demo @Success 200 array []UserDTO @Router /demo/demo [get]
func (*DemoApi) Demo2 ¶
Demo2 for godoc @Summary 获取所有学生 @Description 获取所有学生,不进行分页 @Produce json @Tags demo @Success 200 {array} UserDTO @Router /demo/demo2 [get]
func (*DemoApi) DemoGoroutine ¶
DemoGoroutine goroutine 的使用示例
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
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 ¶
func StudentsToUserDTOs ¶
func StudentsToUserDTOs(students []demoService.Student) []UserDTO
func UserModelsToUserDTOs ¶
Click to show internal directories.
Click to hide internal directories.