userserver

package
v0.0.0-...-bbcb6ed Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2020 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type User

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

User represent a system account

func (*User) SetPassword

func (u *User) SetPassword(password string)

SetPassword sets and hashes the given password

type UserMemoryRepository

type UserMemoryRepository struct {
	// contains filtered or unexported fields
}

UserMemoryRepository is an in memory repository

func NewUserMemoryRepository

func NewUserMemoryRepository() *UserMemoryRepository

NewUserMemoryRepository instantiates a new in memory database

func (*UserMemoryRepository) GetUserByEmail

func (repo *UserMemoryRepository) GetUserByEmail(email string) *User

GetUserByEmail ...

func (*UserMemoryRepository) GetUserByID

func (repo *UserMemoryRepository) GetUserByID(id int64) *User

GetUserByID ...

func (*UserMemoryRepository) InsertUser

func (repo *UserMemoryRepository) InsertUser(user User) (*User, error)

InsertUser ...

type UserRepository

type UserRepository interface {
	GetUserByEmail(email string) *User
	GetUserByID(id int64) *User
	InsertUser(user User) (*User, error)
}

UserRepository is the Data Abstraction Layer for the User Server

type UserServer

type UserServer struct {
	Router *mux.Router
	// contains filtered or unexported fields
}

UserServer ...

func NewServer

func NewServer(addr, privKeyPath string) *UserServer

NewServer creates a new server

func NewServerless

func NewServerless(key *rsa.PrivateKey) *UserServer

NewServerless creates a UserServer without http server

func (*UserServer) Shutdown

func (us *UserServer) Shutdown()

Shutdown the server

func (*UserServer) StartServer

func (us *UserServer) StartServer() error

StartServer creates and starts a UserServer

Jump to

Keyboard shortcuts

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