account

package
v0.0.0-...-3df3ca3 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RepoErr = errors.New("unable to handle repo request")

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 {
	Ok string `json:"ok"`
}

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, user User) error
	GetUser(ctx context.Context, id string) (string, error)
}

func NewRepo

func NewRepo(db *sql.DB, 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"`
	Password string `json:"password"`
}

Jump to

Keyboard shortcuts

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