feat: sql queries were written and used to generate queries.go
This commit is contained in:
parent
2d2d97ec27
commit
31a09037cb
8 changed files with 1183 additions and 1 deletions
266
modules/sql/sqlc/models.go
Normal file
266
modules/sql/sqlc/models.go
Normal file
|
|
@ -0,0 +1,266 @@
|
|||
// Code generated by sqlc. DO NOT EDIT.
|
||||
// versions:
|
||||
// sqlc v1.30.0
|
||||
|
||||
package nyanimedb_backend
|
||||
|
||||
import (
|
||||
"database/sql/driver"
|
||||
"fmt"
|
||||
|
||||
"github.com/jackc/pgx/v5/pgtype"
|
||||
)
|
||||
|
||||
type ReleaseSeasonT string
|
||||
|
||||
const (
|
||||
ReleaseSeasonTWinter ReleaseSeasonT = "winter"
|
||||
ReleaseSeasonTSpring ReleaseSeasonT = "spring"
|
||||
ReleaseSeasonTSummer ReleaseSeasonT = "summer"
|
||||
ReleaseSeasonTFall ReleaseSeasonT = "fall"
|
||||
)
|
||||
|
||||
func (e *ReleaseSeasonT) Scan(src interface{}) error {
|
||||
switch s := src.(type) {
|
||||
case []byte:
|
||||
*e = ReleaseSeasonT(s)
|
||||
case string:
|
||||
*e = ReleaseSeasonT(s)
|
||||
default:
|
||||
return fmt.Errorf("unsupported scan type for ReleaseSeasonT: %T", src)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type NullReleaseSeasonT struct {
|
||||
ReleaseSeasonT ReleaseSeasonT `json:"release_season_t"`
|
||||
Valid bool `json:"valid"` // Valid is true if ReleaseSeasonT is not NULL
|
||||
}
|
||||
|
||||
// Scan implements the Scanner interface.
|
||||
func (ns *NullReleaseSeasonT) Scan(value interface{}) error {
|
||||
if value == nil {
|
||||
ns.ReleaseSeasonT, ns.Valid = "", false
|
||||
return nil
|
||||
}
|
||||
ns.Valid = true
|
||||
return ns.ReleaseSeasonT.Scan(value)
|
||||
}
|
||||
|
||||
// Value implements the driver Valuer interface.
|
||||
func (ns NullReleaseSeasonT) Value() (driver.Value, error) {
|
||||
if !ns.Valid {
|
||||
return nil, nil
|
||||
}
|
||||
return string(ns.ReleaseSeasonT), nil
|
||||
}
|
||||
|
||||
type StorageTypeT string
|
||||
|
||||
const (
|
||||
StorageTypeTLocal StorageTypeT = "local"
|
||||
StorageTypeTS3 StorageTypeT = "s3"
|
||||
)
|
||||
|
||||
func (e *StorageTypeT) Scan(src interface{}) error {
|
||||
switch s := src.(type) {
|
||||
case []byte:
|
||||
*e = StorageTypeT(s)
|
||||
case string:
|
||||
*e = StorageTypeT(s)
|
||||
default:
|
||||
return fmt.Errorf("unsupported scan type for StorageTypeT: %T", src)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type NullStorageTypeT struct {
|
||||
StorageTypeT StorageTypeT `json:"storage_type_t"`
|
||||
Valid bool `json:"valid"` // Valid is true if StorageTypeT is not NULL
|
||||
}
|
||||
|
||||
// Scan implements the Scanner interface.
|
||||
func (ns *NullStorageTypeT) Scan(value interface{}) error {
|
||||
if value == nil {
|
||||
ns.StorageTypeT, ns.Valid = "", false
|
||||
return nil
|
||||
}
|
||||
ns.Valid = true
|
||||
return ns.StorageTypeT.Scan(value)
|
||||
}
|
||||
|
||||
// Value implements the driver Valuer interface.
|
||||
func (ns NullStorageTypeT) Value() (driver.Value, error) {
|
||||
if !ns.Valid {
|
||||
return nil, nil
|
||||
}
|
||||
return string(ns.StorageTypeT), nil
|
||||
}
|
||||
|
||||
type TitleStatusT string
|
||||
|
||||
const (
|
||||
TitleStatusTFinished TitleStatusT = "finished"
|
||||
TitleStatusTOngoing TitleStatusT = "ongoing"
|
||||
TitleStatusTPlanned TitleStatusT = "planned"
|
||||
)
|
||||
|
||||
func (e *TitleStatusT) Scan(src interface{}) error {
|
||||
switch s := src.(type) {
|
||||
case []byte:
|
||||
*e = TitleStatusT(s)
|
||||
case string:
|
||||
*e = TitleStatusT(s)
|
||||
default:
|
||||
return fmt.Errorf("unsupported scan type for TitleStatusT: %T", src)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type NullTitleStatusT struct {
|
||||
TitleStatusT TitleStatusT `json:"title_status_t"`
|
||||
Valid bool `json:"valid"` // Valid is true if TitleStatusT is not NULL
|
||||
}
|
||||
|
||||
// Scan implements the Scanner interface.
|
||||
func (ns *NullTitleStatusT) Scan(value interface{}) error {
|
||||
if value == nil {
|
||||
ns.TitleStatusT, ns.Valid = "", false
|
||||
return nil
|
||||
}
|
||||
ns.Valid = true
|
||||
return ns.TitleStatusT.Scan(value)
|
||||
}
|
||||
|
||||
// Value implements the driver Valuer interface.
|
||||
func (ns NullTitleStatusT) Value() (driver.Value, error) {
|
||||
if !ns.Valid {
|
||||
return nil, nil
|
||||
}
|
||||
return string(ns.TitleStatusT), nil
|
||||
}
|
||||
|
||||
type UsertitleStatusT string
|
||||
|
||||
const (
|
||||
UsertitleStatusTFinished UsertitleStatusT = "finished"
|
||||
UsertitleStatusTPlanned UsertitleStatusT = "planned"
|
||||
UsertitleStatusTDropped UsertitleStatusT = "dropped"
|
||||
UsertitleStatusTInProgress UsertitleStatusT = "in-progress"
|
||||
)
|
||||
|
||||
func (e *UsertitleStatusT) Scan(src interface{}) error {
|
||||
switch s := src.(type) {
|
||||
case []byte:
|
||||
*e = UsertitleStatusT(s)
|
||||
case string:
|
||||
*e = UsertitleStatusT(s)
|
||||
default:
|
||||
return fmt.Errorf("unsupported scan type for UsertitleStatusT: %T", src)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type NullUsertitleStatusT struct {
|
||||
UsertitleStatusT UsertitleStatusT `json:"usertitle_status_t"`
|
||||
Valid bool `json:"valid"` // Valid is true if UsertitleStatusT is not NULL
|
||||
}
|
||||
|
||||
// Scan implements the Scanner interface.
|
||||
func (ns *NullUsertitleStatusT) Scan(value interface{}) error {
|
||||
if value == nil {
|
||||
ns.UsertitleStatusT, ns.Valid = "", false
|
||||
return nil
|
||||
}
|
||||
ns.Valid = true
|
||||
return ns.UsertitleStatusT.Scan(value)
|
||||
}
|
||||
|
||||
// Value implements the driver Valuer interface.
|
||||
func (ns NullUsertitleStatusT) Value() (driver.Value, error) {
|
||||
if !ns.Valid {
|
||||
return nil, nil
|
||||
}
|
||||
return string(ns.UsertitleStatusT), nil
|
||||
}
|
||||
|
||||
type Images struct {
|
||||
ImageID int32 `db:"image_id" json:"image_id"`
|
||||
StorageType StorageTypeT `db:"storage_type" json:"storage_type"`
|
||||
ImagePath string `db:"image_path" json:"image_path"`
|
||||
}
|
||||
|
||||
type Providers struct {
|
||||
ProviderID int32 `db:"provider_id" json:"provider_id"`
|
||||
ProviderName string `db:"provider_name" json:"provider_name"`
|
||||
}
|
||||
|
||||
type Reviews struct {
|
||||
ReviewID int32 `db:"review_id" json:"review_id"`
|
||||
UserID int32 `db:"user_id" json:"user_id"`
|
||||
TitleID int32 `db:"title_id" json:"title_id"`
|
||||
ImageIds []int32 `db:"image_ids" json:"image_ids"`
|
||||
ReviewText string `db:"review_text" json:"review_text"`
|
||||
CreationDate pgtype.Timestamp `db:"creation_date" json:"creation_date"`
|
||||
}
|
||||
|
||||
type Signals struct {
|
||||
SignalID int32 `db:"signal_id" json:"signal_id"`
|
||||
RawData []byte `db:"raw_data" json:"raw_data"`
|
||||
ProviderID int32 `db:"provider_id" json:"provider_id"`
|
||||
Dirty bool `db:"dirty" json:"dirty"`
|
||||
}
|
||||
|
||||
type Studios struct {
|
||||
StudioID int32 `db:"studio_id" json:"studio_id"`
|
||||
StudioName pgtype.Text `db:"studio_name" json:"studio_name"`
|
||||
IllustID pgtype.Int4 `db:"illust_id" json:"illust_id"`
|
||||
StudioDesc pgtype.Text `db:"studio_desc" json:"studio_desc"`
|
||||
}
|
||||
|
||||
type Tags struct {
|
||||
TagID int32 `db:"tag_id" json:"tag_id"`
|
||||
TagNames []byte `db:"tag_names" json:"tag_names"`
|
||||
}
|
||||
|
||||
type TitleTags struct {
|
||||
TitleID int32 `db:"title_id" json:"title_id"`
|
||||
TagID int32 `db:"tag_id" json:"tag_id"`
|
||||
}
|
||||
|
||||
type Titles struct {
|
||||
TitleID int32 `db:"title_id" json:"title_id"`
|
||||
TitleNames []byte `db:"title_names" json:"title_names"`
|
||||
StudioID int32 `db:"studio_id" json:"studio_id"`
|
||||
PosterID pgtype.Int4 `db:"poster_id" json:"poster_id"`
|
||||
SignalIds []int32 `db:"signal_ids" json:"signal_ids"`
|
||||
TitleStatus TitleStatusT `db:"title_status" json:"title_status"`
|
||||
Rating pgtype.Float8 `db:"rating" json:"rating"`
|
||||
RatingCount pgtype.Int4 `db:"rating_count" json:"rating_count"`
|
||||
ReleaseYear pgtype.Int4 `db:"release_year" json:"release_year"`
|
||||
ReleaseSeason NullReleaseSeasonT `db:"release_season" json:"release_season"`
|
||||
Season pgtype.Int4 `db:"season" json:"season"`
|
||||
EpisodesAired pgtype.Int4 `db:"episodes_aired" json:"episodes_aired"`
|
||||
EpisodesAll pgtype.Int4 `db:"episodes_all" json:"episodes_all"`
|
||||
EpisodesLen []byte `db:"episodes_len" json:"episodes_len"`
|
||||
}
|
||||
|
||||
type Users struct {
|
||||
UserID int32 `db:"user_id" json:"user_id"`
|
||||
AvatarID pgtype.Int4 `db:"avatar_id" json:"avatar_id"`
|
||||
Passhash string `db:"passhash" json:"passhash"`
|
||||
Mail pgtype.Text `db:"mail" json:"mail"`
|
||||
Nickname string `db:"nickname" json:"nickname"`
|
||||
DispName pgtype.Text `db:"disp_name" json:"disp_name"`
|
||||
UserDesc pgtype.Text `db:"user_desc" json:"user_desc"`
|
||||
CreationDate pgtype.Timestamp `db:"creation_date" json:"creation_date"`
|
||||
}
|
||||
|
||||
type Usertitles struct {
|
||||
UsertitleID int32 `db:"usertitle_id" json:"usertitle_id"`
|
||||
UserID int32 `db:"user_id" json:"user_id"`
|
||||
TitleID int32 `db:"title_id" json:"title_id"`
|
||||
Status UsertitleStatusT `db:"status" json:"status"`
|
||||
Rate pgtype.Int4 `db:"rate" json:"rate"`
|
||||
ReviewID pgtype.Int4 `db:"review_id" json:"review_id"`
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue