teams

Function Name Operation Type Description Arguments Returns
CreateTeam Create (Insert) Inserts a new team into the teams table. Includes optional manager_id. ctx context.Context,arg CreateTeamParams { TeamName string; ManagerID pgtype.Int8 } Team, error
CountTeams Read (Select) Returns the total number of teams in the database. ctx context.Context int64, error
GetTeam Read (Select) Retrieves a single team by its unique ID. ctx context.Context,id int64 Team, error
GetTeamByManagerID Read (Select) Fetches a team by the manager’s user ID. ctx context.Context,managerID pgtype.Int8 Team, error
ListTeams Read (Select) Retrieves a paginated list of all teams ordered by ID. ctx context.Context,arg ListTeamsParams { Limit int32; Offset int32 } []Team, error
ListTeamsWithManagers Read (Join) Lists all teams along with their manager’s name and email (via LEFT JOIN). ctx context.Context,arg ListTeamsWithManagersParams { Limit int32; Offset int32 } []ListTeamsWithManagersRow, error
ListUnmanagedTeams Read (Select) Retrieves all teams that do not currently have a manager assigned. ctx context.Context []Team, error
UpdateTeam Update Updates the team name and/or manager ID using COALESCE. ctx context.Context,arg UpdateTeamParams { ID int64; TeamName pgtype.Text; ManagerID pgtype.Int8 } Team, error
SetTeamManager Update Sets the manager for a specific team (only updates manager ID). ctx context.Context,arg SetTeamManagerParams { ID int64; ManagerID pgtype.Int8 } Team, error
DeleteTeam Delete Deletes a team from the database by its ID. ctx context.Context,id int64 error