users

package
v0.0.0-...-a8602ed Latest Latest
Warning

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

Go to latest
Published: May 24, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(env *config.Env) httprouter.Handle

Create a user with the given JSON data

func CreateUser

func CreateUser(cl *mongo.Collection, u User) primitive.ObjectID

CreateUser creates a user and returns the create user

func Delete

func Delete(env *config.Env) httprouter.Handle

Delete a user by its id users

func DeleteUser

func DeleteUser(cl *mongo.Collection, id primitive.ObjectID) int64

DeleteUser deletes the user of given id

func Get

func Get(env *config.Env) httprouter.Handle

Get returns a user by its id users

func Index

func Index(env *config.Env) httprouter.Handle

Index returns all users

func Modify

func Modify(env *config.Env) httprouter.Handle

Modify a user

func ModifyUser

func ModifyUser(cl *mongo.Collection, u []User) primitive.ObjectID

ModifyUser replace the user given on pos 0 from slice by the user on pos 1

Types

type User

type User struct {
	ID    primitive.ObjectID `json:"_id,omitempty" bson:"_id,omitempty"`
	FName string             `json:"fname,omitempty" bson:"fname,omitempty"`
	LName string             `json:"lname,omitempty" bson:"lname,omitempty"`
	Email string             `json:"email,omitempty" bson:"email,omitempty"`
}

User basic structure

func AllUsers

func AllUsers(cl *mongo.Collection) []User

AllUsers returns a slice of Users

func OneUser

func OneUser(cl *mongo.Collection, id primitive.ObjectID) User

OneUser returns the ObjectID user

Jump to

Keyboard shortcuts

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