Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // DB is the current mongo database connection DB *mgo.Database // Collection is the only collection that we use with mongo (hippos ATM) Collection *mgo.Collection // GridFS is were we store our images in Mongo GridFS *mgo.GridFS )
Functions ¶
Types ¶
type Hippo ¶
type Hippo struct { ID bson.ObjectId `bson:"_id"json:"id"` Filename string `json:"-"` URL string `json:"url"` Verified bool `json:"verified"` Votes int `json:"votes"` // Weird way of getting a random doc, but: // http://cookbook.mongodb.org/patterns/random-attribute/ Random float32 `json:"-"` }
Hippo is the struct used to store the information that we save in mongo and we return to the user in JSON format
func GetHippoByMD5 ¶
checks if there's an entry with the received MD5 if there's it returns the Hippo
func InsertHippo ¶
InsertHippo will store the Hippo on GridFS and return the Hippo document created
Click to show internal directories.
Click to hide internal directories.