mongodb/adapter: implement DestroyTable
This commit is contained in:
parent
11d6463f62
commit
07d797e1df
1 changed files with 35 additions and 0 deletions
|
@ -99,6 +99,26 @@ func (self *DbEngine) CreateTable(table models.TableKey) error {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (self *DbEngine) DestroyTable(table models.TableKey) error {
|
||||||
|
tables := self.db.Collection("tables")
|
||||||
|
if tables != nil {
|
||||||
|
_, err := tables.DeleteOne(self.mkCtx(10), bson.D{
|
||||||
|
{"name", table.Name},
|
||||||
|
{"passcode", table.Passcode},
|
||||||
|
})
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return errors.New(fmt.Sprintf(errNoCollection, "tables"))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (self *DbEngine) InsertDiceRoll(table models.TableKey, diceRoll models.DiceRoll) error {
|
||||||
|
return errors.New(fmt.Sprintf(errNoCollections, "tables"))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (self *DbEngine) GetDiceRolls(table models.TableKey) ([]models.DiceRoll, error) {
|
||||||
|
return []models.DiceRoll{}, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (self *DbEngine) SetMapImageUrl(table models.TableKey, url string) error {
|
func (self *DbEngine) SetMapImageUrl(table models.TableKey, url string) error {
|
||||||
tables := self.db.Collection("tables")
|
tables := self.db.Collection("tables")
|
||||||
if tables != nil {
|
if tables != nil {
|
||||||
|
@ -142,3 +162,18 @@ func (self *DbEngine) GetMapImageUrl(table models.TableKey) (string, error) {
|
||||||
|
|
||||||
return "", errors.New(fmt.Sprintf(errNoCollection, "tables"))
|
return "", errors.New(fmt.Sprintf(errNoCollection, "tables"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (self *DbEngine) AddToken(table models.TableKey, token models.Token) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (self *DbEngine) RemoveToken(table models.TableKey, tokenId string) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (self *DbEngine) ModifyToken(table models.TableKey, token models.Token) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (self *DbEngine) GetTokens(table models.TableKey) ([]models.Token, error) {
|
||||||
|
return []models.Token{}, nil
|
||||||
|
}
|
Loading…
Reference in a new issue