user

package
v0.0.0-...-716e23e Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2019 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitStore

func InitStore(db *mgo.Database)

Types

type Controller

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

func NewController

func NewController(apiRouter *gin.RouterGroup, authRouter *gin.RouterGroup) Controller

func (*Controller) Routes

func (controller *Controller) Routes()

Routes registers this controllers sub-routing in the main apiRouter. It returns a RouterGroup containing only the routes for the operations on the User model.

type Login

type Login struct {
	Username string `form:"username" json:"username" binding:"required"`
	Password string `form:"password" json:"password" binding:"required"`
}

type Service

type Service interface {
	CreateUser(user User) (*User, error)
	AuthenticateUser(login Login) (*User, error)
}

func InitService

func InitService() Service

type Store

type Store interface {
	InsertUser(user *User) error
	FindUserByUsername(username string) (*User, error)
}

type User

type User struct {
	Id       bson.ObjectId `json:"id" bson:"_id,omitempty"`
	Username string        `json:"username" binding:"required" bson:"username"`
	Email    string        `json:"email" binding:"required" bson:"email"`
	Password string        `json:"password" binding:"required,min=8" bson:"password"`
}

Jump to

Keyboard shortcuts

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