models

package
v0.0.0-...-6cf5f30 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PasteData

type PasteData struct {
	Hash string // Unique identifier for the post (hash)
	Text string // The actual text content of the post
}

type S3Storage

type S3Storage struct {
	Bucket string
	S3     *s3.Client
}

func NewS3Storage

func NewS3Storage(bucket, region string) (*S3Storage, error)

func (*S3Storage) DeletePaste

func (storage *S3Storage) DeletePaste(hash string) error

DeletePaste deletes a paste from S3

func (*S3Storage) GetPaste

func (storage *S3Storage) GetPaste(hash string) (*PasteData, error)

GetPaste retrieves a paste from S3 and decodes it into PasteData

func (*S3Storage) UploadPaste

func (storage *S3Storage) UploadPaste(data *PasteData) (string, error)

UploadPaste uploads paste data to S3 and returns the upload location URL

type Storage

type Storage interface {
	GetPaste(hash string) (*PasteData, error)    // Retrieve post data from blob storage
	UploadPaste(data *PasteData) (string, error) // Upload post data to blob storage
	DeletePaste(hash string) error
}

Jump to

Keyboard shortcuts

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