common

package
v0.0.0-...-0366c93 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EVENT_VIDEO_CONVERT = "video.convert"
)

Variables

This section is empty.

Functions

func GetFileExt

func GetFileExt(fileType FileType) string

Types

type Event

type Event struct {
	Type  string // может пригодиться для разделения видов событий, но пока будет только 1
	Value VideoConvertData
}

type File

type File struct {
	Id           int           `json:"-" db:"id"`
	Path         string        `json:"path" db:"path"`
	Name         string        `json:"name" db:"name"`
	UserId       int           `json:"-" db:"user_id"`
	KiloByteSize int64         `json:"kilo_byte_size" db:"kilo_byte_size"`
	PrevImage    string        `json:"prev_image" db:"prev_image"`
	Status       ProcessStatus `json:"status" db:"status"`
	ErrorMessage string        `json:"error_message" db:"error_message"`
}

type FileType

type FileType int
const (
	UNKNOWN FileType = iota
	MP4
	AVI
	MPEG
	MOV
	FLV
	WEBM
	MKV
)

func GetFileType

func GetFileType(fileName string) FileType

type ProcessStatus

type ProcessStatus int
const (
	CREATED ProcessStatus = iota
	STARTED
	FINISHED
	ERROR
)

type ResizeProcess

type ResizeProcess struct {
	Total   int
	Current int
}

type ResizedImg

type ResizedImg struct {
	Path string `json:"-"`
	Name string `json:"-"`
}

type SizeCoefficient

type SizeCoefficient struct {
	Coef float64
	W    uint
	H    uint
}

type UploadedFile

type UploadedFile struct {
	Path         string   `json:"path,omitempty"`
	Name         string   `json:"name,omitempty"`
	KiloByteSize int64    `json:"kilo_byte_size,omitempty"`
	Error        string   `json:"error"`
	IsError      bool     `json:"is_error"`
	Type         FileType `json:"file_type",omitempty`
	PrevImage    string   `json:"prev_image"`
}

type User

type User struct {
	Id   int       `json:"-" db:"id"`
	Code uuid.UUID `json:"code" db:"code" binding:"required"`
}

type VideoConvertData

type VideoConvertData struct {
	UserCode     string   `json:"user_code"`
	Path         string   `json:"path"`
	TargetFormat FileType `json:"target_format"`
}

func (VideoConvertData) Validate

func (t VideoConvertData) Validate() error

type Width

type Width struct {
	Width      int
	SizeFields []SizeCoefficient
}

type WidthList

type WidthList struct {
	List  []Width
	Total int
}

Jump to

Keyboard shortcuts

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