Last active
March 14, 2017 12:04
-
-
Save eamonnmcevoy/789bf62664373a5779710e879c34441c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package mongo | |
import ( | |
"gopkg.in/mgo.v2" | |
"gopkg.in/mgo.v2/bson" | |
"go_rest_api/pkg" | |
) | |
type UserService struct { | |
collection *mgo.Collection | |
} | |
func NewUserService(session *Session, dbName string, collectionName string) *UserService { | |
collection := session.GetCollection(dbName, collectionName) | |
collection.EnsureIndex(userModelIndex()) | |
return &UserService {collection} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment