services

package
v0.0.0-...-26ab5ef Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2024 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileService

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

func NewFileService

func NewFileService(pasteRepo *repositories.PasteRepository, uploadDir, maxFileSize string) *FileService

func (*FileService) SaveFile

func (s *FileService) SaveFile(pasteID string, fileSize uint64, file io.Reader) (string, error)

UploadFile validates and stores a file, then saves metadata to Redis

type PasteService

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

func NewPasteService

func NewPasteService(pasteRepo *repositories.PasteRepository) *PasteService

NewPasteService creates a new instance of the PasteService

func (*PasteService) CreateNewPaste

func (s *PasteService) CreateNewPaste(ctx context.Context, burnAfter, readCount uint64, deepUrl uint8, secret string) (string, error)

CreateNewPaste creates a new paste and returns the paste ID

func (*PasteService) DeletePaste

func (s *PasteService) DeletePaste(ctx context.Context, pasteID string, secret string) (bool, error)

DeletePaste deletes a paste if the secret matches

func (*PasteService) GetPaste

func (s *PasteService) GetPaste(ctx context.Context, pasteID string) (bool, error)

GetPaste retrieves a paste by ID, decrements its read count, and deletes it if the read count is exhausted

func (*PasteService) IsPasteExist

func (s *PasteService) IsPasteExist(ctx context.Context, pasteID string) (bool, error)

IsPasteExist checks if a paste with the given ID exists

func (*PasteService) SecretMatch

func (s *PasteService) SecretMatch(ctx context.Context, pasteID string, secret string) (bool, error)

Jump to

Keyboard shortcuts

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