users

package
v0.0.0-...-e848f6b Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateHandler

func CreateHandler(w http.ResponseWriter, r *http.Request)

CreateHandler add new user to database.

func SaveOne

func SaveOne(data interface{}) error

SaveOne UserModel will be saved in database returning error if It couldnt save or nil if everything was done.

Types

type UserModel

type UserModel struct {
	ID           uint64  `gorm:"auto_increment;primary_key"`
	Username     string  `gorm:"column:username"`
	Email        string  `gorm:"column:email"`
	Bio          string  `gorm:"column:bio; size:1024"`
	Image        *string `gorm:"column:image"`
	PasswordHash string  `gorm:"column:password; not null"`
}

UserModel this should only be used for database concerns.

func FindOneUser

func FindOneUser(condition interface{}) (UserModel, error)

FindOneUser input the condition and It will return UserModel.

func (*UserModel) Update

func (u *UserModel) Update(data interface{}) error

Update properties for UserModel.

type UserRegistration

type UserRegistration struct {
	ID                   uint64 `json:"-"`
	Username             string `json:"username"`
	Email                string `json:"email"`
	Bio                  string `json:"bio"`
	Image                string `json:"image"`
	Password             string `json:"password"`
	PasswordConfirmation string `json:"passwordConfirmation"`
}

UserRegistration holds data for saving a new user within database.

Jump to

Keyboard shortcuts

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