services

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2023 License: AGPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorUnableToModifyTags = errors.New("user can't modify tags")
	ErrorNoSuchTag          = errors.New("no such tag")
)
View Source
var ErrorUnsupportedLanguage = errors.New("unsupported language")

Functions

func StripHTMLRegex

func StripHTMLRegex(s string) string

Types

type ErrorMailService

type ErrorMailService struct{}

func (ErrorMailService) Send

type LogMailService

type LogMailService struct {
	Logger *log.Logger
}

func (LogMailService) Send

type MailService

type MailService interface {
	Send(ctx context.Context, m email.Mail) error
}

type ProblemListRequest

type ProblemListRequest struct {
	Problemset     string
	Pagination     pagination.Data
	TitleFilter    string
	TagFilter      []string
	CategoryFilter problem.CategoryFilter
	GETData        url.Values
}

func (ProblemListRequest) IsFiltered

func (r ProblemListRequest) IsFiltered() bool

type ProblemListService

type ProblemListService interface {
	GetProblemList(ctx context.Context, request ProblemListRequest) (*problem.PaginationList, error)
}

type ProblemStatsService

type ProblemStatsService interface {
	GetStatsData(ctx context.Context, p problem.Problem, userID int) (*problem.StatsData, error)
}

type RejudgeService

type RejudgeService interface {
	Rejudge(ctx context.Context, ID int) error
}

type SMTPMailService

type SMTPMailService struct {
	From     string
	Host     string
	Port     int
	User     string
	Password string
}

func (SMTPMailService) Send

func (s SMTPMailService) Send(ctx context.Context, mail email.Mail) error

type SQLProblem

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

func NewSQLProblem

func NewSQLProblem(db *sql.DB, ps problems.Store) *SQLProblem

func (SQLProblem) Get

func (s SQLProblem) Get(ctx context.Context, ID int) (*problem.Problem, error)

func (SQLProblem) GetAll

func (s SQLProblem) GetAll(ctx context.Context) ([]problem.Problem, error)

func (SQLProblem) GetByNames

func (s SQLProblem) GetByNames(ctx context.Context, problemset string, problemName string) (*problem.Problem, error)

func (SQLProblem) GetStatsData

func (s SQLProblem) GetStatsData(ctx context.Context, p problem.Problem, userID int) (*problem.StatsData, error)

type SQLProblemListService

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

func NewSQLProblemListService

func NewSQLProblemListService(db *sql.DB, ps problems.Store, repo problem.Repository) *SQLProblemListService

func (SQLProblemListService) GetProblemList

type SQLStatusPageService

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

func NewSQLStatusPageService

func NewSQLStatusPageService(db *sql.DB) *SQLStatusPageService

func (SQLStatusPageService) GetStatusPage

type SQLSubmission

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

func NewSQLSubmission

func NewSQLSubmission(db *sql.DB) SQLSubmission

func (SQLSubmission) Get

func (SQLSubmission) Rejudge

func (s SQLSubmission) Rejudge(ctx context.Context, ID int) error

type SQLSubmitService

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

func NewSQLSubmitService

func NewSQLSubmitService(db *sql.DB, problemStore problems.Store) *SQLSubmitService

func (*SQLSubmitService) Submit

type SQLTagsService

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

func NewSQLTagsService

func NewSQLTagsService(db *sql.DB) *SQLTagsService

func (SQLTagsService) Add

func (tg SQLTagsService) Add(ctx context.Context, tagID int, problemID int, userID int) error

func (SQLTagsService) Delete

func (tg SQLTagsService) Delete(ctx context.Context, tagID int, problemID int, userID int) error

type SendgridMailService

type SendgridMailService struct {
	SenderName    string
	SenderAddress string
	APIKey        string
}

func (SendgridMailService) Send

type StatusPageRequest

type StatusPageRequest struct {
	Pagination pagination.Data

	Problemset string
	Problem    string
	Verdict    *problems.VerdictName
	UserID     int
	GETValues  url.Values
}

type StatusPageService

type StatusPageService interface {
	GetStatusPage(ctx context.Context, req StatusPageRequest) (*submission.StatusPage, error)
}

type SubmitRequest

type SubmitRequest struct {
	UserID     int
	Problemset string
	Problem    string
	Language   string
	Source     []byte
}

type SubmitService

type SubmitService interface {
	Submit(ctx context.Context, subRequest SubmitRequest) (*submission.Submission, error)
}

type TagsService

type TagsService interface {
	Add(ctx context.Context, tagID int, problemID int, userID int) error
	Delete(ctx context.Context, tagID int, problemID int, userID int) error
}

Jump to

Keyboard shortcuts

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