repository

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package repository is a package for providing jrp repository.

Index

Constants

View Source
const (
	// jrp sqlite database file name
	JRP_DB_FILE_NAME = "jrp.db"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AddStatus

type AddStatus int

AddStatus is a type for add status

const (
	// AddedSuccessfully is a status for added successfully
	AddedSuccessfully AddStatus = iota
	// AddedFailed is a status for added failed
	AddedFailed
	// AddedNone is a status for added none
	AddedNone
	// AddedNotAll is a status for added not all
	AddedNotAll
)

type JrpRepository

type JrpRepository struct {
	FmtProxy     fmtproxy.Fmt
	SortProxy    sortproxy.Sort
	SqlProxy     sqlproxy.Sql
	StringsProxy stringsproxy.Strings
}

JrpRepository is a struct that implements JrpRepositoryInterface.

func New

func New(
	fmtProxy fmtproxy.Fmt,
	sortProxy sortproxy.Sort,
	sqlProxy sqlproxy.Sql,
	stringsProxy stringsproxy.Strings,
) *JrpRepository

New is a constructor for JrpRepository.

func (JrpRepository) AddFavoriteByIDs

func (j JrpRepository) AddFavoriteByIDs(jrpDBFilePath string, ids []int) (AddStatus, error)

AddFavoriteByIDs adds jrps to favorite by IDs.

func (JrpRepository) GetAllFavorite

func (j JrpRepository) GetAllFavorite(jrpDBFilePath string) ([]*model.Jrp, error)

GetAllFavorite gets all jrps that are favorited.

func (JrpRepository) GetAllHistory

func (j JrpRepository) GetAllHistory(jrpDBFilePath string) ([]*model.Jrp, error)

GetAllHistory gets all jrps as history.

func (JrpRepository) GetFavoriteWithNumber

func (j JrpRepository) GetFavoriteWithNumber(jrpDBFilePath string, number int) ([]*model.Jrp, error)

GetFavoriteWithNumber gets jrps that are favorited with number.

func (JrpRepository) GetHistoryWithNumber

func (j JrpRepository) GetHistoryWithNumber(jrpDBFilePath string, number int) ([]*model.Jrp, error)

GetHistoryWithNumber gets history with number.

func (JrpRepository) RemoveFavoriteAll

func (j JrpRepository) RemoveFavoriteAll(jrpDBFilePath string) (RemoveStatus, error)

RemoveFavoriteAll removes all jrps from favorite.

func (JrpRepository) RemoveFavoriteByIDs

func (j JrpRepository) RemoveFavoriteByIDs(jrpDBFilePath string, ids []int) (RemoveStatus, error)

RemoveFavoriteByIDs removes jrps from favorite by IDs.

func (JrpRepository) RemoveHistoryAll

func (j JrpRepository) RemoveHistoryAll(jrpDBFilePath string, force bool) (RemoveStatus, error)

RemoveHistoryAll removes all jrps.

func (JrpRepository) RemoveHistoryByIDs

func (j JrpRepository) RemoveHistoryByIDs(jrpDBFilePath string, ids []int, force bool) (RemoveStatus, error)

RemoveHistoryByIDs removes jrps by IDs.

func (JrpRepository) SaveHistory

func (j JrpRepository) SaveHistory(jrpDBFilePath string, jrps []*model.Jrp) (SaveStatus, error)

SaveHistory saves jrps as history.

func (JrpRepository) SearchAllFavorite

func (j JrpRepository) SearchAllFavorite(jrpDBFilePath string, keywords []string, and bool) ([]*model.Jrp, error)

SearchAllFavorite searches all jrps that are favorited with keywords.

func (JrpRepository) SearchAllHistory

func (j JrpRepository) SearchAllHistory(jrpDBFilePath string, keywords []string, and bool) ([]*model.Jrp, error)

SearchAllHistory searches all jrps as history with keywords.

func (JrpRepository) SearchFavoriteWithNumber

func (j JrpRepository) SearchFavoriteWithNumber(
	jrpDBFilePath string,
	number int,
	keywords []string,
	and bool,
) ([]*model.Jrp, error)

SearchFavoriteWithNumber searches jrps that are favorited with number and keywords.

func (JrpRepository) SearchHistoryWithNumber

func (j JrpRepository) SearchHistoryWithNumber(
	jrpDBFilePath string,
	number int,
	keywords []string,
	and bool,
) ([]*model.Jrp, error)

SearchHistoryWithNumber searches jrps as history with number and keywords.

type JrpRepositoryInterface

type JrpRepositoryInterface interface {
	SaveHistory(jrpDBFilePath string, jrps []*model.Jrp) (SaveStatus, error)
	GetAllHistory(jrpDBFilePath string) ([]*model.Jrp, error)
	GetHistoryWithNumber(jrpDBFilePath string, number int) ([]*model.Jrp, error)
	SearchHistoryWithNumber(jrpDBFilePath string, number int, keywords []string, and bool) ([]*model.Jrp, error)
	SearchAllHistory(jrpDBFilePath string, keywords []string, and bool) ([]*model.Jrp, error)
	RemoveHistoryByIDs(jrpDBFilePath string, ids []int, force bool) (RemoveStatus, error)
	RemoveHistoryAll(jrpDBFilePath string, force bool) (RemoveStatus, error)
	GetAllFavorite(jrpDBFilePath string) ([]*model.Jrp, error)
	GetFavoriteWithNumber(jrpDBFilePath string, number int) ([]*model.Jrp, error)
	SearchAllFavorite(jrpDBFilePath string, keywords []string, and bool) ([]*model.Jrp, error)
	SearchFavoriteWithNumber(jrpDBFilePath string, number int, keywords []string, and bool) ([]*model.Jrp, error)
	AddFavoriteByIDs(jrpDBFilePath string, ids []int) (AddStatus, error)
	RemoveFavoriteByIDs(jrpDBFilePath string, ids []int) (RemoveStatus, error)
	RemoveFavoriteAll(jrpDBFilePath string) (RemoveStatus, error)
}

JrpRepositoryInterface is an interface for JrpRepository.

type RemoveStatus

type RemoveStatus int

RemoveStatus is a type for remove status

const (
	// RemovedSuccessfully is a status for removed successfully
	RemovedSuccessfully RemoveStatus = iota
	// RemovedFailed is a status for removed failed
	RemovedFailed
	// RemovedNone is a status for removed none
	RemovedNone
	// RemovedNotAll is a status for removed not all
	RemovedNotAll
)

type SaveStatus

type SaveStatus int

SaveStatus is a type for save status

const (
	// SavedSuccessfully is a status for saved successfully
	SavedSuccessfully SaveStatus = iota
	// SavedFailed is a status for saved failed
	SavedFailed
	// SavedNone is a status for saved none
	SavedNone
	// SavedNotAll is a status for saved not all
	SavedNotAll
)

Directories

Path Synopsis
Package query is a package for providing queries to manage jrp database.
Package query is a package for providing queries to manage jrp database.

Jump to

Keyboard shortcuts

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