models

package
v0.0.0-...-383e3f9 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateCustomer

func ValidateCustomer(customer *CustomerForm) error

ValidateCustomer takes a customer form as parameter and check if its properties are valid

Types

type Customer

type Customer struct {
	ID             uint64 `gorm:"primary_key"`
	Name           string `gorm:"size:255"`
	Email          string `gorm:"size:255; unique"`
	HashedPassword string
}

Customer is our struct for users

type CustomerForm

type CustomerForm struct {
	Name     string `gorm:"size:255"`
	Email    string `gorm:"size:255" valid:"email~Invalid email address"`
	Password string `gorm:"size:255"`
}

CustomerForm is our struct to handle new users requests

type CustomerJSON

type CustomerJSON struct {
	ID          uint64
	Name, Email string
}

CustomerJSON is the struct to return user without the hash password

Jump to

Keyboard shortcuts

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