models

package
v0.0.0-...-9a10c2a Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthToken

type AuthToken struct {
	Id          uint       `gorm:"primaryKey" json:"id"`
	UserId      uint       `gorm:"not null" json:"user_id"`
	Token       string     `gorm:"type:VARCHAR(7);not null" json:"token"`
	ExpiryDate  *time.Time `json:"expiry_date"` // Pointer to allow for null values
	DateCreated time.Time  `gorm:"type:timestamp;default:CURRENT_TIMESTAMP" json:"date_created"`

	User User `gorm:"foreignKey:UserId;references:Id" json:"user"`
}

AuthToken model corresponds to the "auth_tokens" table

type Note

type Note struct {
	Id              uint           `gorm:"primaryKey" json:"id"`
	UserId          uint           `json:"-"`
	NoteTitle       string         `json:"note_title"`
	NoteDescription string         `json:"note_description"`
	CreatedAt       time.Time      `json:"created_at"`
	UpdatedAt       time.Time      `json:"updated_at"`
	DeletedAt       gorm.DeletedAt `gorm:"index" json:"-"`

	User User `gorm:"foreignKey:UserId;references:Id" json:"-"`
}

Note model corresponds to the "notes" table

type User

type User struct {
	Id             uint      `gorm:"primaryKey" json:"id"`
	PhoneNumber    string    `gorm:"type:VARCHAR(11);unique;not null" json:"phone_number"`
	FirstName      string    `gorm:"type:VARCHAR(75)" json:"first_name"`
	LastName       string    `gorm:"type:VARCHAR(75)" json:"last_name"`
	DateRegistered time.Time `gorm:"type:timestamp;default:CURRENT_TIMESTAMP" json:"date_registered"`
}

User model corresponds to the "users" table

Jump to

Keyboard shortcuts

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