Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RemoveUser ¶
func RemoveUser(collection ICollection, ID string) error
RemoveUser is a function for remove user
func SaveUser ¶
func SaveUser(collection ICollection, user *User) error
SaveUser is a function for save user to database It will hash the password before save
func UpdateUser ¶
func UpdateUser(collection ICollection, user *User) error
UpdateUser is a function for update user
Types ¶
type ICollection ¶
type ICollection interface { InsertOne(ctx context.Context, document interface{}, opts ...*options.InsertOneOptions) (*mongo.InsertOneResult, error) UpdateOne(ctx context.Context, filter interface{}, update interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error) DeleteOne(ctx context.Context, filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error) Find(ctx context.Context, filter interface{}, opts ...*options.FindOptions) (*mongo.Cursor, error) }
type NotificationService ¶
func (*NotificationService) SubscribeUserCreateEvent ¶
func (ns *NotificationService) SubscribeUserCreateEvent()
func (*NotificationService) SubscribeUserUpdateEvent ¶
func (ns *NotificationService) SubscribeUserUpdateEvent()
type PageRequest ¶
PageRequest is a struct for pagination request used in ListUsers
type User ¶
type User struct { ID string `json:"id,omitempty" bson:"_id,omitempty"` FirstName string `json:"first_name,omitempty" bson:"first_name,omitempty"` LastName string `json:"last_name,omitempty" bson:"last_name,omitempty"` Nickname string `json:"nickname,omitempty" bson:"nickname,omitempty"` Password string `json:"password,omitempty" bson:"password,omitempty"` Email string `json:"email,omitempty" bson:"email,omitempty"` Country string `json:"country,omitempty" bson:"country,omitempty"` CreateAt time.Time `json:"create_at,omitempty" bson:"create_at,omitempty"` UpdateAt time.Time `json:"update_at,omitempty" bson:"update_at,omitempty"` }
User model
func ListUsers ¶
func ListUsers(collection ICollection, pageRequest *PageRequest) ([]User, error)
ListUsers is a function for list users based on pageRequest page, size and filter with country
Click to show internal directories.
Click to hide internal directories.