account

package
v0.0.0-...-a7b4336 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUserNotFound = errors.New("User not found")
View Source
var RepoErr = errors.New("Email or password empty")

Functions

func NewHTTPServer

func NewHTTPServer(ctx context.Context, endpoints Endpoints) http.Handler

Types

type CreateUserRequest

type CreateUserRequest struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

type CreateUserResponse

type CreateUserResponse struct {
	ID string `json:"id"`
}

type Endpoints

type Endpoints struct {
	CreateUser endpoint.Endpoint
	GetUser    endpoint.Endpoint
}

func MakeEndpoints

func MakeEndpoints(s Service) Endpoints

type GetUserRequest

type GetUserRequest struct {
	ID string `json:"id"`
}

type GetUserResponse

type GetUserResponse struct {
	Email string `json:"email"`
}

type Repository

type Repository interface {
	CreateUser(ctx context.Context, userp User) error
	GetUser(ctx context.Context, id string) (string, error)
}

func NewRepo

func NewRepo(logger log.Logger) Repository

type Service

type Service interface {
	CreateUser(ctx context.Context, email string, password string) (string, error)
	GetUser(ctx context.Context, id string) (string, error)
}

func NewService

func NewService(repo Repository, logger log.Logger) Service

type User

type User struct {
	ID       string `json:"id,omitempty"`
	Email    string `json:"email,omitempty"`
	Password string `json:"password,omitempty"`
}

Jump to

Keyboard shortcuts

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