project

package
v0.1.17 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrProjectAlreadyExists = errors.New("project already exists")
View Source
var ErrProjectNotFound = errors.New("project not found")

Functions

This section is empty.

Types

type CreateProjectRequest

type CreateProjectRequest struct {
	Name       string  `json:"name" validate:"required,min=1,max=255"`
	DefaultKey *string `json:"default_key,omitempty"`
}

CreateProjectRequest captures payload for creating a project

type Project

type Project struct {
	ID         uuid.UUID `json:"id" db:"id"`
	Name       string    `json:"name" db:"name"`
	DefaultKey *string   `json:"default_key,omitempty" db:"default_key"`
	CreatedAt  time.Time `json:"created_at" db:"created_at"`
	UpdatedAt  time.Time `json:"updated_at" db:"updated_at"`
}

Project represents a workspace or collection an agent can belong to

type ProjectRepo

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

ProjectRepo handles database operations for projects

func NewProjectRepo

func NewProjectRepo(db *sqlx.DB) *ProjectRepo

NewProjectRepo creates a new project repository

func (*ProjectRepo) Create

func (r *ProjectRepo) Create(ctx context.Context, req *CreateProjectRequest) (*Project, error)

Create creates a new project

func (*ProjectRepo) Delete

func (r *ProjectRepo) Delete(ctx context.Context, id uuid.UUID) error

Delete removes a project by ID

func (*ProjectRepo) GetByID

func (r *ProjectRepo) GetByID(ctx context.Context, id uuid.UUID) (*Project, error)

GetByID retrieves a project by ID

func (*ProjectRepo) GetByName

func (r *ProjectRepo) GetByName(ctx context.Context, name string) (*Project, error)

GetByName retrieves a project by name

func (*ProjectRepo) List

func (r *ProjectRepo) List(ctx context.Context) ([]*Project, error)

List retrieves all projects ordered by creation date

func (*ProjectRepo) Update

func (r *ProjectRepo) Update(ctx context.Context, id uuid.UUID, req *UpdateProjectRequest) (*Project, error)

Update updates project fields

type ProjectService

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

ProjectService contains business logic for projects

func NewProjectService

func NewProjectService(repo *ProjectRepo) *ProjectService

NewProjectService constructs a new ProjectService

func (*ProjectService) Create

Create registers a new project ensuring name uniqueness

func (*ProjectService) Delete

func (s *ProjectService) Delete(ctx context.Context, id uuid.UUID) error

Delete removes a project by ID

func (*ProjectService) GetByID

func (s *ProjectService) GetByID(ctx context.Context, id uuid.UUID) (*Project, error)

GetByID fetches a project by its identifier

func (*ProjectService) GetByName

func (s *ProjectService) GetByName(ctx context.Context, name string) (*Project, error)

GetByName fetches a project by its name

func (*ProjectService) List

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

List returns all projects ordered by creation time

func (*ProjectService) Update

Update modifies mutable project fields

type UpdateProjectRequest

type UpdateProjectRequest struct {
	Name       *string `json:"name,omitempty" validate:"omitempty,min=1,max=255"`
	DefaultKey *string `json:"default_key,omitempty"`
}

UpdateProjectRequest captures payload for updating a project

Jump to

Keyboard shortcuts

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