github.com/aarzilli/tools@v0.0.0-20151123112009-0d27094f75e0/appengine/blobstore_mgt/common.go (about) 1 // Package blobstore_mgt allows changing, listing and viewing 2 // binary files to app engine; app engine allows only mediated access. 3 package blobstore_mgt 4 5 import ( 6 "bytes" 7 "fmt" 8 "time" 9 10 "github.com/pbberlin/tools/stringspb" 11 12 "appengine" 13 ) 14 15 type BlobInfo struct { 16 BlobKey appengine.BlobKey 17 ContentType string `datastore:"content_type"` 18 CreationTime time.Time `datastore:"creation"` 19 Filename string `datastore:"filename"` 20 MD5 string `datastore:"md5_hash"` 21 Size int64 `datastore:"size"` 22 Upload_id string `datastore:"upload_id"` 23 ObjectName string `datastore:"gs_object_name"` 24 } 25 26 func (bi BlobInfo) String() string { 27 28 b1 := new(bytes.Buffer) 29 b1.WriteString("FN: " + stringspb.LowerCasedUnderscored(bi.Filename)) 30 b1.WriteString(" Type: " + bi.ContentType) 31 b1.WriteString(" " + fmt.Sprintf("%v", bi.Size/1024) + "KB") 32 b1.WriteString(" BlobKey:" + fmt.Sprintf("%v", bi.BlobKey)) 33 34 return b1.String() 35 36 }