model

package
v0.0.0-...-7d84395 Latest Latest
Warning

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

Go to latest
Published: May 5, 2020 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Migrate

func Migrate(db *gorm.DB)

Migrate method makes migrations by using gorm.

Types

type Mail

type Mail struct {
	gorm.Model
	From              User         `gorm:"foreignkey:FromRefer"`
	FromRefer         uint         `gorm:"not null"`
	To                User         `gorm:"foreignkey:ToRefer"`
	ToRefer           uint         `gorm:"not null"`
	SymmetricKey      SymmetricKey `gorm:"foreignkey:SymmetricKeyRefer"`
	SymmetricKeyRefer uint
	Body              string `gorm:"not null"`
	Image             []byte
	IsContainImage    bool
	Hash              string
	IsEncrypted       bool `gorm:"not null;default:false"`
	Signature         []byte
}

Mail model.

type SymmetricKey

type SymmetricKey struct {
	gorm.Model
	Sender          User   `gorm:"foreignkey:SenderRefer;"`
	SenderRefer     uint   `gorm:"not null"`
	Receiver        User   `gorm:"foreignkey:ReceiverRefer;"`
	ReceiverRefer   uint   `gorm:"not null"`
	Key             string `gorm:"not null"`
	IsAutoGenerated bool   `gorm:"not null;default:false"`
}

Symmetric Key model.

type User

type User struct {
	gorm.Model
	Username    string `gorm:"unique;unique_index;not null"`
	Password    string `gorm:"not null"`
	Mails       []Mail `gorm:"foreignkey:ToRefer;association_foreignkey:ID"`
	PublicKey   []byte
	PrivateKey  []byte
	TotpSecret  string
	Is2faActive bool
}

User model.

Jump to

Keyboard shortcuts

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