sql

package
v0.11.8 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Anime

type Anime struct {
	ID              int64 `gorm:"primaryKey"`
	Title           string
	TitleSynonym    string
	TitleEnglish    string
	TitleJapanese   string
	Picture         string
	StartDay        int
	StartMonth      int
	StartYear       int
	EndDay          int
	EndMonth        int
	EndYear         int
	Synopsis        string
	NSFW            bool
	Type            entity.Type
	Status          entity.Status
	Episode         int
	EpisodeDuration int // in seconds
	Season          entity.Season
	SeasonYear      int
	BroadcastDay    entity.Day
	BroadcastTime   string
	Source          entity.Source
	Rating          entity.Rating
	Background      string

	// Stats.
	Mean          float64
	Rank          int
	Popularity    int
	Member        int
	Voter         int
	UserWatching  int
	UserCompleted int
	UserOnHold    int
	UserDropped   int
	UserPlanned   int

	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt gorm.DeletedAt
}

Anime is anime database model.

type AnimeGenre

type AnimeGenre struct {
	AnimeID int64 `gorm:"primaryKey"`
	GenreID int64 `gorm:"primaryKey"`
}

AnimeGenre is anime_genre database model.

type AnimePicture

type AnimePicture struct {
	AnimeID int64 `gorm:"index"`
	URL     string
}

AnimePicture is anime_picture database model.

type AnimeRelated

type AnimeRelated struct {
	AnimeID1 int64           `gorm:"primaryKey"`
	AnimeID2 int64           `gorm:"primaryKey"`
	Relation entity.Relation `gorm:"primaryKey"`
}

AnimeRelated is anime_related database model.

type AnimeStatsHistory

type AnimeStatsHistory struct {
	ID            int64
	AnimeID       int64 `gorm:"index"`
	Mean          float64
	Rank          int
	Popularity    int
	Member        int
	Voter         int
	UserWatching  int
	UserCompleted int
	UserOnHold    int
	UserDropped   int
	UserPlanned   int
	CreatedAt     time.Time
}

AnimeStatsHistory is anime_stats_history database model.

type AnimeStudio

type AnimeStudio struct {
	AnimeID  int64 `gorm:"primaryKey"`
	StudioID int64 `gorm:"primaryKey"`
}

AnimeStudio is anime_studio database model.

type SQL

type SQL struct {
	// contains filtered or unexported fields
}

SQL contains functions for anime sql database.

func New

func New(db *gorm.DB, finishedAge, releasingAge, notYetAge int) *SQL

New to create new anime database.

func (*SQL) DeleteByID added in v0.3.2

func (sql *SQL) DeleteByID(ctx context.Context, id int64) (int, error)

DeleteByID to delete by id.

func (*SQL) Get added in v0.9.0

func (sql *SQL) Get(ctx context.Context, data entity.GetRequest) ([]*entity.Anime, int, int, error)

Get to get anime list.

func (*SQL) GetByID

func (sql *SQL) GetByID(ctx context.Context, id int64) (*entity.Anime, int, error)

GetByID to get anime by id.

func (*SQL) GetByIDs

func (sql *SQL) GetByIDs(ctx context.Context, ids []int64) ([]*entity.Anime, int, error)

GetByIDs to get anime by ids.

func (*SQL) GetHistories added in v0.9.0

func (sql *SQL) GetHistories(ctx context.Context, data entity.GetHistoriesRequest) ([]entity.History, int, error)

GetHistories to get histories.

func (*SQL) GetIDs

func (sql *SQL) GetIDs(ctx context.Context) ([]int64, int, error)

GetIDs to get all anime ids.

func (*SQL) GetMaxID

func (sql *SQL) GetMaxID(ctx context.Context) (int64, int, error)

GetMaxID to get max id.

func (*SQL) GetOldFinishedIDs

func (sql *SQL) GetOldFinishedIDs(ctx context.Context) ([]int64, int, error)

GetOldFinishedIDs to get old finished anime ids.

func (*SQL) GetOldNotYetIDs

func (sql *SQL) GetOldNotYetIDs(ctx context.Context) ([]int64, int, error)

GetOldNotYetIDs to get old not yet released anime ids.

func (*SQL) GetOldReleasingIDs

func (sql *SQL) GetOldReleasingIDs(ctx context.Context) ([]int64, int, error)

GetOldReleasingIDs to get old releasing anime ids.

func (*SQL) GetRelatedByIDs added in v0.3.0

func (sql *SQL) GetRelatedByIDs(ctx context.Context, ids []int64) ([]*entity.AnimeRelated, int, error)

GetRelatedByIDs to get related anime by ids.

func (*SQL) IsOld

func (sql *SQL) IsOld(ctx context.Context, id int64) (bool, int, error)

IsOld to check if old.

func (*SQL) Update

func (sql *SQL) Update(ctx context.Context, data entity.Anime) (int, error)

Update to update anime data.

Jump to

Keyboard shortcuts

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