attachment

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attachment

type Attachment interface {
	// CreateAttachment creates a placeholder attachment row with TTL and done=false
	// Width/Height/URL/ContentType are filled on finalize; authorId is enforced during upload
	CreateAttachment(ctx context.Context, id, channelId, authorId, ttlSeconds, fileSize int64, name string) error
	RemoveAttachment(ctx context.Context, id, channelId int64) error
	GetAttachment(ctx context.Context, id, channelId int64) (model.Attachment, error)
	// DoneAttachment finalizes the attachment, clears TTL, and sets metadata and URLs
	DoneAttachment(ctx context.Context, id, channelId int64, contentType, url, previewURL *string, height, width, fileSize *int64, name *string, authorId *int64) error
	SelectAttachmentByIDs(ctx context.Context, ids []int64) ([]model.Attachment, error)
	// UpdateFileSize updates only the filesize column for an attachment
	UpdateFileSize(ctx context.Context, id, channelId int64, fileSize int64) error
	// ListDoneZeroSize returns attachments marked done with missing/zero filesize
	ListDoneZeroSize(ctx context.Context) ([]model.Attachment, error)
	// UpdateName updates attachment name
	UpdateName(ctx context.Context, id, channelId int64, name string) error
}

func New

func New(c *db.CQLCon) Attachment

type Entity

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

func (*Entity) CreateAttachment

func (e *Entity) CreateAttachment(ctx context.Context, id, channelId, authorId, ttlSeconds, fileSize int64, name string) error

func (*Entity) DoneAttachment

func (e *Entity) DoneAttachment(ctx context.Context, id, channelId int64, contentType, url, previewURL *string, height, width, fileSize *int64, name *string, authorId *int64) error

func (*Entity) GetAttachment

func (e *Entity) GetAttachment(ctx context.Context, id, channelId int64) (model.Attachment, error)

func (*Entity) ListDoneZeroSize added in v1.5.0

func (e *Entity) ListDoneZeroSize(ctx context.Context) ([]model.Attachment, error)

ListDoneZeroSize lists attachments with done=true and filesize=0 (maintenance use)

func (*Entity) RemoveAttachment

func (e *Entity) RemoveAttachment(ctx context.Context, id, channelId int64) error

func (*Entity) SelectAttachmentByIDs

func (e *Entity) SelectAttachmentByIDs(ctx context.Context, ids []int64) ([]model.Attachment, error)

func (*Entity) UpdateFileSize added in v1.5.0

func (e *Entity) UpdateFileSize(ctx context.Context, id, channelId int64, fileSize int64) error

UpdateFileSize updates only filesize for a specific attachment

func (*Entity) UpdateName added in v1.5.0

func (e *Entity) UpdateName(ctx context.Context, id, channelId int64, name string) error

UpdateName updates only the name for a specific attachment

Jump to

Keyboard shortcuts

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