52 lines
1.8 KiB
Go
52 lines
1.8 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" json:"id" validate:"numeric"`
|
|
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" json:"id" validate:"isdefault"`
|
|
StreamId int `db:"stream_id" json:"stream_id" form:"stream_id" validate:"required,numeric"`
|
|
Url string `db:"url" json:"url" form:"url" validate:"required,http_url,max=150"`
|
|
Description string `db:"description" json:"description" form:"description" validate:"required,max=300"`
|
|
}
|
|
|
|
type Stream struct {
|
|
Id int `db:"id" json:"id"`
|
|
Title string `db:"title" json:"title"`
|
|
Description string `db:"description" json:"description"`
|
|
}
|
|
|
|
type Game struct {
|
|
Id int `db:"id" json:"id"`
|
|
Slug string `db:"slug" json:"slug"`
|
|
Title string `db:"title" json:"title"`
|
|
Description string `db:"description" json:"description"`
|
|
Image string `db:"image" json:"image"`
|
|
Url string `db:"url" json:"url"`
|
|
Tags string `db:"tags" json:"tags"`
|
|
Video string `db:"video" json:"video"`
|
|
CurrentStatus string `db:"current_status" json:"current_status" form:"current_status"`
|
|
PlannedWork string `db:"planned_work" json:"planned_work" form:"planned_work"`
|
|
CodeUrl string `db:"code_url" json:"code_url" form:"code_url"`
|
|
HeaderImage string `db:"header_image" json:"header_image" form:"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](),
|
|
}
|
|
}
|