xivapi

package
v0.0.0-...-1095df5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 11, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Mutex sync.Mutex

We don't want users to create a new mutex every time.

View Source
var UpdatedPricesStructTime = int64(1563240349) // Last Update : 7/15/19 - 6:26PM
View Source
var UpdatedProfitsStructTime = int64(1563261129) // Last Update : 7/16/19 - 12:12AM
View Source
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 Information struct {
	Recipes *models.Recipes
	Prices  *models.SimplePrices
	Profits *models.Profits
}

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
}

type ProfitHandler

type ProfitHandler interface {
	ProfitDescCursor() []*models.Profits
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL