Files
mtusi2026lab4/internal/db/models.go
T

165 lines
3.4 KiB
Go

// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.31.1
package db
import (
"database/sql/driver"
"fmt"
"time"
"github.com/google/uuid"
)
type AttachmentContentType string
const (
AttachmentContentTypeImagePng AttachmentContentType = "image/png"
AttachmentContentTypeImageJpeg AttachmentContentType = "image/jpeg"
)
func (e *AttachmentContentType) Scan(src interface{}) error {
switch s := src.(type) {
case []byte:
*e = AttachmentContentType(s)
case string:
*e = AttachmentContentType(s)
default:
return fmt.Errorf("unsupported scan type for AttachmentContentType: %T", src)
}
return nil
}
type NullAttachmentContentType struct {
AttachmentContentType AttachmentContentType
Valid bool // Valid is true if AttachmentContentType is not NULL
}
// Scan implements the Scanner interface.
func (ns *NullAttachmentContentType) Scan(value interface{}) error {
if value == nil {
ns.AttachmentContentType, ns.Valid = "", false
return nil
}
ns.Valid = true
return ns.AttachmentContentType.Scan(value)
}
// Value implements the driver Valuer interface.
func (ns NullAttachmentContentType) Value() (driver.Value, error) {
if !ns.Valid {
return nil, nil
}
return string(ns.AttachmentContentType), nil
}
type AttachmentStatus string
const (
AttachmentStatusQueued AttachmentStatus = "queued"
AttachmentStatusProcessing AttachmentStatus = "processing"
AttachmentStatusReady AttachmentStatus = "ready"
AttachmentStatusFailed AttachmentStatus = "failed"
)
func (e *AttachmentStatus) Scan(src interface{}) error {
switch s := src.(type) {
case []byte:
*e = AttachmentStatus(s)
case string:
*e = AttachmentStatus(s)
default:
return fmt.Errorf("unsupported scan type for AttachmentStatus: %T", src)
}
return nil
}
type NullAttachmentStatus struct {
AttachmentStatus AttachmentStatus
Valid bool // Valid is true if AttachmentStatus is not NULL
}
// Scan implements the Scanner interface.
func (ns *NullAttachmentStatus) Scan(value interface{}) error {
if value == nil {
ns.AttachmentStatus, ns.Valid = "", false
return nil
}
ns.Valid = true
return ns.AttachmentStatus.Scan(value)
}
// Value implements the driver Valuer interface.
func (ns NullAttachmentStatus) Value() (driver.Value, error) {
if !ns.Valid {
return nil, nil
}
return string(ns.AttachmentStatus), nil
}
type Attachment struct {
ID uuid.UUID
ChatID uuid.UUID
OwnerID uuid.UUID
S3Key string
Filename string
ContentType AttachmentContentType
SizeBytes int
Sha256 string
Status AttachmentStatus
ErrorCode *string
CreatedAt time.Time
UpdatedAt time.Time
}
type Chat struct {
ID uuid.UUID
Title string
CreatedAt time.Time
}
type ChatMember struct {
ChatID uuid.UUID
UserID uuid.UUID
}
type IdempotencyKey struct {
UserID uuid.UUID
Method string
Path string
Key string
RequestHash string
MessageID uuid.UUID
CreatedAt time.Time
}
type Message struct {
ID uuid.UUID
ChatID uuid.UUID
SenderID uuid.UUID
Text string
CreatedAt time.Time
}
type MessageAttachment struct {
MessageID uuid.UUID
AttachmentID uuid.UUID
Position int
}
type Session struct {
TokenHash string
UserID uuid.UUID
CreatedAt time.Time
ExpiresAt time.Time
}
type User struct {
ID uuid.UUID
Username string
DisplayName string
PasswordHash string
CreatedAt time.Time
}