types

package
v0.0.0-...-fd1ce1a Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2023 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package types defines various data types related to Tempest's business logic that are used in multiple subsystems.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
}

An account identifies a user account. Right now this is just a phantom type for use with ID.

type AccountID

type AccountID = ID[Account]

AcccountID is an alias for ID[Account]

type Credential

type Credential struct {
	// Type defines the type of credential this is.
	Type CredentialType

	// ScopedID is an identifier for this credential that is unique for
	// all credentials of the same type. For example, if the credential
	// type is email addresses, then this could be the address itself.
	ScopedID string `capnp:"scopedId"`
}

A Credential is something that Tempest can authenticate a user as. Examples (not necessarily all implemented) owner of an email address, SSO account.

type CredentialType

type CredentialType string

A Type of credential

const (
	// Special "dev" accounts; useful for testing but not suitable for
	// real-world use.
	DevCredential CredentialType = "dev"

	// Email login.
	EmailCredential CredentialType = "email"
)

type Grain

type Grain struct{}

Phantom type for use with ID.

type GrainID

type GrainID = ID[Grain]

GrainID is an alias for ID[Grain].

type ID

type ID[T any] string

An ID is a string identifier. The type parameter is a phantom type, to prevent mixing up identifiers for different types of objects.

type Role

type Role string
const (
	RoleVisitor Role = "visitor"
	RoleUser    Role = "user"
	RoleAdmin   Role = "admin"
)

func (Role) Encompasses

func (r Role) Encompasses(other Role) bool

func (Role) IsValid

func (r Role) IsValid() bool

Jump to

Keyboard shortcuts

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