Documentation
¶
Overview ¶
Package attachments provides a shared attachment model and lightweight helpers.
Index ¶
Constants ¶
const ( TypeImage = event.AttachmentTypeImage TypeFile = event.AttachmentTypeFile TypeURL = event.AttachmentTypeURL TypeUnknown = event.AttachmentTypeUnknown )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Attachment ¶
type Attachment = event.Attachment
func ExtractFromEvent ¶
func ExtractFromEvent(ev event.Event) []Attachment
ExtractFromEvent returns normalized media followed by URLs found in event text.
func ExtractText ¶
func ExtractText(text string) []Attachment
ExtractText returns unique HTTP and HTTPS URLs found in text.
type History ¶
type History struct {
// contains filtered or unexported fields
}
History keeps a bounded, concurrency-safe attachment history per key.
func NewHistory ¶
NewHistory creates a history with the given per-key capacity.
func (*History) Add ¶
func (h *History) Add(key string, items ...Attachment)
Add appends attachments to a key and drops its oldest entries over capacity.
type Type ¶
type Type = event.AttachmentType
Type and Attachment remain aliases for compatibility with existing callers.