paste

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2026 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const Forever = 100 * 365 * 24 * time.Hour

Forever represents a paste that never expires (100 years)

Variables

This section is empty.

Functions

func ComputeChecksum

func ComputeChecksum(content string) string

ComputeChecksum calculates the SHA256 checksum of the given content

Types

type Meta

type Meta struct {
	Checksum  string    `json:"checksum"`
	CreatedAt time.Time `json:"created_at"`
	ExpiresAt time.Time `json:"expires_at"`
	Size      int64     `json:"size"`
}

Meta represents paste metadata stored alongside the content

func NewMeta

func NewMeta(checksum string, size int64, ttl time.Duration) *Meta

NewMeta creates metadata for a paste with the specified TTL

func (*Meta) IsExpired

func (m *Meta) IsExpired() bool

IsExpired returns true if the paste has exceeded its TTL

type Paste

type Paste struct {
	Checksum string
	Content  string
}

Paste represents a paste's content

func NewPaste

func NewPaste(content string) *Paste

NewPaste creates a new paste with the given content

type TTLOption

type TTLOption struct {
	Label     string
	Duration  time.Duration
	IsDefault bool
}

TTLOption represents a time-to-live choice for pastes

func TTLOptions

func TTLOptions(defaultTTL time.Duration) []TTLOption

TTLOptions returns the available TTL choices with the specified default marked

Jump to

Keyboard shortcuts

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