model

package
v0.0.0-...-314907e Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2019 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MigrateDB

func MigrateDB(db *gorm.DB) []error

MigrateDB applies models and add foreign key constraint to database

Types

type Account

type Account struct {
	ID          int64  `gorm:"primary_key;auto_increment:false"`
	DisplayName string `gorm:"unique;not null"`
}

Account is model represent user and channel in database

type Message

type Message struct {
	MsgID     uuid.UUID `gorm:"type:uuid;primary_key"`
	Timestamp time.Time `gorm:"not null;column:ts"`
	MsgText   string    `gorm:"not null"`
	UserRole  string    `gorm:"type:bit(3);default:b'000'"`
	Room      Account   `gorm:"foreignkey:RoomID"`
	User      Account   `gorm:"foreignkey:UserID"`
	RoomID    int64
	UserID    int64
}

Message is model represent message from chat in database

Jump to

Keyboard shortcuts

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