models

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2022 License: ISC Imports: 2 Imported by: 0

Documentation

Overview

Package models defines all the database models for the application

Index

Constants

View Source
const (
	// TokenUserActivation is a constant used to identify tokens used for user activation
	TokenUserActivation string = "user_activation"
	// TokenPasswordReset is a constant used to identify tokens used for password resets
	TokenPasswordReset string = "password_reset"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Session

type Session struct {
	gorm.Model
	Identifier string
	UserID     uint
	ExpiresAt  time.Time
}

Session holds information about user sessions and when they expire

func (Session) HasExpired

func (s Session) HasExpired() bool

HasExpired is a helper function that checks if the current time is after the session expire datetime

type Token

type Token struct {
	gorm.Model
	Value     string
	Type      string
	ModelID   int
	ModelType string
	ExpiresAt time.Time
}

Token holds tokens typically used for user activation and password resets

func (Token) HasExpired

func (t Token) HasExpired() bool

HasExpired is a helper function that checks if the current time is after the token expiration time

type User

type User struct {
	gorm.Model
	Email       string
	Password    string
	ActivatedAt *time.Time
	Tokens      []Token `gorm:"polymorphic:Model;"`
	Sessions    []Session
}

User holds information relating to users that use the application

type Website

type Website struct {
	gorm.Model
	Title       string
	Description string
	URL         string
}

Website holds information about different websites

Jump to

Keyboard shortcuts

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