Documentation
¶
Index ¶
- Variables
- func CloseDB()
- func Count[T any](data T, query string, args ...any) int64
- func Create[T any](data *T)
- func Delete[T any](data T, query string, args ...any)
- func GetOne[T any](data T, query string, args ...any) T
- func List[T any](data T, req request.PageQuery, query string, args ...any) (T, int64)
- func Setup()
- func Update[T any](data *T, slt ...string)
- func Updates[T any](data *T, query string, args ...any)
- func UpdatesMap[T any](data *T, maps map[string]any, query string, args ...any)
- type Album
- type Artist
- type LoginRecord
- type Playlist
- type PlaylistCat
- type Song
- type User
- func (u *User) Create(user User) User
- func (u *User) Delete(req request.IdsJson) int
- func (u *User) GetByID(userID uint64) (user User)
- func (u *User) GetByNickname(nickname string) (user User)
- func (u *User) GetByUsername(username string) (user User)
- func (u *User) GetList(req request.PageQuery) (users []User, total int)
- func (u *User) Save(user User) bool
- func (u *User) UpdateStatus(req request.UpdateStatus) int
Constants ¶
This section is empty.
Variables ¶
View Source
var DB *gorm.DB
Functions ¶
Types ¶
type Album ¶
type Album struct {
common.Model
ArtistID uint64 `json:"artist_id"`
Name string `json:"name"`
Pic string `json:"pic"`
Introduction string `json:"introduction"`
Genre string `json:"genre"`
Publisher string `json:"publisher"`
ReleaseTime common.Date `json:"release_time" gorm:"default:nil;type:date"`
}
func (*Album) GetSelectList ¶
func (a *Album) GetSelectList(req request.PageQuery) (res response.AlbumSelectList)
type Artist ¶
type Artist struct {
common.Model
Category string `json:"category"`
Nationality string `json:"nationality"`
Birthday common.Date `json:"birthday" gorm:"default:nil",type:date`
Name string `json:"name"`
Pic string `json:"pic"`
Introduction string `json:"introduction"`
}
func (*Artist) GetSelectList ¶
func (a *Artist) GetSelectList(req request.PageQuery) (res response.ArtistSelectList)
type LoginRecord ¶
type LoginRecord struct {
ID uint64 `gorm:"primaryKey" json:"id"`
UserID uint64 `json:"user_id"`
LoginIP string `json:"login_ip"`
LoginTime *common.LocalTime `gorm:"autoCreateTime" json:"login_time"`
}
func (*LoginRecord) Create ¶
func (l *LoginRecord) Create(loginRecord LoginRecord) LoginRecord
func (*LoginRecord) GetList ¶
func (l *LoginRecord) GetList(req request.PageQuery) (res response.LogLoginList)
type Playlist ¶
type PlaylistCat ¶
type PlaylistCat struct {
common.Model
Name string `json:"name"`
PID uint64 `json:"pid"`
Order uint64 `json:"order"`
}
func (PlaylistCat) TableName ¶
func (PlaylistCat) TableName() string
type Song ¶
type Song struct {
common.Model
AlbumID uint64 `json:"album_id"`
Name string `json:"name"`
Status *int `json:"status"`
Url string `json:"url"`
IsOriginal *int `json:"is_original"`
Pic string `json:"pic"`
Duration int `json:"duration"`
Lyric string `json:"lyric"`
}
func (Song) Create ¶
func (s Song) Create(req request.CreateSong)
type User ¶
type User struct {
common.Model
Username string `gorm:"unique,autoIncrement" json:"username"`
Password string `json:"-"`
Nickname string `json:"nickname"`
Phone string `json:"phone"`
Avatar string `json:"avatar"`
Status *int `gorm:"default:1" json:"status"`
Role *int `json:"role"`
LastLoginTime *common.LocalTime `gorm:"autoUpdateTime" json:"last_login_time"`
LastLoginIP string `json:"last_login_ip"`
}
func (*User) GetByNickname ¶
func (*User) GetByUsername ¶
GetUserByName 根据用户名查询用户
func (*User) UpdateStatus ¶
func (u *User) UpdateStatus(req request.UpdateStatus) int
Source Files
¶
Click to show internal directories.
Click to hide internal directories.