zedshaw.games/data/models.go

52 lines
1.3 KiB
Go

package data
import "reflect"
type Login struct {
Username string `db:"username" validate:"required,max=30"`
Password string `db:"password" validate:"required,max=128"`
}
type User struct {
Id int `db:"id" `
Username string `db:"username" validate:"required,max=30"`
Email string `db:"email" validate:"required,email,max=128"`
Password string `db:"password" validate:"required,min=8,max=64"`
}
type Link struct {
Id int `db:"id" `
StreamId int `db:"stream_id" `
Url string `db:"url" `
Description string `db:"description" `
}
type Stream struct {
Id int `db:"id" `
Title string `db:"title" `
Description string `db:"description" `
}
type Game struct {
Id int `db:"id" `
Slug string `db:"slug" `
Title string `db:"title" `
Description string `db:"description" `
Image string `db:"image" `
Url string `db:"url" `
Tags string `db:"tags" `
Video string `db:"video" `
CurrentStatus string `db:"current_status" `
PlannedWork string `db:"planned_work" `
CodeUrl string `db:"code_url" `
HeaderImage string `db:"header_image" `
}
func Models() map[string]reflect.Type {
return map[string]reflect.Type{
"stream": reflect.TypeFor[Stream](),
"stream_link": reflect.TypeFor[Link](),
"user": reflect.TypeFor[User](),
"game": reflect.TypeFor[Game](),
}
}