attach

package
v0.0.0-...-7a729f8 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2023 License: MIT Imports: 17 Imported by: 1

Documentation

Index

Constants

View Source
const (
	AttachTypeSupplier = iota + 1
	AttachTypeAVL
)
View Source
const (
	FileServerTypeLocal = "local"
	FileServerTypeTUSD  = "tusd"
)

Variables

This section is empty.

Functions

func DeleteAttachs

func DeleteAttachs(p interface{}) (err error)

删除附件(删除文件+数据库记录)

func GetAttachUrls

func GetAttachUrls(attachs []Attach) (ret string)

辅助方法,获取附件URL拼接

Types

type Attach

type Attach struct {
	ID       int64  `gorm:"primary_key"  json:"id"`
	FileName string `gorm:"size:50;column:file_name;index"  json:"file_name"` //
	URL      string `gorm:"size:255;column:url"  json:"url"`                  // TUSD

	Kind string `gorm:"size:10;column:kind"  json:"kind"` // local /tusd

	Obj   string `gorm:"size:50;column:obj;index"  json:"obj"` // 所属对象
	KeyID uint   `gorm:"column:fid;index"  json:"-"`           // 对象id
	Sub   string `gorm:"size:50;column:sub;index"  json:"sub"` // 对象子分组

	CreatedAt *time.Time `json:"created_at"` // 创建时间
	TblName   string     `gorm:"-"`
	Uuid      string     `gorm:"-"` // uuid路径名
}

附件

func UploadAttach

func UploadAttach(c common.BaseController, flowName string, objId uint, keys []string, tx *gorm.DB) (attachs []Attach, err error)

func UploadAttachs

func UploadAttachs(files []*multipart.FileHeader, obj, sub string, objId uint, tblName string, tx *gorm.DB) (attachs []Attach, err error)

上传附件(文件上传+记录入库)

func (*Attach) TableName

func (a *Attach) TableName() string

表名

Jump to

Keyboard shortcuts

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