service

package
v0.0.0-...-d5421df Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAccountAlreadyExists = errors.New("account already exists")
	ErrAccountNotFound      = errors.New("account not found")
	ErrShareCodeInvalid     = errors.New("share code is invalid")
)

Functions

This section is empty.

Types

type Account

type Account interface {
	GetUsername() string
	GetCreatedAt() time.Time
	Verify(password []byte) bool
}

type Accounts

type Accounts interface {
	Find(ctx context.Context, username string) (Account, error)
	Create(ctx context.Context, username string, password []byte) (Account, error)

	HealthCheck() HealthCheck
}

type Health

type Health interface {
	Check(ctx context.Context) HealthAggregation
}

func HealthAggregator

func HealthAggregator(healthChecks []HealthCheck) Health

type HealthAggregation

type HealthAggregation struct {
	Health     HealthResult                 `yaml:"health"`
	Components []HealthAggregationComponent `yaml:"components"`
}

type HealthAggregationComponent

type HealthAggregationComponent struct {
	Name   string       `yaml:"name"`
	Health HealthResult `yaml:"health"`
}

type HealthCheck

type HealthCheck func(ctx context.Context) (string, bool)

type HealthResult

type HealthResult string
const (
	HealthUp   HealthResult = "Up"
	HealthDown HealthResult = "Down"
)

func HealthResultFromBool

func HealthResultFromBool(healthUp bool) HealthResult

func (HealthResult) ToHTTPStatusCode

func (r HealthResult) ToHTTPStatusCode() int

type UsernameGenerationStrategy

type UsernameGenerationStrategy string
const UUIDUsernameGeneration UsernameGenerationStrategy = "uuid"

type UsernameGenerator

type UsernameGenerator interface {
	Generate() (string, error)
}

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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