models

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseModel

type BaseModel struct {
	Id        string    `bson:"id" gorm:"primary_key;column;column:id"`
	CreatedAt time.Time `bson:"created_at" gorm:"column:created_at"`
	UpdatedAt time.Time `bson:"updated_at" gorm:"column:updated_at"`
}

BaseModel including other common fields

type Keyword

type Keyword struct {
	UrlId string `bson:"url_id" gorm:"column:url_id"`
	Value string `bson:"value" gorm:"column:value"`
}

Keyword is model for keywords attached to a url

type Url

type Url struct {
	BaseModel   BaseModel `bson:"inline"`
	UserId      string    `bson:"user_id" gorm:"user_id"`
	OriginalURL string    `bson:"original_url" gorm:"column:original_url"`
	ShortCode   string    `bson:"short_code" gorm:"column:short_code"`
	CustomAlias string    `bson:"custom_alias" gorm:"column:custom_alias"`
	ExpiresOn   time.Time `bson:"expires_on" gorm:"column:expires_on"`
	VisitCount  int       `bson:"visit_count" gorm:"column:visit_count"`
	Keywords    []Keyword `bson:"keywords" gorm:"-"`
}

type User

type User struct {
	BaseModel            BaseModel `bson:"inline"`
	Email                string    `bson:"email" gorm:"column:email,uniqueIndex"`
	Password             string    `bson:"password" gorm:"column:password"`
	ResetPasswordExpires time.Time `bson:"reset_password_expires" gorm:"column:reset_password_expires"`
	ResetPasswordToken   string    `bson:"reset_password_token" gorm:"column:reset_password_token"`
	VerificationExpires  time.Time `bson:"verification_expires" gorm:"column:verification_expires"`
	VerificationToken    string    `bson:"verification_token" gorm:"column:verification_token"`
	Verified             bool      `bson:"verified" gorm:"column:verified,omitempty"`
}

Jump to

Keyboard shortcuts

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