models

package
v0.0.0-...-e249f0d Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateArticle

func ValidateArticle(article *ArticleForm) error

ValidateArticle takes an article form as parameter and check if its properties are valid

func ValidateCustomer

func ValidateCustomer(customer *CustomerForm) error

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

Types

type Article

type Article struct {
	AuthorID    uint64
	Title       string
	Content     string
	CreatedAt   time.Time
	AggregateID string
}

Article model.

type ArticleForm

type ArticleForm struct {
	AuthorID uint64
	Title    string
	Content  string
}

ArticleForm represents the informations needed to create an article

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