models

package
v0.0.0-...-c7ab4d1 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateISOString

func GenerateISOString() string

GenerateISOString generates a time string equivalent to Date.now().toISOString in JavaScript

Types

type Base

type Base struct {
	ID        uint      `gorm:"primaryKey;AUTO_INCREMENT"`
	UUID      uuid.UUID `json:"_id" gorm:"primaryKey;autoIncrement:false"`
	CreatedAt string    `json:"created_at"`
	UpdatedAt string    `json:"updated_at"`
}

Base contains common columns for all tables

func (*Base) AfterUpdate

func (base *Base) AfterUpdate(tx *gorm.DB) error

AfterUpdate will update the Base struct after every update

func (*Base) BeforeCreate

func (base *Base) BeforeCreate(tx *gorm.DB) error

BeforeCreate will set Base struct before every insert

type Claims

type Claims struct {
	jwt.StandardClaims
	ID     uint   `gorm:"primaryKey"`
	Sector string `json:"sector"`
}

func (*Claims) BeforeCreate

func (claims *Claims) BeforeCreate(tx *gorm.DB) error

type User

type User struct {
	Base
	FirstName string `json:"first_name" validate:"required,ascii,max=128"`
	LastName  string `json:"last_name" validate:"required,ascii,max=128"`
	Email     string `json:"email" validate:"required,email,max=255"`
	Password  string `json:"password" validate:"required,max=255"`
	Verified  bool   `json:"verified" gorm:"default:0"`
}

Jump to

Keyboard shortcuts

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