members

package
v0.0.0-...-5106b98 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound      = xerror.NotFound(xerror.Member)
	ErrAlreadyMember = xerror.AlreadyExists(xerror.Member)
)

Functions

This section is empty.

Types

type CreateParams

type CreateParams struct {
	OrganizationSlug slug.Slug
	UserSlug         slug.Slug
	RoleSlug         slug.Slug
}

type Member

type Member struct {
	UserSlug  slug.Slug
	UserEmail string
	RoleSlug  slug.Slug
	CreatedAt time.Time
	UpdatedAt time.Time
}

type Repository

type Repository interface {
	Create(ctx context.Context, tx postgres.DBTX, params *CreateParams) (*Member, error)
	Find(ctx context.Context, tx postgres.DBTX, orgSlug, userSlug slug.Slug) (*Member, error)
	FindByEmail(ctx context.Context, tx postgres.DBTX, orgSlug slug.Slug, email string) (*Member, error)
	CountByOrganization(ctx context.Context, tx postgres.DBTX, orgSlug slug.Slug) (int64, error)
	CountByRole(
		ctx context.Context,
		tx postgres.DBTX,
		orgSlug slug.Slug,
		roleSlug slug.Slug,
	) (int64, error)
	ListByOrganization(
		ctx context.Context,
		tx postgres.DBTX,
		orgSlug slug.Slug,
		req model.ListRequest,
	) ([]*Member, error)
	Update(ctx context.Context, tx postgres.DBTX, orgSlug, userSlug, roleSlug slug.Slug) error
	Remove(ctx context.Context, tx postgres.DBTX, orgSlug, userSlug slug.Slug) error
}

func NewRepository

func NewRepository() Repository

func NewRepositoryWithLogging

func NewRepositoryWithLogging(base Repository, logger *slog.Logger) Repository

NewRepositoryWithLogging wraps base with method completion logging.

type RepositoryWithLogging

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

RepositoryWithLogging implements Repository with method completion logging.

func (RepositoryWithLogging) CountByOrganization

func (_d RepositoryWithLogging) CountByOrganization(ctx context.Context, tx postgres.DBTX, orgSlug slug.Slug) (i1 int64, err error)

CountByOrganization implements Repository.

func (RepositoryWithLogging) CountByRole

func (_d RepositoryWithLogging) CountByRole(ctx context.Context, tx postgres.DBTX, orgSlug slug.Slug, roleSlug slug.Slug) (i1 int64, err error)

CountByRole implements Repository.

func (RepositoryWithLogging) Create

func (_d RepositoryWithLogging) Create(ctx context.Context, tx postgres.DBTX, params *CreateParams) (mp1 *Member, err error)

Create implements Repository.

func (RepositoryWithLogging) Find

func (_d RepositoryWithLogging) Find(ctx context.Context, tx postgres.DBTX, orgSlug slug.Slug, userSlug slug.Slug) (mp1 *Member, err error)

Find implements Repository.

func (RepositoryWithLogging) FindByEmail

func (_d RepositoryWithLogging) FindByEmail(ctx context.Context, tx postgres.DBTX, orgSlug slug.Slug, email string) (mp1 *Member, err error)

FindByEmail implements Repository.

func (RepositoryWithLogging) ListByOrganization

func (_d RepositoryWithLogging) ListByOrganization(ctx context.Context, tx postgres.DBTX, orgSlug slug.Slug, req model.ListRequest) (mpa1 []*Member, err error)

ListByOrganization implements Repository.

func (RepositoryWithLogging) Remove

func (_d RepositoryWithLogging) Remove(ctx context.Context, tx postgres.DBTX, orgSlug slug.Slug, userSlug slug.Slug) (err error)

Remove implements Repository.

func (RepositoryWithLogging) Update

func (_d RepositoryWithLogging) Update(ctx context.Context, tx postgres.DBTX, orgSlug slug.Slug, userSlug slug.Slug, roleSlug slug.Slug) (err error)

Update implements Repository.

Jump to

Keyboard shortcuts

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