defaultstore

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package defaultstore implements the SQL-backed default store for the organizations plugin.

Dialect selection happens once in NewDefaultOrganizationStore; all methods are dialect-agnostic and delegate to the unexported querier interface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultOrganizationStore

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

DefaultOrganizationStore implements orgtypes.OrganizationStore using a SQL database.

All dialect logic is confined to the querier: this struct holds only the single chosen querier and delegates every operation to it.

func NewDefaultOrganizationStore

func NewDefaultOrganizationStore(db *sql.DB, dialect plugins.Dialect) (*DefaultOrganizationStore, error)

NewDefaultOrganizationStore creates a DefaultOrganizationStore for the given dialect.

func (*DefaultOrganizationStore) CountOrganizationMembers

func (s *DefaultOrganizationStore) CountOrganizationMembers(ctx context.Context, orgID string) (int, error)

CountOrganizationMembers returns the total number of members in an organization.

func (*DefaultOrganizationStore) CountTeamMembers

func (s *DefaultOrganizationStore) CountTeamMembers(ctx context.Context, teamID string) (int, error)

CountTeamMembers returns the total number of members in a team.

func (*DefaultOrganizationStore) CountTeams

func (s *DefaultOrganizationStore) CountTeams(ctx context.Context, orgID string) (int, error)

CountTeams returns the total number of teams within an organization.

func (*DefaultOrganizationStore) CountUserOrganizations

func (s *DefaultOrganizationStore) CountUserOrganizations(ctx context.Context, userID string) (int, error)

CountUserOrganizations returns the total number of organizations the user belongs to.

func (*DefaultOrganizationStore) CreateMember

func (s *DefaultOrganizationStore) CreateMember(ctx context.Context, id, userID, orgID, role string, createdAt, updatedAt time.Time) error

CreateMember adds a user as a member of an organization with the given role.

func (*DefaultOrganizationStore) CreateOrganization

func (s *DefaultOrganizationStore) CreateOrganization(ctx context.Context, id, name, slug string, createdAt, updatedAt time.Time) error

CreateOrganization creates a new organization with the given attributes.

func (*DefaultOrganizationStore) CreateTeam

func (s *DefaultOrganizationStore) CreateTeam(ctx context.Context, id, orgID, name, description string, createdAt, updatedAt time.Time) error

CreateTeam creates a new team within an organization.

func (*DefaultOrganizationStore) CreateTeamMember

func (s *DefaultOrganizationStore) CreateTeamMember(ctx context.Context, id, teamID, userID, role string, createdAt, updatedAt time.Time) error

CreateTeamMember adds a user as a member of a team with the given role.

func (*DefaultOrganizationStore) DeleteOrganization

func (s *DefaultOrganizationStore) DeleteOrganization(ctx context.Context, id string, updatedAt time.Time) error

DeleteOrganization soft-deletes an organization by ID.

func (*DefaultOrganizationStore) DeleteTeam

func (s *DefaultOrganizationStore) DeleteTeam(ctx context.Context, id string) error

DeleteTeam removes a team by its ID.

func (*DefaultOrganizationStore) GetMember

func (s *DefaultOrganizationStore) GetMember(ctx context.Context, userID, orgID string) (orgtypes.Member, error)

GetMember retrieves the membership record for a user in an organization.

func (*DefaultOrganizationStore) GetOrganization

func (s *DefaultOrganizationStore) GetOrganization(ctx context.Context, id string) (orgtypes.Organization, error)

GetOrganization retrieves an organization by its ID.

func (*DefaultOrganizationStore) GetOrganizationBySlug

func (s *DefaultOrganizationStore) GetOrganizationBySlug(ctx context.Context, slug string) (orgtypes.Organization, error)

GetOrganizationBySlug retrieves an organization by its URL slug.

func (*DefaultOrganizationStore) GetTeam

GetTeam retrieves a team by its ID.

func (*DefaultOrganizationStore) GetTeamMember

func (s *DefaultOrganizationStore) GetTeamMember(ctx context.Context, teamID, userID string) (orgtypes.TeamMember, error)

GetTeamMember retrieves the membership record for a user in a team.

func (*DefaultOrganizationStore) IsOrganizationMember

func (s *DefaultOrganizationStore) IsOrganizationMember(ctx context.Context, userID, orgID string) (bool, error)

IsOrganizationMember reports whether the user is a member of the organization.

func (*DefaultOrganizationStore) IsOwner

func (s *DefaultOrganizationStore) IsOwner(ctx context.Context, userID, orgID string) (bool, error)

IsOwner reports whether the user is the owner of the organization.

func (*DefaultOrganizationStore) IsOwnerOrAdmin

func (s *DefaultOrganizationStore) IsOwnerOrAdmin(ctx context.Context, userID, orgID string) (bool, error)

IsOwnerOrAdmin reports whether the user has the owner or admin role in the organization.

func (*DefaultOrganizationStore) ListOrganizationMembers

func (s *DefaultOrganizationStore) ListOrganizationMembers(ctx context.Context, orgID string, offset, limit int) ([]orgtypes.Member, error)

ListOrganizationMembers returns a paginated list of members in an organization.

func (*DefaultOrganizationStore) ListTeamMembers

func (s *DefaultOrganizationStore) ListTeamMembers(ctx context.Context, teamID string, offset, limit int) ([]orgtypes.TeamMember, error)

ListTeamMembers returns a paginated list of members in a team.

func (*DefaultOrganizationStore) ListTeams

func (s *DefaultOrganizationStore) ListTeams(ctx context.Context, orgID string, offset, limit int) ([]orgtypes.Team, error)

ListTeams returns a paginated list of teams within an organization.

func (*DefaultOrganizationStore) ListUserOrganizations

func (s *DefaultOrganizationStore) ListUserOrganizations(ctx context.Context, userID string, offset, limit int) ([]orgtypes.Organization, error)

ListUserOrganizations returns a paginated list of organizations the user belongs to.

func (*DefaultOrganizationStore) RemoveMember

func (s *DefaultOrganizationStore) RemoveMember(ctx context.Context, userID, orgID string) error

RemoveMember removes a user from an organization.

func (*DefaultOrganizationStore) RemoveTeamMember

func (s *DefaultOrganizationStore) RemoveTeamMember(ctx context.Context, teamID, userID string) error

RemoveTeamMember removes a user from a team.

func (*DefaultOrganizationStore) UpdateMemberRole

func (s *DefaultOrganizationStore) UpdateMemberRole(ctx context.Context, userID, orgID, role string, updatedAt time.Time) error

UpdateMemberRole updates the role of a member within an organization.

func (*DefaultOrganizationStore) UpdateOrganization

func (s *DefaultOrganizationStore) UpdateOrganization(ctx context.Context, id, name, slug string, updatedAt time.Time) error

UpdateOrganization updates the name, slug, and updatedAt timestamp for an organization.

func (*DefaultOrganizationStore) UpdateTeam

func (s *DefaultOrganizationStore) UpdateTeam(ctx context.Context, id, name, description string, updatedAt time.Time) error

UpdateTeam updates the name, description, and updatedAt timestamp for a team.

func (*DefaultOrganizationStore) UpdateTeamMemberRole

func (s *DefaultOrganizationStore) UpdateTeamMemberRole(ctx context.Context, teamID, userID, role string, updatedAt time.Time) error

UpdateTeamMemberRole updates the role of a member within a team.

Jump to

Keyboard shortcuts

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