pats

package
v0.2.0-rc.18-linux-arm64 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: Apache-2.0 Imports: 9 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

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type CreateParams

type CreateParams struct {
	UserSlug                      slug.Slug
	Slug                          slug.Slug
	Name                          string
	Description                   *string
	TokenHash                     string
	TokenPrefix                   string
	ExpiresAt                     *time.Time
	CanManagePersonalAccessTokens bool
}

type PersonalAccessToken

type PersonalAccessToken struct {
	ID                            int
	Slug                          slug.Slug
	Name                          string
	Description                   *string
	TokenPrefix                   string
	UserSlug                      slug.Slug
	CanManagePersonalAccessTokens bool
	ExpiresAt                     *time.Time
	RevokedAt                     *time.Time
	LastUsedAt                    *time.Time
	CreatedAt                     time.Time
	UpdatedAt                     time.Time
}

type Principal

type Principal struct {
	TokenSlug                     slug.Slug
	UserSlug                      slug.Slug
	CanManagePersonalAccessTokens bool
}

type Repository

type Repository interface {
	Create(ctx context.Context, tx postgres.DBTX, params CreateParams) (*PersonalAccessToken, error)
	FindBySlug(ctx context.Context, tx postgres.DBTX, userSlug, patSlug slug.Slug) (*PersonalAccessToken, error)
	ListByUser(
		ctx context.Context,
		tx postgres.DBTX,
		userSlug slug.Slug,
		req model.ListRequest,
	) ([]*PersonalAccessToken, error)
	Update(ctx context.Context, tx postgres.DBTX, params UpdateParams) error
	Revoke(ctx context.Context, tx postgres.DBTX, userSlug, patSlug slug.Slug) error
	DeleteRevoked(ctx context.Context, tx postgres.DBTX, userSlug, patSlug slug.Slug) error
	Rotate(ctx context.Context, tx postgres.DBTX, params RotateParams) (*PersonalAccessToken, error)
	FindActivePrincipalByTokenHash(ctx context.Context, tx postgres.DBTX, tokenHash string) (*Principal, error)
	MarkUsed(ctx context.Context, tx postgres.DBTX, userSlug, patSlug slug.Slug) error
}

func NewRepository

func NewRepository() Repository

type RotateParams

type RotateParams struct {
	UserSlug    slug.Slug
	Slug        slug.Slug
	TokenHash   string
	TokenPrefix string
}

type UpdateParams

type UpdateParams struct {
	UserSlug                         slug.Slug
	Slug                             slug.Slug
	Name                             string
	DescriptionSet                   bool
	Description                      *string
	ExpiresAtSet                     bool
	ExpiresAt                        *time.Time
	CanManagePersonalAccessTokensSet bool
	CanManagePersonalAccessTokens    bool
}

Jump to

Keyboard shortcuts

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