You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Koito/internal/repository/models.go

165 lines
2.6 KiB

// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.29.0
package repository
import (
"database/sql/driver"
"fmt"
"time"
"github.com/google/uuid"
"github.com/jackc/pgx/v5/pgtype"
)
type Role string
const (
RoleAdmin Role = "admin"
RoleUser Role = "user"
)
func (e *Role) Scan(src interface{}) error {
switch s := src.(type) {
case []byte:
*e = Role(s)
case string:
*e = Role(s)
default:
return fmt.Errorf("unsupported scan type for Role: %T", src)
}
return nil
}
type NullRole struct {
Role Role
Valid bool // Valid is true if Role is not NULL
}
// Scan implements the Scanner interface.
func (ns *NullRole) Scan(value interface{}) error {
if value == nil {
ns.Role, ns.Valid = "", false
return nil
}
ns.Valid = true
return ns.Role.Scan(value)
}
// Value implements the driver Valuer interface.
func (ns NullRole) Value() (driver.Value, error) {
if !ns.Valid {
return nil, nil
}
return string(ns.Role), nil
}
type ApiKey struct {
ID int32
Key string
UserID int32
CreatedAt pgtype.Timestamp
Label string
}
type Artist struct {
ID int32
MusicBrainzID *uuid.UUID
Image *uuid.UUID
ImageSource pgtype.Text
}
type ArtistAlias struct {
ArtistID int32
Alias string
Source string
IsPrimary bool
}
type ArtistRelease struct {
ArtistID int32
ReleaseID int32
}
type ArtistTrack struct {
ArtistID int32
TrackID int32
}
type ArtistsWithName struct {
ID int32
MusicBrainzID *uuid.UUID
Image *uuid.UUID
ImageSource pgtype.Text
Name string
}
type Listen struct {
TrackID int32
ListenedAt time.Time
Client *string
UserID int32
}
type Release struct {
ID int32
MusicBrainzID *uuid.UUID
Image *uuid.UUID
VariousArtists bool
ImageSource pgtype.Text
}
type ReleaseAlias struct {
ReleaseID int32
Alias string
Source string
IsPrimary bool
}
type ReleasesWithTitle struct {
ID int32
MusicBrainzID *uuid.UUID
Image *uuid.UUID
VariousArtists bool
ImageSource pgtype.Text
Title string
}
type Session struct {
ID uuid.UUID
UserID int32
CreatedAt time.Time
ExpiresAt time.Time
Persistent bool
}
type Track struct {
ID int32
MusicBrainzID *uuid.UUID
Duration int32
ReleaseID int32
}
type TrackAlias struct {
TrackID int32
Alias string
IsPrimary bool
Source string
}
type TracksWithTitle struct {
ID int32
MusicBrainzID *uuid.UUID
Duration int32
ReleaseID int32
Title string
}
type User struct {
ID int32
Username string
Role Role
Password []byte
}