store

package
v2.24.2 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotSupported    = errors.New("not supported")
	ErrNotFound        = errors.New("not found")
	ErrNotModified     = errors.New("not modified")
	ErrInvalidArgument = errors.New("invalid argument")
	ErrPartialDelete   = errors.New("some errors occurred while deleting")
)

Functions

This section is empty.

Types

type Iterator

type Iterator[T any] interface {
	Next(ctx context.Context, v *T) bool
	Err() error
}

type MongoIterator

type MongoIterator[T any] struct {
	Cursor *mongo.Cursor
}

func (*MongoIterator[T]) Err

func (i *MongoIterator[T]) Err() error

func (*MongoIterator[T]) Next

func (i *MongoIterator[T]) Next(ctx context.Context, s *T) bool

type Process

type Process[T any] func(v *T) error

type ProcessTokens

type ProcessTokens = Process[pb.Token]

type Store

type Store interface {
	// CreateToken creates a new token. If the token already exists, it will throw an error.
	CreateToken(ctx context.Context, owner string, token *pb.Token) (*pb.Token, error)
	// GetTokens loads tokens from the database.
	GetTokens(ctx context.Context, owner string, query *pb.GetTokensRequest, p ProcessTokens) error

	// DeleteTokens deletes blacklisted expired tokens from the database.
	DeleteBlacklistedTokens(ctx context.Context, now time.Time) error

	// Delete or set tokens as blacklisted
	DeleteTokens(ctx context.Context, owner string, req *pb.DeleteTokensRequest) (*pb.DeleteTokensResponse, error)

	Close(ctx context.Context) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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