From 089eb8ad3900d6e61343d6606f094a2ffe9b0a9e Mon Sep 17 00:00:00 2001 From: yanyiwu Date: Fri, 26 Dec 2014 13:29:44 +0800 Subject: [PATCH] add String function for needle to print --- go/storage/needle.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/go/storage/needle.go b/go/storage/needle.go index aa3206920..5b4357614 100644 --- a/go/storage/needle.go +++ b/go/storage/needle.go @@ -3,6 +3,7 @@ package storage import ( "encoding/hex" "errors" + "fmt" "io/ioutil" "mime" "net/http" @@ -45,6 +46,11 @@ type Needle struct { Padding []byte `comment:"Aligned to 8 bytes"` } +func (n *Needle) String() (str string) { + str = fmt.Sprintf("Cookie:%d, Id:%d, Size:%d, DataSize:%d, Name: %s, Mime: %s", n.Cookie, n.Id, n.Size, n.DataSize, n.Name, n.Mime) + return +} + func ParseUpload(r *http.Request) (fileName string, data []byte, mimeType string, isGzipped bool, modifiedTime uint64, ttl *TTL, e error) { form, fe := r.MultipartReader() if fe != nil {