You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
430 B
Go
24 lines
430 B
Go
package model
|
|
|
|
import (
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
type Room struct {
|
|
ID int `json:"id" gorm:"primaryKey" `
|
|
User_count string `json:"user_count" gorm:"comment:'房间人数'"`
|
|
}
|
|
|
|
func (Room) TableName() string {
|
|
return "yyz_room"
|
|
}
|
|
|
|
func GetRoom(db *gorm.DB) ([]Room, error) {
|
|
room := []Room{}
|
|
err := db.Debug().Find(&room).Error
|
|
if err != nil && err != gorm.ErrRecordNotFound {
|
|
return room, err
|
|
}
|
|
return room, nil
|
|
}
|