Documentation ¶
Index ¶
- Variables
- func BaseInformation(collections CollectionHandler, recipeID int, info InnerInformation)
- func FillProfitsDocument(recipeID int, info InnerInformation) *models.Profits
- func ProfitInformation(profit ProfitHandler) []*models.Profits
- type CollectionHandler
- type Collections
- func (coll Collections) FindPricesDocument(itemID int) (*models.Prices, bool)
- func (coll Collections) FindProfitsDocument(recipeID int) (*models.Profits, bool)
- func (coll Collections) FindRecipesDocument(recipeID int) (*models.Recipes, bool)
- func (coll Collections) InsertPricesDocument(itemID int) *models.Prices
- func (coll Collections) InsertProfitsDocument(profits *models.Profits)
- func (coll Collections) InsertRecipesDocument(recipeID int) *models.Recipes
- func (coll Collections) ProfitDescCursor() []*models.Profits
- func (coll Collections) SimplifyPricesDocument(itemID int) (*models.SimplePrices, bool)
- type Information
- type InnerInformation
- type ProfitHandler
Constants ¶
This section is empty.
Variables ¶
var Mutex sync.Mutex
We don't want users to create a new mutex every time.
var UpdatedPricesStructTime = int64(1563240349) // Last Update : 7/15/19 - 6:26PM
var UpdatedProfitsStructTime = int64(1563261129) // Last Update : 7/16/19 - 12:12AM
var UpdatedRecipesStructTime = int64(1563260451) // Last Update : 7/16/19 - 12:01AM
We want to separate the times, just in case we only update one struct. Changing these times will allow us to just update our entries accordingly if the structs have been changed.
Functions ¶
func BaseInformation ¶
func BaseInformation(collections CollectionHandler, recipeID int, info InnerInformation)
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 database. Will also handle struct updates, if you've updated the struct times ontop of xivapi.go.
func FillProfitsDocument ¶
func FillProfitsDocument(recipeID int, info InnerInformation) *models.Profits
Uses the Recipes and Prices from Information, and returns a Profit model. Will require profits from the map if the recipe depends on recipes.
func ProfitInformation ¶
func ProfitInformation(profit ProfitHandler) []*models.Profits
Types ¶
type CollectionHandler ¶
type CollectionHandler interface { FindRecipesDocument(recipeID int) (*models.Recipes, bool) FindPricesDocument(itemID int) (*models.Prices, bool) FindProfitsDocument(recipeID int) (*models.Profits, bool) SimplifyPricesDocument(recipeID int) (*models.SimplePrices, bool) InsertRecipesDocument(recipeID int) *models.Recipes InsertPricesDocument(itemID int) *models.Prices InsertProfitsDocument(profits *models.Profits) }
type Collections ¶
type Collections struct { Prices *mongo.Collection Recipes *mongo.Collection Profits *mongo.Collection }
func (Collections) FindPricesDocument ¶
func (coll Collections) FindPricesDocument(itemID int) (*models.Prices, bool)
func (Collections) FindProfitsDocument ¶
func (coll Collections) FindProfitsDocument(recipeID int) (*models.Profits, bool)
This is used for stronger analysis functions, where we want to see trends etc.
func (Collections) FindRecipesDocument ¶
func (coll Collections) FindRecipesDocument(recipeID int) (*models.Recipes, bool)
Will return false if there's no recipe in the database.
func (Collections) InsertPricesDocument ¶
func (coll Collections) InsertPricesDocument(itemID int) *models.Prices
func (Collections) InsertProfitsDocument ¶
func (coll Collections) InsertProfitsDocument(profits *models.Profits)
func (Collections) InsertRecipesDocument ¶
func (coll Collections) InsertRecipesDocument(recipeID int) *models.Recipes
Will insert a document, or update it if it's already in the collection.
func (Collections) ProfitDescCursor ¶
func (coll Collections) ProfitDescCursor() []*models.Profits
Gives a Descending Sorted Array, of 20 items with the most profit from the DB
func (Collections) SimplifyPricesDocument ¶
func (coll Collections) SimplifyPricesDocument(itemID int) (*models.SimplePrices, bool)
This is used for quick and easy prices
type Information ¶
type InnerInformation ¶
type InnerInformation struct { Recipes map[int]*models.Recipes // Contains the inner recipes for some key = Recipe.ID Prices map[int]*models.SimplePrices // Contains the inner prices for some key = Item ID Profits map[int]*models.Profits // Contains the profits for the inner recipes for some key = Recipe.Id }