models

package
v0.0.0-...-47332bf Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2019 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Model

type Model struct {
	ID        uint      `gorm:"AUTO_INCREMENT;primary_key;column:id" json:"id"`
	CreatedAt time.Time `gorm:"column:created_at" json:"created_at"`
}

Model definition same as gorm.Model, but including column and json tags

type RequestBody

type RequestBody interface {
	Validate() error
}

RequestBody interface for any model that used for validation

type User

type User struct {
	Model
	FirstName string `gorm:"column:first_name" json:"first_name"`
	LastName  string `gorm:"column:last_name" json:"last_name"`
	Address   string `gorm:"column:address" json:"address"`
	Email     string `gorm:"column:email" json:"email"`
}

User Model

func (*User) Validate

func (u *User) Validate() error

Validate validates user input

Jump to

Keyboard shortcuts

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