users

package
v0.0.0-...-81dbdb3 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MongoUser

type MongoUser interface{ User | RawUser }

type RawUser

type RawUser struct {
	Id       string `json:"id" bson:"_id"`
	Email    string `json:"email"`
	Password string `json:"password"`
}

type SignupData

type SignupData struct {
	Email    string `json:"email" validate:"required,email"`
	Password string `json:"password" validate:"required"`
}

type User

type User struct {
	Id    string `json:"id" bson:"_id"`
	Email string `json:"email"`
}

type UserHandler

type UserHandler struct {
	UsersService UserServiceInterface
}

func (*UserHandler) GetOne

func (uh *UserHandler) GetOne(w http.ResponseWriter, r *http.Request)

func (*UserHandler) List

func (uh *UserHandler) List(w http.ResponseWriter, r *http.Request)

type UserServiceInterface

type UserServiceInterface interface {
	GetOne(*RawUser, interface{}) error
	FindByEmail(*RawUser, string) error
	Create(*SignupData) (*mongo.InsertOneResult, error)
	GetList(*[]*RawUser, interface{}) error
}

type UsersService

type UsersService struct {
	Col *mongo.Collection
}

func (*UsersService) Create

func (us *UsersService) Create(data *SignupData) (*mongo.InsertOneResult, error)

func (*UsersService) FindByEmail

func (us *UsersService) FindByEmail(user *RawUser, email string) error

func (*UsersService) FindById

func (us *UsersService) FindById(id string)

func (*UsersService) GetList

func (us *UsersService) GetList(users *[]*RawUser, filter interface{}) error

func (*UsersService) GetOne

func (us *UsersService) GetOne(user *RawUser, filter interface{}) error

func (*UsersService) List

func (us *UsersService) List(filter interface{}) ([]*User, error)

Jump to

Keyboard shortcuts

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