user

package
v0.0.0-...-9c1cc18 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler

func Handler(app *fiber.App, collection *mongo.Collection, store *session.Store)

Handler is the handler for the user service.

Types

type Repository

type Repository interface {
	// Create creates a new user.
	Create(user models.User) (models.User, error)

	// GetByEmail gets a user by email.
	GetByEmail(email string) (models.User, error)

	// GetByUsername gets a user by username.
	GetByUsername(username string) (models.User, error)

	// GetByID gets a user by ID.
	GetByID(id string) (models.User, error)
}

func NewRepository

func NewRepository(collection *mongo.Collection) Repository

NewRepository creates a new user repository.

type Service

type Service interface {
	// Register creates a new user.
	Register(user models.User) (models.User, int, error)

	// Login login in a user.
	Login(user models.User) (models.User, int, error)

	// Me gets the current user.
	Me(id string) (models.User, int, error)
}

func NewService

func NewService(repo Repository) Service

NewService creates a new user service.

Jump to

Keyboard shortcuts

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