Documentation ¶
Index ¶
- Variables
- func AddUserInfoToMap(newUserStorage *UserItemStorage, UserSubmission *models.UserSubmission)
- func BaseInformation(collections CollectionHandler, recipeID int, info InnerInformation)
- type CollectionHandler
- type Collections
- type Info
- type Information
- type InnerInformation
- type UserItemStorage
- type UserStorageCollection
- func (coll UserStorageCollection) AddUserItem(userItemStorage *UserItemStorage, userID string, ...)
- func (coll UserStorageCollection) DeleteUserItem(userID string)
- func (coll UserStorageCollection) FindUserItemStorage(userID string) *UserItemStorage
- func (coll UserStorageCollection) InsertNewUserItemStorage(UserSubmission *models.UserSubmission, userID string)
- type UserStorageCollectionHandler
Constants ¶
This section is empty.
Variables ¶
var Mutex sync.Mutex
Mutex is a global lock, that locks can lock all new client threads.
Functions ¶
func AddUserInfoToMap ¶
func AddUserInfoToMap(newUserStorage *UserItemStorage, UserSubmission *models.UserSubmission)
AddUserInfoToMap places all the UserSubmission into a user's storage document.
func BaseInformation ¶
func BaseInformation(collections CollectionHandler, recipeID int, info InnerInformation)
BaseInformation uses recursion to fill the Information maps and inner information. A recipe w/ len(IngredientRecipes) = 0, should be at the top of the stack. Will handle if there are no items in the xivapi. Will also handle struct updates, if you've updated the struct times ontop of xivapi.go.
Types ¶
type CollectionHandler ¶
type CollectionHandler interface { FindRecipesDocument(recipeID int) (*models.Recipes, bool) InsertRecipesDocument(recipeID int) *models.Recipes }
CollectionHandler has the methods for a specific mongo collection.
type Collections ¶
type Collections struct {
Recipes *mongo.Collection
}
Collections just holds our Recipe Collection in the database, that has a few methods.
func (Collections) FindRecipesDocument ¶
func (coll Collections) FindRecipesDocument(recipeID int) (*models.Recipes, bool)
FindRecipesDocument will return false if there's no recipe in the xivapi.
func (Collections) InsertRecipesDocument ¶
func (coll Collections) InsertRecipesDocument(recipeID int) *models.Recipes
InsertRecipesDocument will insert a document, or update it if it's already in the collection.
type Info ¶
type Info struct { *Information *InnerInformation }
Info stores both Information and InnerInformation into one object
type Information ¶
Information holds all of our Recipes, obtained from the recipe collection.
type InnerInformation ¶
InnerInformation contains the inner recipes for some [key] = recipe ID
type UserItemStorage ¶
type UserItemStorage struct { UserID string Prices map[string]models.UserPrices Profits map[string]models.UserProfits }
UserItemStorage is an object that holds for a specific UserID, all their posted prices and profits.
type UserStorageCollection ¶
type UserStorageCollection struct {
*mongo.Collection
}
UserStorageCollection stores a user's storage collection from the database, with a few methods.
func (UserStorageCollection) AddUserItem ¶
func (coll UserStorageCollection) AddUserItem(userItemStorage *UserItemStorage, userID string, UserSubmission *models.UserSubmission)
AddUserItem adds to the user storage and update it.
func (UserStorageCollection) DeleteUserItem ¶
func (coll UserStorageCollection) DeleteUserItem(userID string)
DeleteUserItem removes an user's item storage permanently.
func (UserStorageCollection) FindUserItemStorage ¶
func (coll UserStorageCollection) FindUserItemStorage(userID string) *UserItemStorage
FindUserItemStorage finds all items that are stored in the User's Document
func (UserStorageCollection) InsertNewUserItemStorage ¶
func (coll UserStorageCollection) InsertNewUserItemStorage(UserSubmission *models.UserSubmission, userID string)
InsertNewUserItemStorage creates a new UserItem storage if a user does not exist in the database.
type UserStorageCollectionHandler ¶
type UserStorageCollectionHandler interface { FindUserItemStorage(userID string) *UserItemStorage InsertNewUserItemStorage(UserSubmission *models.UserSubmission, userID string) AddUserItem(userItemStorage *UserItemStorage, userID string, UserSubmission *models.UserSubmission) }
UserStorageCollectionHandler handles the user storage.