perf(models): optimize objects models

This commit is contained in:
Masahiko AMANO 2025-01-17 17:41:58 +03:00
parent 889d01f9d0
commit 8d9ed7f2f1

View File

@ -1,16 +1,22 @@
package models
import (
"database/sql"
"time"
)
//#region Objects
type PersonBrief struct {
ID string `json:"id"`
Name string `json:"name"`
SortName string `json:"sortName"`
}
type Person struct {
ID string `json:"id"`
Name string `json:"name"`
Birthdate sql.NullTime `json:"birthdate"`
Deathdate sql.NullTime `json:"deathdate"`
Info sql.NullString `json:"info"`
PersonBrief
Birthdate string `json:"birthdate"`
Deathdate string `json:"deathdate"`
Info string `json:"info"`
}
type Role struct {
@ -19,37 +25,47 @@ type Role struct {
}
type Credit struct {
Person Person `json:"person"`
Role Role `json:"role"`
Person PersonBrief `json:"person"`
Role Role `json:"role"`
}
type ArtistBrief struct {
ID string `json:"id"`
Name string `json:"name"`
}
type Artist struct {
ID string `json:"id"`
Name string `json:"name"`
Notes sql.NullString `json:"notes"`
ArtistBrief
Info string `json:"info"`
}
type TrackBrief struct {
ID string `json:"id"`
Name string `json:"name"`
Artists []ArtistBrief `json:"artists"`
Duration float32 `json:"duration"`
ReleaseDate string `json:"release_date"`
AcquireDatetime time.Time `json:"acquire_datetime"`
ISRC string `json:"isrc"`
}
type Track struct {
ID string `json:"id"`
Name string `json:"name"`
Artists []Artist `json:"artists"`
Duration float32 `json:"duration"`
ReleaseDate sql.NullTime `json:"release_date"`
AcquireDate time.Time `json:"acquire_date"`
ISRC sql.NullString `json:"isrc"`
Credits []Credit `json:"credits"`
Notes sql.NullString `json:"notes"`
Lyrics sql.NullString `json:"lyrics"`
TrackBrief
Credits []Credit `json:"credits"`
Lyrics string `json:"lyrics"`
Info string `json:"info"`
}
type Alias struct {
ID string `json:"id"`
Track Track `json:"track"`
Name string `json:"name"`
Artist string `json:"artist"`
ID string `json:"id"`
TrackID string `json:"track_id"`
Name string `json:"name"`
Artist string `json:"artist"`
}
type Kiroku struct {
Alias Alias `json:"alias"`
Datetime time.Time `json:"datetime"`
}
//#endregion Objects