processrepo

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

New creates a new process repository.

Types

type Repository

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

Repository implements the process repository using PostgreSQL.

func (*Repository) CountTemplatesByProcess

func (r *Repository) CountTemplatesByProcess(ctx context.Context, tenantID, processCode string) (int, error)

CountTemplatesByProcess returns the number of templates using this process code. Scoped to tenant via workspace join since process is a VARCHAR column on templates.

func (*Repository) Create

func (r *Repository) Create(ctx context.Context, process *entity.Process) (string, error)

Create creates a new process.

func (*Repository) Delete

func (r *Repository) Delete(ctx context.Context, id string) error

Delete deletes a process.

func (*Repository) ExistsByCode

func (r *Repository) ExistsByCode(ctx context.Context, tenantID, code string) (bool, error)

ExistsByCode checks if a process with the given code exists in the tenant.

func (*Repository) ExistsByCodeExcluding

func (r *Repository) ExistsByCodeExcluding(ctx context.Context, tenantID, code, excludeID string) (bool, error)

ExistsByCodeExcluding checks excluding a specific process ID.

func (*Repository) FindByCode

func (r *Repository) FindByCode(ctx context.Context, tenantID, code string) (*entity.Process, error)

FindByCode finds a process by code within a tenant.

func (*Repository) FindByCodeWithGlobalFallback

func (r *Repository) FindByCodeWithGlobalFallback(ctx context.Context, tenantID, code string) (*entity.Process, error)

FindByCodeWithGlobalFallback finds a process by code, checking tenant first then SYS tenant.

func (*Repository) FindByID

func (r *Repository) FindByID(ctx context.Context, id string) (*entity.Process, error)

FindByID finds a process by ID.

func (*Repository) FindByTenant

func (r *Repository) FindByTenant(ctx context.Context, tenantID string, filters port.ProcessFilters) ([]*entity.Process, int64, error)

FindByTenant lists all processes for a tenant with pagination.

func (*Repository) FindByTenantWithGlobalFallback

func (r *Repository) FindByTenantWithGlobalFallback(ctx context.Context, tenantID string, filters port.ProcessFilters) ([]*entity.Process, int64, error)

FindByTenantWithGlobalFallback lists processes including global (SYS tenant) processes. Tenant's own processes take priority over global processes with the same code.

func (*Repository) FindByTenantWithTemplateCount

func (r *Repository) FindByTenantWithTemplateCount(ctx context.Context, tenantID string, filters port.ProcessFilters) ([]*entity.ProcessListItem, int64, error)

FindByTenantWithTemplateCount lists processes with template usage count.

func (*Repository) FindByTenantWithTemplateCountAndGlobal

func (r *Repository) FindByTenantWithTemplateCountAndGlobal(ctx context.Context, tenantID string, filters port.ProcessFilters) ([]*entity.ProcessListItem, int64, error)

FindByTenantWithTemplateCountAndGlobal lists processes with template count, including global processes.

func (*Repository) FindTemplatesByProcess

func (r *Repository) FindTemplatesByProcess(ctx context.Context, tenantID, processCode string) ([]*entity.ProcessTemplateInfo, error)

FindTemplatesByProcess returns templates assigned to this process code. Scoped to tenant via workspace join since process is a VARCHAR column on templates.

func (*Repository) IsSysTenant

func (r *Repository) IsSysTenant(ctx context.Context, tenantID string) (bool, error)

IsSysTenant checks if the given tenant is the system tenant.

func (*Repository) Update

func (r *Repository) Update(ctx context.Context, process *entity.Process) error

Update updates a process (name and description only, code and process_type are immutable).

Jump to

Keyboard shortcuts

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