service

package
v0.0.0-...-14cdc90 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTokenService

func NewTokenService(c *TSConfig) model.TokenService

NewTokenService is a factory function for initializing a UserService with its repository layer dependencies

func NewUserService

func NewUserService(c *USConfig) model.UserService

NewUserService is a factory function for initializing a UserService with its repository layer dependencies

Types

type TSConfig

type TSConfig struct {
	TokenRepository       model.TokenRepository
	PrivKey               *rsa.PrivateKey
	PubKey                *rsa.PublicKey
	RefreshSecret         string
	IDExpirationSecs      int64
	RefreshExpirationSecs int64
}

TSConfig will hold repositories that will eventually be injected into this this service layer

type USConfig

type USConfig struct {
	UserRepository model.UserRepository
}

USConfig will hold repositories that will eventually be injected into this this service layer

type UserService

type UserService struct {
	UserRepository model.UserRepository
}

UserService acts as a struct for injecting an implementation of UserRepository for use in service methods

func (*UserService) Get

func (s *UserService) Get(ctx context.Context, uid uuid.UUID) (*model.User, error)

Get retrieves a user based on their uuid

func (*UserService) Signup

func (s *UserService) Signup(ctx context.Context, user *model.User) error

Signup reaches out to a UserRepository to verify the email address is avaiable and signs up the user if this is the case

Jump to

Keyboard shortcuts

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