account

package
v0.0.0-...-f597de0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 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 Account

type Account struct {
	Username string
	Password string
}

An Account on the sample application.

type DbRepository

type DbRepository struct {
	Db *sql.DB
}

A DbRepository is a Repository to operate an Account encapsulating a Database connection.

func (DbRepository) Create

func (r DbRepository) Create(a *Account) error

Create an Account.

func (DbRepository) FindByUsername

func (r DbRepository) FindByUsername(username string) (*Account, error)

FindByUsername an Account.

type Repository

type Repository interface {
	Create(a *Account) error
	FindByUsername(username string) (*Account, error)
}

A Repository interface for operating an Account.

type Service

type Service struct {
	AccountRepository Repository
	Encrypter         authn.Encrypter
}

Service is the User Service.

func (Service) Authenticate

func (s Service) Authenticate(username string, password string) (*Account, error)

Authenticate a user based on his username and passoword.

Jump to

Keyboard shortcuts

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