usecase

package
v0.0.0-...-c26c883 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCacheMiss       = errors.New("cache miss")
	ErrRowNotFound     = errors.New("row not found in db")
	ErrUnsavedZone     = errors.New("zone to save is not Red or Green")
	ErrUnsupportedFlow = errors.New("unsupported request flow")
)

Functions

This section is empty.

Types

type Usecase

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

func New

func New(postgres scan.Postgres, redis scan.Redis, logger *slog.Logger) *Usecase

func (*Usecase) CachedResponse

func (uc *Usecase) CachedResponse(ctx context.Context, inputType, requestParam string) (string, error)

func (*Usecase) DetermineInputType

func (uc *Usecase) DetermineInputType(input string) (string, string, error)

DetermineInputType определяет тип входной строки: IP, URL, домен или развернутую ссылку.

func (*Usecase) GetTextOCRResponse

func (uc *Usecase) GetTextOCRResponse(OCR models.ApiResponse) ([]string, error)

возвращает слова из запроса OCR без побелов

func (*Usecase) RequestKasperskyAPI

func (uc *Usecase) RequestKasperskyAPI(ctx context.Context, ioc string, apiKey string) (*models.ResponseFromAPI, error)

func (*Usecase) SaveResponse

func (uc *Usecase) SaveResponse(ctx context.Context, respJson, zone, inputType, requestParam string, userID int) error

func (*Usecase) SaveUserStats

func (uc *Usecase) SaveUserStats(ctx context.Context, zone, inputType, requestParam string, userID int) error

func (*Usecase) SavedResponse

func (uc *Usecase) SavedResponse(ctx context.Context, inputType, requestParam string) (string, error)

func (*Usecase) SetCachedResponse

func (uc *Usecase) SetCachedResponse(ctx context.Context, savedResponse, inputType, requestParam string) error

Jump to

Keyboard shortcuts

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