db

package module
v0.0.0-...-e3e5b5f Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplySuggestion

func ApplySuggestion(db *gorm.DB, suggestion Suggestion)

ApplySuggestion updates the database in db.DB in line with the instructions in the suggestion. It should take the suggestion.From value and find a Series object with that as a title. Then find a series with suggestion.To as a title. All episodes connected to the first should be updated to point to the second series. The first series should then be deleted.

func Init

func Init(dbName string) *gorm.DB

func SaveIssue

func SaveIssue(db *gorm.DB, issue Issue)

func SaveIssues

func SaveIssues(db *gorm.DB, issues []Issue)

Types

type Creator

type Creator struct {
	gorm.Model
	Name string `gorm:"uniqueIndex"`
}

type Episode

type Episode struct {
	gorm.Model
	Title    string
	Part     int `gorm:"CHECK:part >= 0"`
	IssueID  uint
	Issue    Issue
	SeriesID uint
	Series   Series
	PageFrom int
	PageThru int
	Script   []*Creator `gorm:"many2many:episode_writers"`
	Art      []*Creator `gorm:"many2many:episode_artists"`
	Colours  []*Creator `gorm:"many2many:episode_colourists"`
	Letters  []*Creator `gorm:"many2many:episode_letterers"`
}

type EpisodeArtist

type EpisodeArtist struct {
	EpisodeID uint `gorm:"primaryKey"`
	CreatorID uint `gorm:"primaryKey"`
	CreatedAt time.Time
	DeletedAt gorm.DeletedAt
}

type EpisodeColourist

type EpisodeColourist struct {
	EpisodeID uint `gorm:"primaryKey"`
	CreatorID uint `gorm:"primaryKey"`
	CreatedAt time.Time
	DeletedAt gorm.DeletedAt
}

type EpisodeLetterer

type EpisodeLetterer struct {
	EpisodeID uint `gorm:"primaryKey"`
	CreatorID uint `gorm:"primaryKey"`
	CreatedAt time.Time
	DeletedAt gorm.DeletedAt
}

type EpisodeWriter

type EpisodeWriter struct {
	EpisodeID uint `gorm:"primaryKey"`
	CreatorID uint `gorm:"primaryKey"`
	CreatedAt time.Time
	DeletedAt gorm.DeletedAt
}

type Issue

type Issue struct {
	gorm.Model
	PublicationID uint `gorm:"uniqueIndex:idx_pub_issue"`
	Publication   Publication
	IssueNumber   int `gorm:"CHECK:issue_number >= 0;uniqueIndex:idx_pub_issue"`
	Episodes      []Episode
	Filename      string
}

type Publication

type Publication struct {
	gorm.Model
	Title string `gorm:"CHECK:title <> NULL;uniqueIndex"`
}

type Series

type Series struct {
	gorm.Model
	Title string `gorm:"CHECK:title <> NULL;CHECK:title <> \"\";uniqueIndex"`
}

type Suggestion

type Suggestion struct {
	From string
	To   string
	Type SuggestionType
}

func GetEpisodeTitleRenameSuggestions

func GetEpisodeTitleRenameSuggestions(db *gorm.DB, knownTitles []string) []Suggestion

func GetSeriesTitleRenameSuggestions

func GetSeriesTitleRenameSuggestions(db *gorm.DB, knownTitles []string) []Suggestion

type SuggestionType

type SuggestionType int64
const (
	SeriesTitle SuggestionType = iota
	EpisodeTitle
)

Jump to

Keyboard shortcuts

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