application

package
v0.0.0-...-d19cdba Latest Latest
Warning

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

Go to latest
Published: May 26, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithEvenOddDate

func WithEvenOddDate(eod EvenOddDate) func(*UseCase)

func WithPageFetcher

func WithPageFetcher(pf PageFetcher) func(*UseCase)

func WithTableParser

func WithTableParser(tp TableParser) func(*UseCase)

func WithTableRepository

func WithTableRepository(tr TableRepository) func(*UseCase)

Types

type EvenOddDate

type EvenOddDate interface {
	GetWeek(ctx context.Context, now time.Time) core.WeekType
}

type PageFetcher

type PageFetcher interface {
	FetchTablePage(ctx context.Context, group string, date string) (*html.Node, error)
}

type TableParser

type TableParser interface {
	PraseTable(ctx context.Context, doc *html.Node) (map[time.Weekday][][]core.Subject, error)
}

type TableRepository

type TableRepository interface {
	GetSchedule(ctx context.Context, group string, day time.Weekday) ([][]core.Subject, error)
	SetShedule(ctx context.Context, group string, day time.Weekday, subjects [][]core.Subject) error
}

type UseCase

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

func New

func New(ctx context.Context, opts ...func(*UseCase)) *UseCase

func (*UseCase) GetSchedule

func (uc *UseCase) GetSchedule(ctx context.Context, group string, date time.Time) ([][]core.Subject, error)

Jump to

Keyboard shortcuts

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