models

package
v0.0.0-...-77120ca Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Archive

type Archive struct {
	Model
	Hash    string `json:"hash" gorm:"uniqueIndex:idx_unique_archive;not null;"`
	Size    uint64 `json:"size" gorm:"uniqueIndex:idx_unique_archive;not null;"`
	IsReady bool   `json:"isReady" gorm:"not null;"`
}

type File

type File struct {
	Model
	OwnerUUID   uuid.UUID  `json:"ownerUUID" gorm:"uniqueIndex:idx_unique_file;not null;"`
	Parent      *File      `json:"parent,omitempty" gorm:"foreignKey:ParentUUID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
	ParentUUID  *uuid.UUID `json:"parentUUID,omitempty" gorm:"uniqueIndex:idx_unique_file;"`
	Archive     *Archive   `json:"archive,omitempty" gorm:"foreignKey:ArchiveUUID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
	ArchiveUUID *uuid.UUID `json:"archiveUUID,omitempty"`
	Name        string     `json:"name" gorm:"uniqueIndex:idx_unique_file;not null;"`
}

type Model

type Model struct {
	UUID      uuid.UUID `json:"uuid" gorm:"primaryKey"`
	CreatedAt time.Time `json:"-"`
	UpdatedAt time.Time `json:"-"`
}

func (*Model) BeforeSave

func (m *Model) BeforeSave(tx *gorm.DB) error

type SharedFile

type SharedFile struct {
	Model
	UserUUID uuid.UUID `json:"userUUID" gorm:"uniqueIndex:idx_unique_shared_file;not null;"`
	File     *File     `json:"file,omitempty" gorm:"foreignKey:FileUUID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
	FileUUID uuid.UUID `json:"fileUUID,omitempty" gorm:"uniqueIndex:idx_unique_shared_file;not null;"`
}

Jump to

Keyboard shortcuts

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