model

package
v0.0.0-...-d6daade Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AiringSchedule

type AiringSchedule struct {
	ID          uint           `json:"-" gorm:"column:id;primaryKey"`                                       // Primary key for the airing schedule
	ExternalId  int            `json:"id" gorm:"column:external_id;unique"`                                 // Unique external ID corresponding to Anilist
	AiringAt    int64          `json:"airingAt" gorm:"column:airing_at"`                                    // Airing time
	Episode     int            `json:"episode" gorm:"column:episode"`                                       // Episode number
	MediaId     uint           `json:"mediaId" gorm:"column:media_id"`                                      // Foreign key to the media table
	Media       Media          `json:"media,omitempty" gorm:"foreignKey:MediaId"`                           // Related media data
	SocialPosts []SocialPost   `json:"socialPosts,omitempty" gorm:"foreignKey:AiringScheduleId"`            // Optional social posts
	CreatedAt   time.Time      `json:"createdAt" gorm:"column:created_at;type:timestamptz"`                 // Timestamp for creation
	UpdatedAt   time.Time      `json:"updatedAt" gorm:"column:updated_at;type:timestamptz"`                 // Timestamp for update
	DeletedAt   gorm.DeletedAt `json:"deletedAt,omitempty" gorm:"column:deleted_at;type:timestamptz;index"` // Soft delete with timezone
}

func (AiringSchedule) TableName

func (AiringSchedule) TableName() string

type CoverImg

type CoverImg struct {
	Large string `json:"large" gorm:"column:cover_img"` // Cover image URL from API
}
type ExternalLink struct {
	ID         uint           `json:"-" gorm:"column:id;primaryKey"`
	ExternalId uint           `json:"id" gorm:"column:external_id"`
	SiteId     int            `json:"siteId" gorm:"column:site_id"`                                        // Site name from API
	Name       string         `json:"site" gorm:"column:name"`                                             // Site name from API
	Url        string         `json:"url" gorm:"column:url"`                                               // URL link from API
	Type       string         `json:"type" gorm:"column:type"`                                             // Type of link (e.g., "STREAMING")
	Language   string         `json:"language" gorm:"column:language"`                                     // Language from the api
	MediaId    uint           `json:"-" gorm:"column:media_id"`                                            // Foreign key to the media table
	CreatedAt  time.Time      `json:"createdAt" gorm:"column:created_at;type:timestamptz;"`                // Timestamps for DB
	UpdatedAt  time.Time      `json:"updatedAt" gorm:"column:updated_at;type:timestamptz;"`                // Timestamps for DB
	DeletedAt  gorm.DeletedAt `json:"deletedAt,omitempty" gorm:"column:deleted_at;type:timestamptz;index"` // Soft delete with timezone
}

func (ExternalLink) TableName

func (ExternalLink) TableName() string

type Media

type Media struct {
	ID            uint           `json:"-" gorm:"column:id;primaryKey"`
	ExternalId    uint           `json:"id" gorm:"column:external_id"`                                        // External ID for the media (from Anilist)
	SiteUrl       string         `json:"siteUrl" gorm:"column:site_url"`                                      // Media site URL
	Type          string         `json:"type" gorm:"column:type"`                                             // Media type (e.g., "ANIME") — map to type in DB
	Format        string         `json:"format" gorm:"column:format"`                                         // Format (e.g., "ONA") — map to format in DB
	Duration      int            `json:"duration" gorm:"column:duration"`                                     // Duration of the media
	Episodes      int            `json:"episodes" gorm:"column:episodes"`                                     // Number of episodes
	CoverImage    CoverImg       `json:"coverImage" gorm:"embedded"`                                          // Store the cover image URL in DB
	BannerImage   string         `json:"bannerImage" gorm:"column:banner_img"`                                // Store banner image URL in DB (if needed)
	Title         MediaTitle     `json:"title" gorm:"foreignKey:MediaID;references:ID"`                       // Foreign key setup for MediaTitle
	ExternalLinks []ExternalLink `json:"externalLinks,omitempty"`                                             // Ignore in DB (can store in another table if needed)
	CreatedAt     time.Time      `json:"createdAt" gorm:"column:created_at;type:timestamptz;"`                // Timestamps for DB
	UpdatedAt     time.Time      `json:"updatedAt" gorm:"column:updated_at;type:timestamptz;"`                // Timestamps for DB
	DeletedAt     gorm.DeletedAt `json:"deletedAt,omitempty" gorm:"column:deleted_at;type:timestamptz;index"` // Soft delete with timezone

}

type MediaTitle

type MediaTitle struct {
	ID        uint           `json:"-" gorm:"column:id;primaryKey"`
	English   string         `json:"english" gorm:"column:english"`
	MediaID   uint           `json:"-" gorm:"column:media_id;unique"` // Foreign key to Media
	CreatedAt time.Time      `json:"createdAt" gorm:"column:created_at;type:timestamptz;"`
	UpdatedAt time.Time      `json:"updatedAt" gorm:"column:updated_at;type:timestamptz;"`
	DeletedAt gorm.DeletedAt `json:"deletedAt,omitempty" gorm:"column:deleted_at;type:timestamptz;index"` // Soft delete with timezone

}

func (MediaTitle) TableName

func (MediaTitle) TableName() string

type Scheduler

type Scheduler struct {
	ID             uint           `gorm:"primaryKey"`                                                          // Primary key
	JobName        string         `gorm:"size:255;not null"`                                                   // Name of the job
	CronExpression string         `gorm:"size:255;not null"`                                                   // Cron expression for scheduling
	FunctionName   string         `gorm:"size:255;not null"`                                                   // Identifier of the function to execute
	IsActive       bool           `gorm:"default:true"`                                                        // Enable or disable the job
	LastRun        *time.Time     `gorm:"type:timestamp"`                                                      // Last execution time
	NextRun        *time.Time     `gorm:"type:timestamp"`                                                      // Optional: next scheduled run time
	Params         []byte         `gorm:"type:jsonb"`                                                          // Additional parameters in JSON format
	CreatedAt      time.Time      `gorm:"autoCreateTime;type:timestamptz;"`                                    // Timestamp when job was created
	UpdatedAt      time.Time      `gorm:"autoUpdateTime;type:timestamptz;"`                                    // Timestamp when job was last updated
	DeletedAt      gorm.DeletedAt `json:"deletedAt,omitempty" gorm:"column:deleted_at;type:timestamptz;index"` // Soft delete with timezone
}

func (Scheduler) TableName

func (Scheduler) TableName() string

type SocialPost

type SocialPost struct {
	ID               uint           `json:"-" gorm:"column:id;primaryKey"`                                       // auto incrementing number
	PostId           string         `json:"post_id" gorm:"column:post_id"`                                       // social id for the post
	AiringScheduleId uint           `json:"-" gorm:"column:airing_schedule_id;not null"`                         // external aring id
	CreatedAt        time.Time      `json:"createdAt" gorm:"column:created_at;type:timestamptz;"`                // Timestamps for DB
	UpdatedAt        time.Time      `json:"updatedAt" gorm:"column:updated_at;type:timestamptz;"`                // Timestamps for DB
	DeletedAt        gorm.DeletedAt `json:"deletedAt,omitempty" gorm:"column:deleted_at;type:timestamptz;index"` // Soft delete with timezone

}

func (SocialPost) TableName

func (SocialPost) TableName() string

type UpcomingAnime

type UpcomingAnime struct {
	Page struct {
		AiringSchedules []AiringSchedule `json:"airingSchedules"`
	} `json:"Page"`
}

Needed for Anilist api

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL