saver

package
Version: v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2020 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Saver

type Saver struct {
	MalService *malscraper.MalService
	Config     config.Config
	DB         *gorm.DB

	// Cache master table values.
	// To prevent re-querying to db.
	Producer map[int]string
	Magazine map[int]string
	Genre    map[string]map[int]string
	Status   map[string]map[int]string
	Type     map[string]map[int]string
	Language map[int]string
	Position map[int]string
	Rating   map[int]string
	Related  map[int]string
	Source   map[int]string

	// Queued queue that will be inserted to queue table.
	// Value: `type-id`.
	Queue []string
}

Saver is base model for malkeeper saver.

func (*Saver) Anime

func (s *Saver) Anime(id int)

Anime to parse and save anime and its related entries (anime/manga/character/people).

func (*Saver) Character

func (s *Saver) Character(id int)

Character to parse and save character and its related entries (anime/manga/character/people).

func (*Saver) CleanEntry added in v0.12.0

func (s *Saver) CleanEntry(t string, id int)

CleanEntry to clean empty entry and its relations.

func (*Saver) CreateSchema

func (s *Saver) CreateSchema() error

CreateSchema to create new schema.

func (*Saver) CreateTable

func (s *Saver) CreateTable(model interface{}) error

CreateTable to create table.

func (*Saver) Enqueue added in v0.12.0

func (s *Saver) Enqueue(t string, id int) (code int, err error)

Enqueue to request an entry to be re-parsed.

func (*Saver) EnqueueUser added in v0.17.0

func (s *Saver) EnqueueUser(username string) (code int, err error)

EnqueueUser to enqueue user to be re-parsed.

func (*Saver) FillGenre

func (s *Saver) FillGenre() error

FillGenre to re-fill anime & manga genre master table.

func (*Saver) FillMaster

func (s *Saver) FillMaster() error

FillMaster to fill master tables.

func (*Saver) FillProducerMagazine

func (s *Saver) FillProducerMagazine() error

FillProducerMagazine to re-fill producer_magazine master tables.

func (*Saver) ForceAnime

func (s *Saver) ForceAnime(id int)

ForceAnime to force re-parse and save anime and its related entries (anime/manga/character/people).

func (*Saver) ForceCharacter

func (s *Saver) ForceCharacter(id int)

ForceCharacter to force re-parse and save character and its related entries (anime/manga/character/people).

func (*Saver) ForceManga

func (s *Saver) ForceManga(id int)

ForceManga to force re-parse and save manga and its related entries (anime/manga/character/people).

func (*Saver) ForcePeople

func (s *Saver) ForcePeople(id int)

ForcePeople to force re-parse and save people and its related entries (anime/manga/character/people).

func (*Saver) ForceUser added in v0.17.0

func (s *Saver) ForceUser(username string)

ForceUser to for re-parse and save user's anime and manga list.

func (*Saver) GetExistingTables

func (s *Saver) GetExistingTables() (tables []string)

GetExistingTables to get existing tables.

func (*Saver) GetStructTableName

func (s *Saver) GetStructTableName(model interface{}) string

GetStructTableName to get table name of the struct (model).

func (*Saver) GetTables

func (s *Saver) GetTables() (tables []interface{})

GetTables to get all tables (model) used by malkeeper.

func (*Saver) Init

func (s *Saver) Init() error

Init to initialize Saver fields.

func (*Saver) IsEmptyEntry

func (s *Saver) IsEmptyEntry(t string, id int) bool

IsEmptyEntry to check if entry is an empty MyAnimeList entry.

func (*Saver) IsSchemaExist

func (s *Saver) IsSchemaExist() (isExist bool)

IsSchemaExist to check if schema exists.

func (*Saver) Log

func (s *Saver) Log(logType string, text ...string)

Log is wrapper malloger logging for easier call.

func (*Saver) Manga

func (s *Saver) Manga(id int)

Manga to parse and save manga and its related entries (anime/manga/character/people).

func (*Saver) People

func (s *Saver) People(id int)

People to parse and save people and its related entries (anime/manga/character/people).

func (*Saver) RunQueue

func (s *Saver) RunQueue(breakTime ...int)

RunQueue to start parsing and saving queued entry.

func (*Saver) User added in v0.17.0

func (s *Saver) User(username string)

User to parse and save user's anime and manga list.

func (*Saver) ValidateDB

func (s *Saver) ValidateDB() error

ValidateDB to validate malkeeper database.

Jump to

Keyboard shortcuts

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