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