attachment

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AttachIn

type AttachIn struct {
	Resource          resource.Ref
	DocumentVersionID uuid.UUID
	CommentID         *uuid.UUID
	WorkflowTaskID    *uuid.UUID
}

AttachIn is the input to Attach.

type Attachment

type Attachment struct {
	ID                uuid.UUID
	Resource          resource.Ref
	DocumentVersionID uuid.UUID
	CommentID         *uuid.UUID
	WorkflowTaskID    *uuid.UUID
	Status            string
	Version           int
	CreatedAt         time.Time
	CreatedBy         uuid.UUID
}

Attachment is a persisted attachment row.

type Service

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

Service manages attachments inside a tenant transaction.

func New

func New(idgen model.IDGen, ob outbox.Writer) *Service

New wires the service. ob may be nil.

func (*Service) Attach

func (s *Service) Attach(ctx context.Context, db database.TenantDB, in AttachIn) (uuid.UUID, error)

Attach inserts a new attachment for a resource. Pre-checks document version existence via SELECT for a clean error rather than relying on the FK violation.

func (*Service) Detach

func (s *Service) Detach(ctx context.Context, db database.TenantDB, id uuid.UUID, expectedVersion int) error

Detach voids an attachment with optimistic locking. Void != delete.

func (*Service) List

func (s *Service) List(ctx context.Context, db database.TenantDB, ref resource.Ref) ([]Attachment, error)

List returns all attachments (active and voided) for the given resource, ordered by created_at ASC.

Jump to

Keyboard shortcuts

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