user

package
v0.0.0-...-9abd94b Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UniqueConstraintEmail = "users_email_key"
)

Variables

This section is empty.

Functions

func Create

func Create(db *gorm.DB, user *User) (uint, error)

Types

type EmailDuplicateError

type EmailDuplicateError struct {
	Email string
}

func (*EmailDuplicateError) Error

func (e *EmailDuplicateError) Error() string

type EmailNotExistsError

type EmailNotExistsError struct{}

func (*EmailNotExistsError) Error

func (*EmailNotExistsError) Error() string

type PasswordMismatchError

type PasswordMismatchError struct{}

func (*PasswordMismatchError) Error

func (e *PasswordMismatchError) Error() string

type Request

type Request struct {
	Userid    string
	Username  string
	FirstName string
	LastName  string
	Email     string
	Password  string
	Phone     string
}

type Response

type Response struct {
	Id   uint
	User *User
}

func Login

func Login(db *gorm.DB, req *Request) (*Response, error)

func Signup

func Signup(db *gorm.DB, req *Request) (*Response, error)

type User

type User struct {
	gorm.Model
	FirstName    string
	LastName     string
	Email        string `gorm:"type:varchar(100);not null;unique_index"`
	PasswordHash string
	PhoneNumber  string
}

func FindByUserid

func FindByUserid(db *gorm.DB, uid string) (*User, error)

func FindUserByEmail

func FindUserByEmail(db *gorm.DB, email string) (*User, error)

type UserNotExistsError

type UserNotExistsError struct{}

func (*UserNotExistsError) Error

func (*UserNotExistsError) Error() string

Jump to

Keyboard shortcuts

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