user

package
v0.0.0-...-d26b62e Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromMessage

func FromMessage(message *protos.User) *models.User

func ToMessage

func ToMessage(user *models.User) *protos.User

Types

type IUser

type IUser interface {
	//GetUserById returns the user with the given id if found
	GetUserById(id string) (*models.User, error)
	//GetUserById returns the user with the given username or email if found
	GetUserByUsernameOrEmail(usernameOrEmail string) (*models.User, error)
	//SaveUser saves the new user to the user service
	SaveUser(user *models.User) error
}

IUser is responsible to communicate with the user service

type User

type User struct {
	Client protos.UserServiceClient
	// contains filtered or unexported fields
}

User communicates with the user services

func NewUser

func NewUser() (*User, error)

NewUser creates a new user service

func (*User) Close

func (u *User) Close()

func (*User) GetUserById

func (service *User) GetUserById(id string) (*models.User, error)

GetUserById finds the user with the given id via the user service

func (*User) GetUserByUsernameOrEmail

func (service *User) GetUserByUsernameOrEmail(usernameOrEmail string) (*models.User, error)

GetUserByUsernameOrEmail checks whether the input is a email or a username and uses the functions for either one of them

func (*User) SaveUser

func (service *User) SaveUser(user *models.User) error

SaveUser saves the user to the user service

Jump to

Keyboard shortcuts

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