file

package
v2.0.6+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2019 License: AGPL-3.0 Imports: 18 Imported by: 24

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Enable bool

Functions

func EmbeddedRes

func EmbeddedRes(v string, fn func(string, int64)) [][]string

EmbeddedRes 获取正文中的资源

func RelatedRes

func RelatedRes(v string, fn func(string, int64), seperator ...string)

RelatedRes 获取字段中关联的资源

func ReplaceEmbeddedRes

func ReplaceEmbeddedRes(v string, reses map[uint64]string) (r string)

ReplaceEmbeddedRes 替换正文中的资源网址

func ReplaceRelatedRes

func ReplaceRelatedRes(v string, reses map[uint64]string, seperator ...string) (r string)

ReplaceRelatedRes 替换字段中的资源网址

Types

type Embedded

type Embedded struct {
	*dbschema.FileEmbedded

	File *File
	// contains filtered or unexported fields
}

func NewEmbedded

func NewEmbedded(ctx echo.Context, fileMdls ...*File) *Embedded

func (*Embedded) AddFileByIds

func (f *Embedded) AddFileByIds(fileIds []string, excludeFileIds ...string) error

func (*Embedded) DeleteByInstance

func (f *Embedded) DeleteByInstance(m *dbschema.FileEmbedded) error

func (*Embedded) DeleteByTableID

func (f *Embedded) DeleteByTableID(project string, table string, tableID string) error

DeleteByTableID 删除嵌入文件

func (*Embedded) DeleteFileByIds

func (f *Embedded) DeleteFileByIds(fileIds []string, excludeFileIds ...string) error

func (*Embedded) RelationEmbeddedFiles

func (f *Embedded) RelationEmbeddedFiles(project string, table string, field string, tableID string, v string) error

RelationEmbeddedFiles 关联嵌入的文件 @param project 项目名称 @param table 表名称 @param field 被嵌入的字段名 @param tableID 表中行主键ID @param v 内容 @return @author AdamShen <swh@admpub.com>

func (*Embedded) RelationFiles

func (f *Embedded) RelationFiles(project string, table string, field string, tableID string, v string, seperator ...string) error

func (*Embedded) UpdateByFileID

func (f *Embedded) UpdateByFileID(project string, table string, field string, tableID string, fileID uint64) error

func (*Embedded) UpdateEmbedded

func (f *Embedded) UpdateEmbedded(embedded bool, project string, table string, field string, tableID string, fileIds ...interface{}) (err error)

func (*Embedded) Updater

func (f *Embedded) Updater(table string, field string, tableID string) *fileupdater.FileUpdater

type File

type File struct {
	*dbschema.File
	// contains filtered or unexported fields
}

func NewFile

func NewFile(ctx echo.Context) *File

func (*File) Add

func (f *File) Add(reader io.Reader) error

func (*File) CondByOwner

func (f *File) CondByOwner(ownerType string, ownerID uint64) db.Compound

func (*File) Decr

func (f *File) Decr(fileIds ...interface{}) (err error)

Decr 减少使用次数

func (*File) DeleteBy

func (f *File) DeleteBy(cond db.Compound) error

func (*File) DeleteByID

func (f *File) DeleteByID(id uint64, ownerType string, ownerID uint64) (err error)

func (*File) DeleteBySavePath

func (f *File) DeleteBySavePath(savePath string) (err error)

func (*File) FillData

func (f *File) FillData(reader io.Reader, forceReset bool, schemas ...*dbschema.File) error

func (*File) FnGetByMd5

func (f *File) FnGetByMd5() func(r *uploadClient.Result) error

func (*File) GetBySavePath

func (f *File) GetBySavePath(storerName string, savePath string) (err error)

func (*File) GetByViewURL

func (f *File) GetByViewURL(storerName string, viewURL string) (err error)

func (*File) GetIDByViewURLs

func (f *File) GetIDByViewURLs(viewURLs []interface{}) (r []interface{})

func (*File) GetViewURLByIds

func (f *File) GetViewURLByIds(ids ...interface{}) (r map[string]interface{})

func (*File) Incr

func (f *File) Incr(fileIds ...interface{}) (err error)

Incr 增加使用次数

func (*File) NewFile

func (f *File) NewFile(m *dbschema.File) *File

func (*File) RemoveAvatar

func (f *File) RemoveAvatar(ownerType string, ownerID int64) error

func (*File) RemoveUnused

func (f *File) RemoveUnused(ago int64, ownerType string, ownerID uint64) error

func (*File) RemoveUnusedAvatar

func (f *File) RemoveUnusedAvatar(ownerType string, excludeID uint64) error

func (*File) SetByUploadResult

func (f *File) SetByUploadResult(result *uploadClient.Result) *File

func (*File) SetFieldName

func (f *File) SetFieldName(field string) table.TableInfoStorer

func (*File) SetTableID

func (f *File) SetTableID(tableID string) table.TableInfoStorer

func (*File) SetTableName

func (f *File) SetTableName(table string) table.TableInfoStorer

func (*File) UpdateAvatar

func (f *File) UpdateAvatar(project string, ownerType string, ownerID uint64) error

func (*File) UpdateUnrelation

func (f *File) UpdateUnrelation(project string, table string, field string, tableID string, fileIds ...interface{}) (err error)

UpdateUnrelation 更新未关联的附件

type Thumb

type Thumb struct {
	*dbschema.FileThumb
	// contains filtered or unexported fields
}

func NewThumb

func NewThumb(ctx echo.Context) *Thumb

func (*Thumb) Save

func (t *Thumb) Save() (err error)

func (*Thumb) SetByFile

func (t *Thumb) SetByFile(file *dbschema.File) *Thumb

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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