2019-02-09 12:30:49 +00:00
|
|
|
package models
|
|
|
|
|
|
|
|
import (
|
|
|
|
"database/sql"
|
2020-09-20 08:36:02 +00:00
|
|
|
"time"
|
|
|
|
|
2022-03-17 00:33:59 +00:00
|
|
|
"github.com/stashapp/stash/pkg/hash/md5"
|
2019-02-09 12:30:49 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type Performer struct {
|
2022-04-04 10:03:39 +00:00
|
|
|
ID int `db:"id" json:"id"`
|
|
|
|
Checksum string `db:"checksum" json:"checksum"`
|
|
|
|
Name sql.NullString `db:"name" json:"name"`
|
|
|
|
Gender sql.NullString `db:"gender" json:"gender"`
|
|
|
|
URL sql.NullString `db:"url" json:"url"`
|
|
|
|
Twitter sql.NullString `db:"twitter" json:"twitter"`
|
|
|
|
Instagram sql.NullString `db:"instagram" json:"instagram"`
|
|
|
|
Birthdate SQLiteDate `db:"birthdate" json:"birthdate"`
|
|
|
|
Ethnicity sql.NullString `db:"ethnicity" json:"ethnicity"`
|
|
|
|
Country sql.NullString `db:"country" json:"country"`
|
|
|
|
EyeColor sql.NullString `db:"eye_color" json:"eye_color"`
|
|
|
|
Height sql.NullString `db:"height" json:"height"`
|
|
|
|
Measurements sql.NullString `db:"measurements" json:"measurements"`
|
|
|
|
FakeTits sql.NullString `db:"fake_tits" json:"fake_tits"`
|
|
|
|
CareerLength sql.NullString `db:"career_length" json:"career_length"`
|
|
|
|
Tattoos sql.NullString `db:"tattoos" json:"tattoos"`
|
|
|
|
Piercings sql.NullString `db:"piercings" json:"piercings"`
|
|
|
|
Aliases sql.NullString `db:"aliases" json:"aliases"`
|
|
|
|
Favorite sql.NullBool `db:"favorite" json:"favorite"`
|
|
|
|
CreatedAt SQLiteTimestamp `db:"created_at" json:"created_at"`
|
|
|
|
UpdatedAt SQLiteTimestamp `db:"updated_at" json:"updated_at"`
|
|
|
|
Rating sql.NullInt64 `db:"rating" json:"rating"`
|
|
|
|
Details sql.NullString `db:"details" json:"details"`
|
|
|
|
DeathDate SQLiteDate `db:"death_date" json:"death_date"`
|
|
|
|
HairColor sql.NullString `db:"hair_color" json:"hair_color"`
|
|
|
|
Weight sql.NullInt64 `db:"weight" json:"weight"`
|
|
|
|
IgnoreAutoTag bool `db:"ignore_auto_tag" json:"ignore_auto_tag"`
|
2019-02-09 12:30:49 +00:00
|
|
|
}
|
2020-09-20 08:36:02 +00:00
|
|
|
|
2020-12-04 01:42:56 +00:00
|
|
|
type PerformerPartial struct {
|
2022-04-04 10:03:39 +00:00
|
|
|
ID int `db:"id" json:"id"`
|
|
|
|
Checksum *string `db:"checksum" json:"checksum"`
|
|
|
|
Name *sql.NullString `db:"name" json:"name"`
|
|
|
|
Gender *sql.NullString `db:"gender" json:"gender"`
|
|
|
|
URL *sql.NullString `db:"url" json:"url"`
|
|
|
|
Twitter *sql.NullString `db:"twitter" json:"twitter"`
|
|
|
|
Instagram *sql.NullString `db:"instagram" json:"instagram"`
|
|
|
|
Birthdate *SQLiteDate `db:"birthdate" json:"birthdate"`
|
|
|
|
Ethnicity *sql.NullString `db:"ethnicity" json:"ethnicity"`
|
|
|
|
Country *sql.NullString `db:"country" json:"country"`
|
|
|
|
EyeColor *sql.NullString `db:"eye_color" json:"eye_color"`
|
|
|
|
Height *sql.NullString `db:"height" json:"height"`
|
|
|
|
Measurements *sql.NullString `db:"measurements" json:"measurements"`
|
|
|
|
FakeTits *sql.NullString `db:"fake_tits" json:"fake_tits"`
|
|
|
|
CareerLength *sql.NullString `db:"career_length" json:"career_length"`
|
|
|
|
Tattoos *sql.NullString `db:"tattoos" json:"tattoos"`
|
|
|
|
Piercings *sql.NullString `db:"piercings" json:"piercings"`
|
|
|
|
Aliases *sql.NullString `db:"aliases" json:"aliases"`
|
|
|
|
Favorite *sql.NullBool `db:"favorite" json:"favorite"`
|
|
|
|
CreatedAt *SQLiteTimestamp `db:"created_at" json:"created_at"`
|
|
|
|
UpdatedAt *SQLiteTimestamp `db:"updated_at" json:"updated_at"`
|
|
|
|
Rating *sql.NullInt64 `db:"rating" json:"rating"`
|
|
|
|
Details *sql.NullString `db:"details" json:"details"`
|
|
|
|
DeathDate *SQLiteDate `db:"death_date" json:"death_date"`
|
|
|
|
HairColor *sql.NullString `db:"hair_color" json:"hair_color"`
|
|
|
|
Weight *sql.NullInt64 `db:"weight" json:"weight"`
|
|
|
|
IgnoreAutoTag *bool `db:"ignore_auto_tag" json:"ignore_auto_tag"`
|
2020-12-04 01:42:56 +00:00
|
|
|
}
|
|
|
|
|
2020-09-20 08:36:02 +00:00
|
|
|
func NewPerformer(name string) *Performer {
|
|
|
|
currentTime := time.Now()
|
|
|
|
return &Performer{
|
2022-03-17 00:33:59 +00:00
|
|
|
Checksum: md5.FromString(name),
|
2020-09-20 08:36:02 +00:00
|
|
|
Name: sql.NullString{String: name, Valid: true},
|
|
|
|
Favorite: sql.NullBool{Bool: false, Valid: true},
|
|
|
|
CreatedAt: SQLiteTimestamp{Timestamp: currentTime},
|
|
|
|
UpdatedAt: SQLiteTimestamp{Timestamp: currentTime},
|
|
|
|
}
|
|
|
|
}
|
2021-01-18 01:23:20 +00:00
|
|
|
|
|
|
|
type Performers []*Performer
|
|
|
|
|
|
|
|
func (p *Performers) Append(o interface{}) {
|
|
|
|
*p = append(*p, o.(*Performer))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *Performers) New() interface{} {
|
|
|
|
return &Performer{}
|
|
|
|
}
|