services

package
v0.0.0-...-1011175 Latest Latest
Warning

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

Go to latest
Published: May 24, 2023 License: 0BSD Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Module exports services present

Functions

func NewJWTAuthService

func NewJWTAuthService(env lib.Env, logger lib.Logger) domains.AuthService

NewJWTAuthService creates a new auth service

func NewUserService

func NewUserService(logger lib.Logger, repository repository.UserRepository) domains.UserService

NewUserService creates a new userservice

Types

type JWTAuthService

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

JWTAuthService service relating to authorization

func (JWTAuthService) Authorize

func (s JWTAuthService) Authorize(tokenString string) (bool, error)

Authorize authorizes the generated token

func (JWTAuthService) CreateToken

func (s JWTAuthService) CreateToken(user models.User) string

CreateToken creates jwt auth token

type UserService

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

UserService service layer

func (UserService) CreateUser

func (s UserService) CreateUser(user models.User) error

CreateUser call to create the user

func (UserService) DeleteUser

func (s UserService) DeleteUser(id uint) error

DeleteUser deletes the user

func (UserService) GetAllUser

func (s UserService) GetAllUser() (users []models.User, err error)

GetAllUser get all the user

func (UserService) GetOneUser

func (s UserService) GetOneUser(id uint) (user models.User, err error)

GetOneUser gets one user

func (UserService) UpdateUser

func (s UserService) UpdateUser(user models.User) error

UpdateUser updates the user

func (UserService) WithTrx

func (s UserService) WithTrx(trxHandle *gorm.DB) domains.UserService

WithTrx delegates transaction to repository database

Jump to

Keyboard shortcuts

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