model

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: MIT Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseModel

type BaseModel struct {
	ID        uint32 `json:"id"`
	CreatedAt uint32 `json:"created_at,omitempty"`
	UpdatedAt uint32 `json:"updated_at,omitempty"`
}

type CreateModel

type CreateModel struct {
	ID        uint32 `json:"id"`
	CreatedAt uint32 `json:"created_at,omitempty"`
}

type DeleteModel

type DeleteModel struct {
	ID        uint32  `json:"id"`
	CreatedAt uint32  `json:"created_at,omitempty"`
	UpdatedAt uint32  `json:"updated_at,omitempty"`
	DeletedAt *uint32 `json:"-"`
}

type Directory

type Directory struct {
	BaseModel
	ParentID uint32 `json:"parent_id"`
	Name     string `json:"name"`
	App      string `json:"app"`
}

func (*Directory) AllByParentID

func (u *Directory) AllByParentID(ctx kratosx.Context, app string, id uint32) ([]*Directory, error)

AllByParentID 通过id查询目录信息

func (*Directory) Create

func (u *Directory) Create(ctx kratosx.Context) error

Create 创建目录信息

func (*Directory) DeleteByID

func (u *Directory) DeleteByID(ctx kratosx.Context, id uint32) error

DeleteByID 通过id删除目录信息

func (*Directory) OneByID

func (u *Directory) OneByID(ctx kratosx.Context, id uint32) error

OneByID 获取目录信息

func (*Directory) OneByName

func (u *Directory) OneByName(ctx kratosx.Context, id uint32, name string) error

OneByName 获取目录信息

func (*Directory) OneByPaths

func (u *Directory) OneByPaths(ctx kratosx.Context, app string, paths []string) error

OneByPaths 获取目录信息

func (*Directory) Update

func (u *Directory) Update(ctx kratosx.Context) error

Update 更新目录信息

type File

type File struct {
	BaseModel
	DirectoryID uint32 `json:"directory_id"`
	Name        string `json:"name"`
	Type        string `json:"type"`
	Size        uint32 `json:"size"`
	Sha         string `json:"sha"`
	Src         string `json:"src"`
	UploadID    string `json:"upload_id"`
	ChunkCount  uint32 `json:"chunk_count"`
	Storage     string `json:"storage"`
	Status      string `json:"status"`
}

func (*File) AllByDirectoryID

func (f *File) AllByDirectoryID(ctx kratosx.Context, id uint32) ([]*File, error)

AllByDirectoryID 通过id查询文件信息

func (*File) Copy

func (f *File) Copy(ctx kratosx.Context, dir uint32, key string) error

func (*File) CountByDirectoryID

func (f *File) CountByDirectoryID(ctx kratosx.Context, id uint32) (int64, error)

CountByDirectoryID 通过id查询文件数量

func (*File) CountByName

func (f *File) CountByName(ctx kratosx.Context, name string) (int64, error)

CountByName 通过name查询文件数量

func (*File) Create

func (f *File) Create(ctx kratosx.Context) error

Create 创建文件信息

func (*File) DeleteByDirAndIds

func (f *File) DeleteByDirAndIds(ctx kratosx.Context, did uint32, ids []uint32) error

DeleteByDirAndIds 通过id数组删除文件信息

func (*File) OneByDirAndName

func (f *File) OneByDirAndName(ctx kratosx.Context, id uint32, name string) error

OneByDirAndName 通过id查询文件信息

func (*File) OneByID

func (f *File) OneByID(ctx kratosx.Context, id uint32) error

OneByID 通过id查询文件信息

func (*File) OneBySha

func (f *File) OneBySha(ctx kratosx.Context, sha string) error

OneBySha 通过sha查询文件信息

func (*File) OneByUploadID

func (f *File) OneByUploadID(ctx kratosx.Context, ui string) error

OneByUploadID 通过upload_id查询文件信息

func (*File) Page

func (f *File) Page(ctx kratosx.Context, options *PageOptions) ([]*File, uint32, error)

Page 查询分页数据

func (*File) Update

func (f *File) Update(ctx kratosx.Context) error

Update 更新文件信息

type PageOptions

type PageOptions struct {
	Page     uint32
	PageSize uint32
	Scopes   Scopes
}

type Scopes

type Scopes func(db *gorm.DB) *gorm.DB

Jump to

Keyboard shortcuts

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