diff --git a/arn/Inventory.go b/arn/Inventory.go index f580ed64..47164bb1 100644 --- a/arn/Inventory.go +++ b/arn/Inventory.go @@ -62,6 +62,11 @@ func (inventory *Inventory) SwapSlots(a, b int) error { return nil } +// GetID returns the ID. +func (inventory *Inventory) GetID() string { + return inventory.UserID +} + // NewInventory creates a new inventory with the default number of slots. func NewInventory(userID UserID) *Inventory { inventory := &Inventory{ diff --git a/arn/InventoryAPI.go b/arn/InventoryAPI.go index a8c455b5..465a1c72 100644 --- a/arn/InventoryAPI.go +++ b/arn/InventoryAPI.go @@ -7,6 +7,11 @@ import ( "github.com/aerogo/api" ) +// Force interface implementations +var ( + _ Identifiable = (*Inventory)(nil) +) + // Actions func init() { API.RegisterActions("Inventory", []*api.Action{ diff --git a/arn/NickToUser.go b/arn/NickToUser.go index d941c79d..8d666fc5 100644 --- a/arn/NickToUser.go +++ b/arn/NickToUser.go @@ -5,3 +5,8 @@ type NickToUser struct { Nick string `json:"nick" primary:"true"` UserID UserID `json:"userId"` } + +// GetID returns the primary key which is the nickname. +func (mapping *NickToUser) GetID() string { + return mapping.Nick +} diff --git a/arn/ShopItemAPI.go b/arn/ShopItemAPI.go index 8a770fdf..0a6b216c 100644 --- a/arn/ShopItemAPI.go +++ b/arn/ShopItemAPI.go @@ -1,5 +1,10 @@ package arn +// Force interface implementations +var ( + _ Identifiable = (*ShopItem)(nil) +) + // Save saves the item in the database. func (item *ShopItem) Save() { DB.Set("ShopItem", item.ID, item)