project

package
v0.36.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package project manages projects and their contract-bound eras.

Index

Constants

View Source
const (
	StatusActive    = "active"
	StatusArchived  = "archived"
	EraStatusActive = "active"
	EraStatusClosed = "closed"
)

Variables

View Source
var (
	ErrContractNotFound    = errors.New("contract version is not installed")
	ErrProjectNotFound     = errors.New("project not found")
	ErrProjectKeyConflict  = errors.New("project key is already in use")
	ErrProjectNameConflict = errors.New("project name is already in use")
	ErrProjectArchived     = errors.New("project is already archived")
)

Functions

This section is empty.

Types

type CreateParams

type CreateParams struct {
	Key             string
	Name            string
	ContractID      string
	ContractVersion int
	Actor           string
}

CreateParams defines a project's immutable identity and initial contract.

type Era

type Era struct {
	ID              int64
	Number          int
	ContractID      string
	ContractVersion int
	Status          string
	OpenedAt        time.Time
	ClosedAt        *time.Time
}

Era is one period of a project governed by one contract version.

type Project

type Project struct {
	ID         int64
	Key        string
	Name       string
	Status     string
	Revision   int
	CreatedAt  time.Time
	ArchivedAt *time.Time
	ActiveEra  Era
}

Project is the current project snapshot with its active era.

type Store

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

Store owns project persistence in the shared Pitcrew database.

func Open

func Open(ctx context.Context, path string) (*Store, error)

Open opens project persistence and applies technical schema migrations.

func OpenReadOnly added in v0.32.0

func OpenReadOnly(ctx context.Context, path string) (*Store, error)

OpenReadOnly opens an existing project store without applying migrations. Read-only callers use this to validate an association at request time.

func (*Store) Archive

func (s *Store) Archive(ctx context.Context, reference string) (Project, error)

Archive marks a project as archived without deleting it or closing its era.

func (*Store) ArchiveAs

func (s *Store) ArchiveAs(ctx context.Context, reference, actorID string) (Project, error)

ArchiveAs marks a project as archived and attributes the mutation to actorID.

func (*Store) Close

func (s *Store) Close() error

Close releases the database connection.

func (*Store) Create

func (s *Store) Create(ctx context.Context, params CreateParams) (Project, error)

Create atomically creates a project, its first active era, and an audit event.

func (*Store) Get

func (s *Store) Get(ctx context.Context, reference string) (Project, error)

Get returns a project selected by its name or key.

func (*Store) List

func (s *Store) List(ctx context.Context) ([]Project, error)

List returns all projects ordered by name.

Jump to

Keyboard shortcuts

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