model

package
v0.0.0-...-83adff0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2020 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MaxUploadSize max upload file size
	MaxUploadSize = 20 * 1024 * 1024
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Bucket

type Bucket struct {
	ID           int                   `json:"id" gorm:"column:id"`
	Name         string                `json:"name" gorm:"column:bucket_name"`
	Property     int                   `json:"property" gorm:"column:property"`
	KeyID        string                `json:"key_id" gorm:"column:key_id"`
	KeySecret    string                `json:"key_secret" gorm:"column:key_secret"`
	PurgeCDN     bool                  `json:"purge_cdn" gorm:"column:purge_cdn"`
	CacheControl int                   `json:"cache_control" gorm:"column:purge_cdn"`
	CTime        time.Time             `json:"ctime" gorm:"column:ctime"`
	MTime        time.Time             `json:"mtime" gorm:"column:mtime"`
	DirLimit     map[string]*DirConfig `json:"dir_limit" gorm:"-"`
}

Bucket in accord with bucket table in database

func (Bucket) TableName

func (b Bucket) TableName() string

TableName return table name.

type DirConfig

type DirConfig struct {
	Pic  DirPicConfig  `json:"dir_pic_config"`
	Rate DirRateConfig `json:"dir_rate_config"`
}

DirConfig directory config

type DirLimit

type DirLimit struct {
	ID            int       `json:"id" gorm:"column:id"`
	BucketName    string    `json:"bucket_name" gorm:"column:bucket_name"`
	Dir           string    `json:"dir" gorm:"column:dir"`
	DirPicConfig  string    `json:"dir_pic_config" gorm:"column:config_pic"`
	DirRateConfig string    `json:"dir_rate_config" gorm:"column:config_rate"`
	CTime         time.Time `json:"ctime" gorm:"column:ctime"`
	MTime         time.Time `json:"mtime" gorm:"column:mtime"`
}

DirLimit in accord with dir_limit table in database

func (DirLimit) TableName

func (l DirLimit) TableName() string

TableName return table name.

type DirPicConfig

type DirPicConfig struct {
	FileSize           int      `json:"file_size"`             //文件大小上限 单位 Byte
	MaxPixelWidthSize  int      `json:"max_pixel_width_size"`  //像素宽上限
	MinPixelWidthSize  int      `json:"min_pixel_width_size"`  //像素高下限
	MaxPixelHeightSize int      `json:"max_pixel_height_size"` //像素高上限
	MinPixelHeightSize int      `json:"min_pixel_height_size"` //像素宽下限
	MaxAspectRatio     float64  `json:"max_aspect_ratio"`      //最大宽高比
	MinAspectRatio     float64  `json:"min_aspect_ratio"`      //最小宽高比
	AllowType          string   `json:"allow_type"`            //允许的MIME类型
	AllowTypeSlice     []string // 允许的MIME类型列表,AllowTypeSlice = strings.Split(AllowType,",")
}

DirPicConfig directory picture config

type DirRateConfig

type DirRateConfig struct {
	// secondQPS 接受 countQPS 个请求
	SecondQPS int `json:"second_qps"`
	CountQPS  int `json:"count_qps"`
}

DirRateConfig directory rate config

type Result

type Result struct {
	Location string `json:"location"`
	Etag     string `json:"etag"`
}

Result upload result

type ResultWm

type ResultWm struct {
	Location string `json:"location"`
	Md5      string `json:"md5"`
	Height   int    `json:"height"`
	Width    int    `json:"width"`
}

ResultWm watermark result

type UploadActionType

type UploadActionType int

UploadActionType report action type

const (
	UploadInternal      UploadActionType = iota + 1 // 内网用户
	UploadInternalAdmin                             // 内网管理员
	UploadPublic                                    // 外网公用
	UploadApp                                       // 外网 app
	UploadWeb                                       // 外网web
)

report action type

func (UploadActionType) String

func (a UploadActionType) String() (s string)

type UploadParam

type UploadParam struct {
	Bucket      string  `form:"bucket" json:"bucket" validate:"required" `
	ContentType string  `form:"content_type" json:"content_type"`
	Dir         string  `form:"dir" json:"dir"`
	FileName    string  `form:"file_name" json:"file_name"`
	WmKey       string  `form:"wm_key" json:"wm_key"`
	WmText      string  `form:"wm_text" json:"wm_text"`
	WmPaddingX  int     `form:"wm_padding_x" json:"wm_padding_x"`
	WmPaddingY  int     `form:"wm_padding_y" json:"wm_padding_y"`
	WmScale     float64 `form:"wm_scale" json:"wm_scale"`
}

UploadParam upload params

func (*UploadParam) WMInit

func (up *UploadParam) WMInit()

WMInit init watermark default value.

Jump to

Keyboard shortcuts

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