karma

package
v0.0.0-...-fcfa919 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2024 License: ISC Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IRepository

type IRepository interface {
	CreateKarma(ctx context.Context, karma *domain.Karma) error
	UpdateKarma(ctx context.Context, karma *domain.Karma) error
	GetKarmaByGuildID(ctx context.Context, guildID string) ([]domain.Karma, error)
	GetKarmaByUserIDAndGuildID(ctx context.Context, userID, guildID string) (domain.Karma, error)
	GetTopKarmaByGuildID(ctx context.Context, guildID string) ([]domain.Karma, error)
}

IRepository is the user repository interface.

func NewSQLRepository

func NewSQLRepository(dbConn *gorm.DB) IRepository

type IUseCase

type IUseCase interface {
	CreateKarma(ctx context.Context, karma domain.Karma) (domain.Karma, error)
	UpdateKarma(ctx context.Context, karma domain.Karma) (domain.Karma, error)
	GetKarma(ctx context.Context, userID, guildID string) (domain.Karma, error)
	GetTopKarma(ctx context.Context, guildID string) ([]domain.Karma, error)
	IncrementKarma(ctx context.Context, userID, guildID string) (domain.Karma, error)
}

IUseCase is the user use case interface.

func NewUseCase

func NewUseCase(repo IRepository) IUseCase

type SQLRepository

type SQLRepository struct {
	DBConn *gorm.DB
}

func (SQLRepository) CreateKarma

func (r SQLRepository) CreateKarma(ctx context.Context, karma *domain.Karma) error

func (SQLRepository) GetKarmaByGuildID

func (r SQLRepository) GetKarmaByGuildID(ctx context.Context, guildID string) ([]domain.Karma, error)

func (SQLRepository) GetKarmaByUserIDAndGuildID

func (r SQLRepository) GetKarmaByUserIDAndGuildID(ctx context.Context, userID, guildID string) (domain.Karma, error)

func (SQLRepository) GetTopKarmaByGuildID

func (r SQLRepository) GetTopKarmaByGuildID(ctx context.Context, guildID string) ([]domain.Karma, error)

func (SQLRepository) UpdateKarma

func (r SQLRepository) UpdateKarma(ctx context.Context, karma *domain.Karma) error

type UseCase

type UseCase struct {
	IRepository
}

func (UseCase) CreateKarma

func (u UseCase) CreateKarma(ctx context.Context, karma domain.Karma) (domain.Karma, error)

func (UseCase) GetKarma

func (u UseCase) GetKarma(ctx context.Context, userID, guildID string) (domain.Karma, error)

func (UseCase) GetTopKarma

func (u UseCase) GetTopKarma(ctx context.Context, guildID string) ([]domain.Karma, error)

func (UseCase) IncrementKarma

func (u UseCase) IncrementKarma(ctx context.Context, userID, guildID string) (domain.Karma, error)

func (UseCase) UpdateKarma

func (u UseCase) UpdateKarma(ctx context.Context, karma domain.Karma) (domain.Karma, error)

Jump to

Keyboard shortcuts

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