team

package
v0.10.3 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: Apache-2.0 Imports: 8 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package team is the domain layer for the Team entity — the outer tenancy scope that owns Projects. A Team has no member list: membership is expressed as a role binding at team scope, so there is exactly one place that grants access.

Authorization is app/authz's concern; this package validates shape only.

Index

Constants

View Source
const DefaultPeriod = "month"

DefaultPeriod is the calendar period a Budget that names none is measured over.

Variables

This section is empty.

Functions

This section is empty.

Types

type Budget

type Budget struct {
	Amount   string `json:"amount"             yaml:"amount"             validate:"required,budgetamount"`
	Period   string `json:"period,omitempty"   yaml:"period,omitempty"   validate:"omitempty,oneof=month week day"`
	OnExceed string `json:"onExceed,omitempty" yaml:"onExceed,omitempty" validate:"omitempty,oneof=block warn"`
}

Budget is a recurring spend cap in USD. Amount is a decimal string so money never round-trips through a float.

func (*Budget) Default

func (b *Budget) Default()

Default fills the fields a wire form may omit, so a stored row and the manifest that declared it converge instead of differing by an empty period forever. Nil receiver is a no-op.

type Spec

type Spec struct {
	// Enabled defaults to true when nil.
	Enabled *bool `json:"enabled,omitempty" yaml:"enabled,omitempty"`

	// Budget caps spend across every Project in the team.
	Budget *Budget `json:"budget,omitempty" yaml:"budget,omitempty" validate:"omitempty"`
}

Spec carries the enabled flag and the team-wide spend cap.

type Store

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

func NewStore

func NewStore(q *gen.Queries) *Store

func (*Store) Delete

func (s *Store) Delete(ctx context.Context, id string) error

Delete relies on the FK to cascade the team's projects.

func (*Store) Get

func (s *Store) Get(ctx context.Context, id string) (*Team, error)

Get returns (nil, nil) when no row has id.

func (*Store) List

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

func (*Store) Upsert

func (s *Store) Upsert(ctx context.Context, t *Team) error

Upsert expects Meta.ID set by the caller.

type Team

type Team struct {
	Meta meta.Metadata `json:"metadata" yaml:"metadata"`
	Spec Spec          `json:"spec"     yaml:"spec"`
}

Team is the outer tenancy scope. Owner is the user who created it (user kind) or system for seeded rows.

func (*Team) IsEnabled

func (t *Team) IsEnabled() bool

IsEnabled returns true when Enabled is unset or explicitly true.

func (*Team) Validate

func (t *Team) Validate() error

Validate runs intra-row rules via the shared meta.Validator and enforces:

  • Owner.Kind is user or system.

Jump to

Keyboard shortcuts

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