db

package
v0.0.0-...-c4da03f Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2018 License: MIT Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load

func Load(db *gorm.DB)

Load calls the GORM DB.AutoMigrate method on all database structs in the db package db: GORM database to migrate

Types

type DirectMessage

type DirectMessage struct {
	gorm.Model

	// Sender will be populated with the User who sent and owns the message
	Sender User `gorm:"ForeignKey:SenderUserID"`

	// SenderUserID is the id of the user who owns the message
	SenderUserID uint `gorm:"not null"`

	// Recipient will be populated with the User who the message is sent to
	Recipient User `gorm:"ForeignKey:RecipientUserID"`

	// RecipientUserID is the id of the user who the message is sent to
	RecipientUserID uint `gorm:"not null"`

	// Picture will be populated with the Picture included with the message
	// , if no picture is included it will be nil
	Picture Picture

	// PictureID is the id of the included picture, if no picture is
	// included it will be -1
	PictureID uint `gorm:"not null"`

	// Text is the text content of the message being sent to the other user
	// , if no text is included it is set to ""
	Text string `gorm:"not null"`

	// Length is the time in seconds the recipient user can view the
	// message. Set to -1 if infinite view length.
	Length int `gorm:"not null"`

	// SentAt is the time the message was sent
	SentAt time.Time `gorm:"not null"`

	// ViewedAt is the time the recipient user view the message. Set to nil
	// if not viewed yet
	ViewedAt time.Time
}

DirectMessage is a resource which stores information about a message sent from one user to another.

type Picture

type Picture struct {
	gorm.Model

	// User will be populated with the User who owns the Picture
	User User

	// UserID is the id of the user who owns the picture
	UserID uint `gorm:"not null"`

	// B2BucketID is the id of the bz2 bucket which holds picture data
	B2BucketID string `gorm:"not null"`

	// B2FileID is the id of the bz2 file which holds picture data
	B2FileID string `gorm:"not null"`

	// B2FileName is the name of the bz2 file which holds picture data
	B2FileName string `gorm:"not null"`

	// B2FileURL is the url at which the raw bz2 file data can be accessed
	B2FileURL string `gorm:"not null"`

	// Text is the string message present in the picture. Set to nil if
	// none is present.
	Text string
}

Picture is the resource stores information related to images sent by users on the platform

type User

type User struct {
	gorm.Model

	// FirstName is the user's first name, sometimes called the: given name
	FirstName string `gorm:"not null"`

	// LastName is the user's last name, sometimes called the: family name
	LastName string `gorm:"not null"`

	// Username is the screen name which the user goes by
	Username string

	// ProfilePictureID is the id of the Picture which holds the user's
	// profile picture
	ProfilePictureID uint `gorm:"not null"`

	// PasswordHash holds the hash of the user's password
	PasswordHash string `json:"-" gorm:"not null"`
}

User is the resource which holds information about individual accounts on the BlapChat platform

Jump to

Keyboard shortcuts

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