models

package
v0.0.0-...-db79cbe Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2022 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 Link struct {
	ID        string    `json:"id" xml:"id" form:"id" gorm:"primaryKey" validate:"required"`
	URL       string    `json:"url" xml:"url" form:"url" gorm:"index" validate:"required"`
	ExpiredAt time.Time `json:"expired_at" xml:"expired_at" form:"expired_at"`
}

Link represents a shortened URL.

type LinkForm

type LinkForm struct {
	URL       string    `json:"url" xml:"url" form:"url" validate:"required"`
	ExpiredAt time.Time `json:"expired_at" xml:"expired_at" form:"expired_at"`
}

LinkForm is used to create or update a link.

type User

type User struct {
	ID        string         `json:"id" xml:"id" form:"id" gorm:"primaryKey" validate:"required,uuid"`
	Username  string         `json:"username" xml:"username" form:"username" gorm:"unique;size:127" validate:"required,email"`
	Password  string         `json:"-" xml:"-" form:"password" gorm:"index;size=128" validate:"required,min=8"` // SHA512
	Lastname  string         `json:"lastname" xml:"lastname" form:"lastname" gorm:"size=63" validate:"required"`
	Firstname string         `json:"firstname" xml:"firstname" form:"firstname" gorm:"size=63" validate:"required"`
	CreatedAt time.Time      `json:"created_at" xml:"created_at" form:"created_at" gorm:"autoCreateTime"`
	UpdatedAt time.Time      `json:"updated_at" xml:"updated_at" form:"updated_at" gorm:"autoUpdateTime"`
	DeletedAt gorm.DeletedAt `json:"-" xml:"-" form:"deleted_at" gorm:"index"`
}

User represents a user in database.

type UserForm

type UserForm struct {
	Username  string `json:"username" xml:"username" form:"username" validate:"required,email"`
	Password  string `json:"password" xml:"password" form:"password" validate:"required,min=8"`
	Lastname  string `json:"lastname" xml:"lastname" form:"lastname" validate:"required"`
	Firstname string `json:"firstname" xml:"firstname" form:"firstname" validate:"required"`
}

UserForm is used to create or update a user.

Jump to

Keyboard shortcuts

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