v0.0.0-...-8375e82 Latest Latest

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

Go to latest
Published: Jan 21, 2016 License: Apache-2.0 Imports: 21 Imported by: 0



gmfs storage, use mongodb



This section is empty.


This section is empty.


func ExistBlacklist

func ExistBlacklist(session *mgo.Session, fileMd5 string, fileSize int) (*model.Blacklist, error)


  • 根据 md5,length
  • 查询文件是否存在黑名单中

func FindInfoById

func FindInfoById(session *mgo.Session, id string) (*model.Info, *mgo.GridFile, error)


  • 根据 id
  • 查询文件

func ImageToPaletted

func ImageToPaletted(img image.Image) *image.Paletted

func ProcessImage

func ProcessImage(img image.Image, width, hight uint) image.Image


  • 执行图片剪切

func ResizeGif

func ResizeGif(ctx *ink.Context, r io.Reader, rs bool, width, hight uint) *bytes.Buffer


  • 转换GIF图片

func ResizeImage

func ResizeImage(ctx *ink.Context, gf *mgo.GridFile, b bool, w, h uint) *bytes.Buffer


  • 转换静态图片

func SaveFile

func SaveFile(ctx *ink.Context, session *mgo.Session, data []byte, fileSuffix, filetype string) (string, string, error)


  • 保存文件

func SaveImage

func SaveImage(ctx *ink.Context, session *mgo.Session, data []byte) (string, string, bool, error)


  • 保存图片

func SearchExist

func SearchExist(session *mgo.Session, fileMd5 string, fileSize int) (*model.Info, error)


  • 秒传根据 md5,length
  • 查询文件信息

func UpdateInfoOnline

func UpdateInfoOnline(session *mgo.Session, id, rdm string) error


  • 文件转正


type MgoStorage

type MgoStorage struct {
	// mongo collection where the cache will be stored
	Collection *mgo.Collection

MgoStorage objects store and retrieve data using Mongo.

func NewMgoStorage

func NewMgoStorage(collection *mgo.Collection) *MgoStorage

New returns a new MgoStorage

func (*MgoStorage) Delete

func (self *MgoStorage) Delete(key string)

func (*MgoStorage) Get

func (self *MgoStorage) Get(key string) (resp []byte, ok bool)

func (*MgoStorage) Indexes

func (self *MgoStorage) Indexes()

func (*MgoStorage) Set

func (self *MgoStorage) Set(key string, content []byte)


Path Synopsis

Jump to

Keyboard shortcuts

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