repositories

package
v1.51.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrOAuthClientConflict = errors.New("oauth client was modified by another request")

ErrOAuthClientConflict is returned when an optimistic update does not match the stored updated_at value.

Functions

This section is empty.

Types

type AuthorizationCodeRepository

type AuthorizationCodeRepository interface {
	Create(ctx context.Context, code *types.OAuthAuthorizationCode) (*types.OAuthAuthorizationCode, error)
	GetByCodeHash(ctx context.Context, codeHash string) (*types.OAuthAuthorizationCode, error)
	Consume(ctx context.Context, codeHash string, clientID string, consumedAt time.Time) (*types.OAuthAuthorizationCode, error)
	DeleteExpired(ctx context.Context, before time.Time) (int64, error)
	WithTx(tx bun.IDB) AuthorizationCodeRepository
}

func NewBunAuthorizationCodeRepository

func NewBunAuthorizationCodeRepository(db bun.IDB) AuthorizationCodeRepository

type BunAuthorizationCodeRepository

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

func (*BunAuthorizationCodeRepository) Consume

func (r *BunAuthorizationCodeRepository) Consume(ctx context.Context, codeHash string, clientID string, consumedAt time.Time) (*types.OAuthAuthorizationCode, error)

func (*BunAuthorizationCodeRepository) Create

func (*BunAuthorizationCodeRepository) DeleteExpired

func (r *BunAuthorizationCodeRepository) DeleteExpired(ctx context.Context, before time.Time) (int64, error)

func (*BunAuthorizationCodeRepository) GetByCodeHash

func (*BunAuthorizationCodeRepository) WithTx

type BunConsentRepository

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

func (*BunConsentRepository) Create

func (*BunConsentRepository) GetActiveByUserAndClient

func (r *BunConsentRepository) GetActiveByUserAndClient(ctx context.Context, userID string, clientID string) (*types.OAuthConsent, error)

func (*BunConsentRepository) GetByID

func (*BunConsentRepository) ListActiveByUser

func (r *BunConsentRepository) ListActiveByUser(ctx context.Context, userID string) ([]*types.OAuthConsent, error)

func (*BunConsentRepository) Revoke

func (r *BunConsentRepository) Revoke(ctx context.Context, id string, revokedAt time.Time) (bool, error)

func (*BunConsentRepository) RevokeByClient

func (r *BunConsentRepository) RevokeByClient(ctx context.Context, clientID string, revokedAt time.Time) (int64, error)

func (*BunConsentRepository) RevokeByUserAndClient

func (r *BunConsentRepository) RevokeByUserAndClient(ctx context.Context, userID string, clientID string, revokedAt time.Time) (int64, error)

func (*BunConsentRepository) WithTx

type BunConsentRequestRepository

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

func (*BunConsentRequestRepository) Consume

func (r *BunConsentRequestRepository) Consume(ctx context.Context, requestHash string, consumedAt time.Time) (*types.OAuthConsentRequest, error)

func (*BunConsentRequestRepository) Create

func (*BunConsentRequestRepository) DeleteExpired

func (r *BunConsentRequestRepository) DeleteExpired(ctx context.Context, before time.Time) (int64, error)

func (*BunConsentRequestRepository) GetByRequestHash

func (r *BunConsentRequestRepository) GetByRequestHash(ctx context.Context, requestHash string) (*types.OAuthConsentRequest, error)

func (*BunConsentRequestRepository) WithTx

type BunFlowStateRepository

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

func (*BunFlowStateRepository) Consume

func (r *BunFlowStateRepository) Consume(ctx context.Context, stateHash string, provider string, purpose string, consumedAt time.Time) (*types.OAuthFlowState, error)

func (*BunFlowStateRepository) Create

func (*BunFlowStateRepository) DeleteExpired

func (r *BunFlowStateRepository) DeleteExpired(ctx context.Context, before time.Time) (int64, error)

func (*BunFlowStateRepository) GetByStateHash

func (r *BunFlowStateRepository) GetByStateHash(ctx context.Context, stateHash string) (*types.OAuthFlowState, error)

func (*BunFlowStateRepository) WithTx

type BunLoginTransactionRepository

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

func (*BunLoginTransactionRepository) Consume

func (r *BunLoginTransactionRepository) Consume(ctx context.Context, transactionHash string, consumedAt time.Time) (*types.OAuthLoginTransaction, error)

func (*BunLoginTransactionRepository) Create

func (*BunLoginTransactionRepository) DeleteExpired

func (r *BunLoginTransactionRepository) DeleteExpired(ctx context.Context, before time.Time) (int64, error)

func (*BunLoginTransactionRepository) GetByTransactionHash

func (r *BunLoginTransactionRepository) GetByTransactionHash(ctx context.Context, transactionHash string) (*types.OAuthLoginTransaction, error)

func (*BunLoginTransactionRepository) MarkCompleted

func (r *BunLoginTransactionRepository) MarkCompleted(ctx context.Context, transactionHash string, completedAt time.Time) (bool, error)

func (*BunLoginTransactionRepository) WithTx

type BunOAuthClientRepository

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

func (*BunOAuthClientRepository) Create

func (*BunOAuthClientRepository) GetByClientID

func (r *BunOAuthClientRepository) GetByClientID(ctx context.Context, clientID string) (*types.OAuthClient, error)

func (*BunOAuthClientRepository) GetByClientIDIncludingDeleted

