domain

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAPIKeyInvalid = errors.New("invalid api key")
View Source
var ErrAPIKeyNotFound = errors.New("post not found")

Functions

This section is empty.

Types

type APIKey

type APIKey struct {
	CreatedAt time.Time
	UpdatedAt time.Time
	RevokedAt time.Time

	Name     string
	Key      string
	PublicID string
	ID       int32
	Revoked  bool
}

type APIKeyCreate

type APIKeyCreate struct {
	Name string
	Key  string
}

type APIKeyRepository

type APIKeyRepository interface {
	CreateAPIKey(ctx context.Context, apiKey *APIKeyCreate) (*APIKey, error)
	GetAPIKeyByValue(ctx context.Context, apiKey string) (*APIKey, error)
	RevokeAPIKey(ctx context.Context, publicID string) error
}

type APIKeyUsecase

type APIKeyUsecase interface {
	CreateAPIKey(ctx context.Context, name string) (*APIKey, error)
	RevokeAPIKey(ctx context.Context, publicID string) error
	ValidateAPIKey(ctx context.Context, key string) (bool, error)
}

Jump to

Keyboard shortcuts

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