models

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IdentityTypeEmail      IdentityType   = "EMAIL"
	CredentialTypePassword CredentialType = "PASSWORD"
)
View Source
const AccessTokenTableName = "AccessTokens"
View Source
const FileGroupTableName = "FileGroups"
View Source
const FileGroupUserTableName = "FileGroupUsers"
View Source
const FileItemTableName = "FileItems"
View Source
const ShortLinkTableName = "ShortLinks"
View Source
const UserCredentialTableName = "UserCredentials"
View Source
const UserKeyTableName = "UserKeys"
View Source
const UserTableName = "Users"

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessToken

type AccessToken struct {
	BaseModel
	UserId                uint64    `gorm:"column:userId;not null;index" json:"userId"`
	Token                 string    `gorm:"column:token;not null;index" json:"token"`
	RefreshToken          string    `gorm:"column:refreshToken;not null;index" json:"refreshToken"`
	TokenExpiredAt        time.Time `gorm:"column:tokenExpiredAt;not null" json:"tokenExpiredAt"`
	RefreshTokenExpiredAt time.Time `gorm:"column:refreshTokenExpiredAt;not null" json:"refreshTokenExpiredAt"`
	User                  *User     `gorm:"foreignKey:userId" json:"user,omitempty"`
}

func (*AccessToken) TableName

func (m *AccessToken) TableName() string

type ArchiveType

type ArchiveType string
const (
	ArchiveTypeZIP ArchiveType = "ZIP"
	ArchiveTypeRAR ArchiveType = "RAR"
	ArchiveTypeTAR ArchiveType = "TAR"
)

type BaseModel

type BaseModel struct {
	ID        uint64         `gorm:"primaryKey;not null" json:"id"`
	CreatedAt time.Time      `gorm:"column:createdAt;index;<-:create" json:"createdAt"`
	UpdatedAt time.Time      `gorm:"column:updatedAt;index" json:"updatedAt"`
	DeletedAt gorm.DeletedAt `gorm:"column:deletedAt;index" json:"deletedAt"`
}

type CredentialType

type CredentialType string

type FileGroup

type FileGroup struct {
	BaseModel
	UserId                uint64      `gorm:"column:userId;not null;index" json:"userId"`
	TotalFiles            int         `gorm:"column:totalFiles;index" json:"totalFiles"`
	ArchiveType           ArchiveType `gorm:"column:archiveType;index" json:"archiveType"`
	ArchivePasscode       string      `gorm:"column:archivePasscode" json:"archivePasscode"`
	MaxDownload           int         `gorm:"column:maxDownload" json:"maxDownload"`
	DeleteAtDownloadTimes int         `gorm:"column:deleteAtDownloadTimes;index" json:"deleteAtDownloadTimes"`
	ExpiredAt             *time.Time  `gorm:"column:expiredAt;index" json:"expiredAt"`
	BundledAt             *time.Time  `gorm:"column:bundledAt;index" json:"bundledAt"`
	User                  *User       `gorm:"foreignKey:userId" json:"user,omitempty"`

	FileKey string `gorm:"column:fileKey" json:"fileKey"`

	FileItems []FileItem
}

func (*FileGroup) TableName

func (m *FileGroup) TableName() string

type FileGroupUser

type FileGroupUser struct {
	BaseModel
	FileGroupId uint64     `gorm:"column:fileGroupId;not null;index" json:"fileGroupId"`
	UserId      uint64     `gorm:"column:userId;not null;index" json:"userId"`
	FileGroup   *FileGroup `gorm:"foreignKey:fileGroupId" json:"fileGroup,omitempty"`
	User        *User      `gorm:"foreignKey:userId" json:"useromitempty"`
}

func (*FileGroupUser) TableName

func (m *FileGroupUser) TableName() string

type FileItem

type FileItem struct {
	BaseModel
	FileGroupId uint64        `gorm:"column:fileGroupId;not null;index" json:"fileGroupId"`
	Filename    string        `gorm:"column:fileName;not null;index" json:"fileName"`
	Realname    string        `gorm:"column:realName;not null;index" json:"realName"`
	PreviewAs   PreviewAsType `gorm:"column:previewAs;not null;index" json:"previewAs"`
	SizeInBytes int64         `gorm:"column:sizeInBytes" json:"sizeInBytes"`
	FileGroup   *FileGroup    `gorm:"foreignKey:fileGroupId" json:"fileGroup,omitempty"`
}

func (*FileItem) TableName

func (m *FileItem) TableName() string

type IdentityType

type IdentityType string

type PreviewAsType

type PreviewAsType string
const (
	PreviewAsImage    PreviewAsType = "IMAGE"
	PreviewAsDocument PreviewAsType = "DOCUMENT"
	PreviewAsAudio    PreviewAsType = "AUDIO"
	PreviewAsVideo    PreviewAsType = "VIDEO"
	PreviewAsArchive  PreviewAsType = "ARCHIVE"
	PreviewAsFont     PreviewAsType = "FONT"
	PreviewAsBinary   PreviewAsType = "BINARY"
)
type ShortLink struct {
	BaseModel
	FileGroupId uint64     `gorm:"column:fileGroupId;not null;index" json:"fileGroupId"`
	ShortCode   string     `gorm:"column:shortCode;unique;not null;index" json:"shortCode"`
	PIN         string     `gorm:"column:pin" json:"pin"`
	FileGroup   *FileGroup `gorm:"foreignKey:fileGroupId" json:"fileGroup,omitempty"`
}

func (*ShortLink) TableName

func (m *ShortLink) TableName() string

type User

type User struct {
	BaseModel
	Name     string         `gorm:"column:name;index" json:"name"`
	Alias    string         `gorm:"column:alias;uniqueIndex:idx_user_alias" json:"alias"`
	Metadata datatypes.JSON `gorm:"column:metadata;index" json:"metadata"`
}

func (*User) TableName

func (m *User) TableName() string

type UserCredential

type UserCredential struct {
	BaseModel
	UserId          uint64         `gorm:"column:userId;not null;index" json:"userId"`
	IdentityType    IdentityType   `gorm:"column:identityType;not null;index" json:"identityType"`
	IdentityValue   string         `gorm:"column:identityValue;not null" json:"identityValue"`
	CredentialType  CredentialType `gorm:"column:credentialType;not null;index" json:"credentialType"`
	CredentialValue string         `gorm:"column:credentialValue;not null" json:"credentialValue"`
	IsActive        bool           `gorm:"column:isActive;default:true;index" json:"isActive"`
	User            *User          `gorm:"foreignKey:userId" json:"user,omitempty"`
}

func (*UserCredential) TableName

func (m *UserCredential) TableName() string

type UserKey

type UserKey struct {
	BaseModel
	UserId  uint64 `gorm:"column:userId;not null;index" json:"userId"`
	Public  string `gorm:"column:public;not null;index" json:"public"`
	Private string `gorm:"column:private;not null;index" json:"private"`
	User    *User  `gorm:"foreignKey:userId" json:"user,omitempty"`
}

func (*UserKey) TableName

func (m *UserKey) TableName() string

Jump to

Keyboard shortcuts

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