Documentation ¶
Overview ¶
Description: 使用ffmpeg,用于对视频截取封面
Function: 已经实现的功能
GetSnapshot() --- 截取第一帧作为视频的封面返回
Author: sangs
Date: 2023-08-22
Description: 用于登录后的jwt鉴权,内部实现了jwt的编解码
Function: 已经实现的功能
GenerateToken() --- 对id进行JWT编码
ParseToken() ------ 对JWT进行解码,并解析可能的错误
Author: sangs
Date: 2023-08-20
Description: Minio对象存储
Function: 已经实现的功能
MakeBucket() --- 创建Bucket
PutToBucket() -- 将服务器接收到的[]byte 文件存入Bucket中
InitMinio() ---- 初始化Minio,在项目main函数中调用
GetFileURL() --- 通过bucket和filename(有文件类型后缀),返回完整的URL
Author: sangs
Date: 2023-08-21
Index ¶
- Variables
- func ClientMiddleware(next endpoint.Endpoint) endpoint.Endpoint
- func CommonMiddleware(next endpoint.Endpoint) endpoint.Endpoint
- func GenerateToken(id int64) (string, error)
- func GetFileURL(ctx context.Context, bucketName string, fileName string) (fullURL string, err error)
- func GetSnapshot(videoPath string) (buf *bytes.Buffer, err error)
- func MakeBucket(ctx context.Context, bucketName string)
- func PutToBucket(ctx context.Context, bucketName string, file []byte, filename string, ...) (info minio.UploadInfo, err error)
- func PutToBucketByBuf(ctx context.Context, bucketName, filename string, buf *bytes.Buffer) (info minio.UploadInfo, err error)
- func PutToBucketByFilePath(ctx context.Context, bucketName, filename, filepath string) (info minio.UploadInfo, err error)
- func ServerMiddleware(next endpoint.Endpoint) endpoint.Endpoint
- type Claims
Constants ¶
This section is empty.
Variables ¶
var (
Client *minio.Client
)
Functions ¶
func ClientMiddleware ¶
ClientMiddleware client middleware print server address 、rpc timeout and connection timeout
func CommonMiddleware ¶
CommonMiddleware common middleware print some rpc info、real request and real response
func GetFileURL ¶
func GetFileURL(ctx context.Context, bucketName string, fileName string) (fullURL string, err error)
* Description: 根据bucket和文件名(带文件类型后缀),返回完整的URL * Author: sangs * Date: 2023-08-22>
func GetSnapshot ¶
* Description: 将视频的第一帧作为截取下来作为图片返回 * Author: sangs * Date: 2023-08-22
func MakeBucket ¶
* Description: 创建Bucket,用于存储视频,一般在 Init 的时候调用即可 * Author: sangs * Date: 2023-08-21
func PutToBucket ¶
func PutToBucket(ctx context.Context, bucketName string, file []byte, filename string, filetype string) (info minio.UploadInfo, err error)
* Description: 将[]byte 格式的文件放入Bucket中 * Author: sangs * Date: 2023-08-21
func PutToBucketByBuf ¶
func PutToBucketByBuf(ctx context.Context, bucketName, filename string, buf *bytes.Buffer) (info minio.UploadInfo, err error)
PutToBucketByBuf put the file into the bucket by *bytes.Buffer
Types ¶
type Claims ¶
type Claims struct { UserId int64 `json:"id"` // 为了避免和StandardClaims搞混 jwt.StandardClaims // 七个默认字段 }