sql

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SQL

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

SQL contains functions for user sql database.

func New

func New(db *gorm.DB, age int) *SQL

New to create new user database.

func (*SQL) DeleteByAnimeID added in v0.3.2

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

DeleteByAnimeID to delete by anime id.

func (*SQL) DeleteNotInList added in v0.3.0

func (sql *SQL) DeleteNotInList(ctx context.Context, username string, ids []int64) (int, error)

DeleteNotInList to delete anime not in list.

func (*SQL) Get

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

Get to get user anime.

func (*SQL) GetOldUsernames added in v0.3.0

func (sql *SQL) GetOldUsernames(ctx context.Context) ([]string, int, error)

GetOldUsernames to get old usernames.

func (*SQL) IsOld

func (sql *SQL) IsOld(ctx context.Context, username string) (bool, int, error)

IsOld to check if old.

func (*SQL) Update

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

Update to update user anime.

type UserAnime

type UserAnime struct {
	ID           int64  `gorm:"primaryKey"`
	Username     string `gorm:"index:username_index"`
	AnimeID      int64  `gorm:"index:anime_id_index"`
	Status       entity.Status
	Score        int
	Episode      int
	StartDay     int
	StartMonth   int
	StartYear    int
	EndDay       int
	EndMonth     int
	EndYear      int
	Priority     entity.Priority
	IsRewatching bool
	RewatchCount int
	RewatchValue entity.RewatchValue
	Tags         string
	Comment      string
	CreatedAt    time.Time
	UpdatedAt    time.Time
	DeletedAt    gorm.DeletedAt
}

UserAnime is user_anime database model.

Jump to

Keyboard shortcuts

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