domain

package
v0.0.0-...-9841d36 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Credentials

type Credentials struct {
	Email  string
	Secret string
	Type   vocabulary.CredentialsType
}

Credentials struct

func (*Credentials) Validate

func (cr *Credentials) Validate() error

type Lock

type Lock struct {
	Reason      string     `json:"reason"`
	CreatedTime *time.Time `json:"created_time"`
	Code        string     `json:"code"`
}

func (*Lock) Scan

func (l *Lock) Scan(src interface{}) error

SQL Valuer/Scan interface implementations

func (Lock) Value

func (l Lock) Value() (driver.Value, error)

SQL Valuer/Scan interface implementations

type LockPayload

type LockPayload interface {
	ToLock() (*Lock, error)
}

LockPayload interface

type LoginPayload

type LoginPayload interface {
	ToCredentials() (*Credentials, error)
}

LoginPayload interface

type Metadata

type Metadata struct{}

func (*Metadata) Scan

func (m *Metadata) Scan(src interface{}) error

SQL Valuer/Scan interface implementations

func (Metadata) Value

func (m Metadata) Value() (driver.Value, error)

SQL Valuer/Scan interface implementations

type Repository

type Repository interface {
	Add(User) error
	GetUserByID(string) (*User, error)
	GetUserByCredentials(Credentials) (*User, error)
	SetPassword(string, string) error
	SetLock(string, *Lock) error
}

type Session

type Session struct {
	ID          string      `json:"id"`
	CreatedTime time.Time   `json:"created_time"`
	ExpiryTime  time.Time   `json:"expiry_time"`
	Payload     SessionInfo `json:"payload"`
}

type SessionInfo

type SessionInfo struct {
	ID    string `json:"id"`
	Email string `json:"email"`
}

type SessionPayload

type SessionPayload interface {
	ToSession() (*SessionInfo, error)
}

type SessionRepository

type SessionRepository interface {
	PutSession(Session) error
	GetSessionByID(ID string) (*Session, error)
	DeleteSession(Session) error
}

type User

type User struct {
	ID           uuid.UUID  `json:"id" db:"id"`
	CreatedTime  *time.Time `json:"created_time" db:"created_time"`
	ModifiedTime *time.Time `json:"modified_time" db:"modified_time"`
	Email        string     `json:"email" db:"email"`
	FullName     string     `json:"full_name" db:"full_name"`
	Password     string     `json:"password" db:"password"`
	Lock         *Lock      `json:"lock" db:"lock"`
	Metadata     Metadata   `json:"metadata" db:"metadata"`
}

func (*User) ToSession

func (u *User) ToSession() (*SessionInfo, error)

type UserPayload

type UserPayload interface {
	ToUser() (*User, error)
}

UserPayload interface

Jump to

Keyboard shortcuts

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