model

package
v0.0.0-...-1cc14b7 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DBMigrate

func DBMigrate(db *gorm.DB) *gorm.DB

Types

type File

type File struct {
	Model
	Title            string `json:"title"`
	Description      string `json:"description"`
	Password         string `json:"-"`
	HasPassword      bool   `json:"hasPassword" sql:"-"`
	Permalink        string `json:"permalink"`
	FileName         string `json:"fileName"`
	FileSizeKB       string `json:"fileSizeKB"`
	FileChecksumMD5  string `json:"fileChecksumMd5"`
	FileChecksumSHA1 string `json:"fileChecksumSha1"`
	FolderID         int    `json:"-"`
	FolderHashID     string `json:"folderId" sql:"-"`
}

func (*File) WithFileNameWithoutTimestamp

func (f *File) WithFileNameWithoutTimestamp() *File

func (*File) WithHasPassword

func (f *File) WithHasPassword() *File

func (*File) WithHashId

func (f *File) WithHashId() *File

func (*File) WithId

func (f *File) WithId() *File

type FilePassword

type FilePassword struct {
	Password string `json:"password"`
}

type Folder

type Folder struct {
	Model
	Title        string `json:"title"`
	Permalink    string `json:"permalink"`
	ParentID     int    `json:"-"`
	ParentHashID string `sql:"-" json:"parentId"`
}

func (*Folder) ToPath

func (f *Folder) ToPath(index int) FolderPathElement

func (*Folder) WithHashId

func (f *Folder) WithHashId() *Folder

func (*Folder) WithId

func (f *Folder) WithId() *Folder

type FolderPathElement

type FolderPathElement struct {
	Index  int    `json:"index"`
	HashId string `sql:"-" json:"id"`
	Title  string `json:"title"`
}
type Link struct {
	Model
	Key        string    `json:"key"`
	FileID     int       `json:"-"`
	FileHashID string    `json:"fileId"`
	ValidUntil time.Time `json:"validUntil"`
}

func (*Link) IsValid

func (l *Link) IsValid() bool

func (*Link) WithHashId

func (l *Link) WithHashId() *Link

type Model

type Model struct {
	ID        uint       `gorm:"primary_key" json:"-"`
	HashId    string     `sql:"-" json:"id"`
	CreatedAt time.Time  `json:"createdAt"`
	UpdatedAt time.Time  `json:"updatedAt"`
	DeletedAt *time.Time `sql:"index" json:"deletedAt"`
}

Jump to

Keyboard shortcuts

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