add CreatePlanet and put planet in solar system

This commit is contained in:
arnaucube
2019-06-13 22:41:47 +02:00
parent 0cd29328b4
commit 5965f2dec1
11 changed files with 141 additions and 45 deletions

View File

@@ -3,9 +3,10 @@ package database
import mgo "gopkg.in/mgo.v2"
type Db struct {
Users *mgo.Collection
Planets *mgo.Collection
Galaxies *mgo.Collection
Users *mgo.Collection
Planets *mgo.Collection
SolarSystems *mgo.Collection
Galaxies *mgo.Collection
}
func New(url string, databaseName string) (*Db, error) {
@@ -24,6 +25,7 @@ func New(url string, databaseName string) (*Db, error) {
db := Db{}
db.Users = session.DB(databaseName).C("users")
db.Planets = session.DB(databaseName).C("planets")
db.SolarSystems = session.DB(databaseName).C("solarsystems")
db.Galaxies = session.DB(databaseName).C("galaxies")
return &db, nil