func (r *BunOAuthClientRepository) GetByClientIDIncludingDeleted(ctx context.Context, clientID string) (*types.OAuthClient, error)

func (*BunOAuthClientRepository) GetByID

func (*BunOAuthClientRepository) GetByIDIncludingDeleted

func (r *BunOAuthClientRepository) GetByIDIncludingDeleted(ctx context.Context, id string) (*types.OAuthClient, error)

func (*BunOAuthClientRepository) List

func (*BunOAuthClientRepository) SoftDelete

func (r *BunOAuthClientRepository) SoftDelete(ctx context.Context, id string, deletedAt time.Time) (bool, error)

func (*BunOAuthClientRepository) Update

func (r *BunOAuthClientRepository) Update(ctx context.Context, client *types.OAuthClient, expectedUpdatedAt *time.Time) (*types.OAuthClient, error)

func (*BunOAuthClientRepository) WithTx

type ConsentRepository

type ConsentRepository interface {
	Create(ctx context.Context, consent *types.OAuthConsent) (*types.OAuthConsent, error)
	GetByID(ctx context.Context, id string) (*types.OAuthConsent, error)
	GetActiveByUserAndClient(ctx context.Context, userID string, clientID string) (*types.OAuthConsent, error)
	ListActiveByUser(ctx context.Context, userID string) ([]*types.OAuthConsent, error)
	Revoke(ctx context.Context, id string, revokedAt time.Time) (bool, error)
	RevokeByUserAndClient(ctx context.Context, userID string, clientID string, revokedAt time.Time) (int64, error)
	RevokeByClient(ctx context.Context, clientID string, revokedAt time.Time) (int64, error)
	WithTx(tx bun.IDB) ConsentRepository
}

func NewBunConsentRepository

func NewBunConsentRepository(db bun.IDB) ConsentRepository

type ConsentRequestRepository

type ConsentRequestRepository interface {
	Create(ctx context.Context, request *types.OAuthConsentRequest) (*types.OAuthConsentRequest, error)
	GetByRequestHash(ctx context.Context, requestHash string) (*types.OAuthConsentRequest, error)
	Consume(ctx context.Context, requestHash string, consumedAt time.Time) (*types.OAuthConsentRequest, error)
	DeleteExpired(ctx context.Context, before time.Time) (int64, error)
	WithTx(tx bun.IDB) ConsentRequestRepository
}

func NewBunConsentRequestRepository

func NewBunConsentRequestRepository(db bun.IDB) ConsentRequestRepository

type FlowStateRepository

type FlowStateRepository interface {
	Create(ctx context.Context, state *types.OAuthFlowState) (*types.OAuthFlowState, error)
	GetByStateHash(ctx context.Context, stateHash string) (*types.OAuthFlowState, error)
	Consume(ctx context.Context, stateHash string, provider string, purpose string, consumedAt time.Time) (*types.OAuthFlowState, error)
	DeleteExpired(ctx context.Context, before time.Time) (int64, error)
	WithTx(tx bun.IDB) FlowStateRepository
}

func NewBunFlowStateRepository

func NewBunFlowStateRepository(db bun.IDB) FlowStateRepository

type LoginTransactionRepository

type LoginTransactionRepository interface {
	Create(ctx context.Context, transaction *types.OAuthLoginTransaction) (*types.OAuthLoginTransaction, error)
	GetByTransactionHash(ctx context.Context, transactionHash string) (*types.OAuthLoginTransaction, error)
	MarkCompleted(ctx context.Context, transactionHash string, completedAt time.Time) (bool, error)
	Consume(ctx context.Context, transactionHash string, consumedAt time.Time) (*types.OAuthLoginTransaction, error)
	DeleteExpired(ctx context.Context, before time.Time) (int64, error)
	WithTx(tx bun.IDB) LoginTransactionRepository
}

func NewBunLoginTransactionRepository

func NewBunLoginTransactionRepository(db bun.IDB) LoginTransactionRepository

type OAuthClientCursor

type OAuthClientCursor struct {
	CreatedAt time.Time
	ID        string
}

OAuthClientCursor is the keyset position for client list pagination.

type OAuthClientListFilter

type OAuthClientListFilter struct {
	OwnerType      string
	OwnerID        string
	OrganizationID *string
	IncludeDeleted bool
	Limit          int
	Cursor         *OAuthClientCursor
}

OAuthClientListFilter filters and paginates client listings.

type OAuthClientRepository

type OAuthClientRepository interface {
	Create(ctx context.Context, client *types.OAuthClient) (*types.OAuthClient, error)
	GetByID(ctx context.Context, id string) (*types.OAuthClient, error)
	GetByIDIncludingDeleted(ctx context.Context, id string) (*types.OAuthClient, error)
	GetByClientID(ctx context.Context, clientID string) (*types.OAuthClient, error)
	GetByClientIDIncludingDeleted(ctx context.Context, clientID string) (*types.OAuthClient, error)
	List(ctx context.Context, filter OAuthClientListFilter) ([]*types.OAuthClient, error)
	Update(ctx context.Context, client *types.OAuthClient, expectedUpdatedAt *time.Time) (*types.OAuthClient, error)
	SoftDelete(ctx context.Context, id string, deletedAt time.Time) (bool, error)
	WithTx(tx bun.IDB) OAuthClientRepository
}

func NewBunOAuthClientRepository

func NewBunOAuthClientRepository(db bun.IDB) OAuthClientRepository

Jump to

Keyboard shortcuts

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