user

package
v0.0.0-...-f2b87e9 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DAO

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

func NewDAO

func NewDAO(client *mongo.Client, dbName, collectionName string) *DAO

func (*DAO) CreateUser

func (dao *DAO) CreateUser(user *User) error

func (*DAO) GetAllUsers

func (dao *DAO) GetAllUsers() ([]User, error)

func (*DAO) GetUser

func (dao *DAO) GetUser(id string) (*User, error)

type User

type User struct {
	ID        primitive.ObjectID `json:"id" bson:"_id,omitempty"`
	Username  string             `json:"username" bson:"username"`
	Email     string             `json:"email" bson:"email"`
	Password  string             `json:"-" bson:"password"`
	FirstName string             `json:"firstName" bson:"firstName,omitempty"`
	LastName  string             `json:"lastName" bson:"lastName,omitempty"`
	CreatedAt time.Time          `json:"createdAt" bson:"createdAt"`
	UpdatedAt time.Time          `json:"updatedAt" bson:"updatedAt"`
}

type UserHandler

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

func NewUserHandler

func NewUserHandler(userService *UserService) *UserHandler

func (*UserHandler) CreateUser

func (h *UserHandler) CreateUser(c *gin.Context)

func (*UserHandler) GetAllUsers

func (h *UserHandler) GetAllUsers(c *gin.Context)

func (*UserHandler) GetUser

func (h *UserHandler) GetUser(c *gin.Context)

type UserService

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

func NewUserService

func NewUserService(userDAO *DAO) *UserService

func (*UserService) CreateUser

func (us *UserService) CreateUser(user User) (*User, error)

func (*UserService) GetAllUsers

func (us *UserService) GetAllUsers() ([]User, error)

func (*UserService) GetUser

func (us *UserService) GetUser(userID string) (*User, error)

Jump to

Keyboard shortcuts

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