eveuniverseservice

package
v0.66.0 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: MIT Imports: 27 Imported by: 0

Documentation

Overview

Package eveuniverseservice contains EVE universe service.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EVEUniverseService added in v0.63.0

type EVEUniverseService struct {
	// Now returns the current time in UTC. Can be overwritten for tests.
	Now func() time.Time
	// contains filtered or unexported fields
}

EVEUniverseService provides access to EVE Online models with on-demand loading from ESI and persistent local caching.

func New

func New(arg Params) *EVEUniverseService

New returns a new instance of an Eve universe service.

func (*EVEUniverseService) AddMissingEntities added in v0.63.0

func (s *EVEUniverseService) AddMissingEntities(ctx context.Context, ids set.Set[int64]) (set.Set[int64], error)

AddMissingEntities adds EveEntities from ESI for IDs missing in the database and returns which IDs where indeed missing.

ID 0 will be ignored

func (*EVEUniverseService) AddMissingEveEntitiesAndLocations added in v0.63.0

func (s *EVEUniverseService) AddMissingEveEntitiesAndLocations(ctx context.Context, entityIDs set.Set[int64], locationIDs set.Set[int64]) error

func (*EVEUniverseService) AddMissingLocations added in v0.63.0

func (s *EVEUniverseService) AddMissingLocations(ctx context.Context, ids set.Set[int64]) error

AddMissingLocations adds missing EveLocations from ESI. Invalid IDs (e.g. ID 0) will be ignored.

func (*EVEUniverseService) AddMissingRegions added in v0.63.0

func (s *EVEUniverseService) AddMissingRegions(ctx context.Context, ids set.Set[int64]) error

AddMissingRegions fetches missing regions from ESI. Invalid IDs (e.g. 0) will be ignored

func (*EVEUniverseService) AddMissingSolarSystems added in v0.63.0

func (s *EVEUniverseService) AddMissingSolarSystems(ctx context.Context, ids set.Set[int64]) error

AddMissingSolarSystems fetches missing solar systems from ESI. Invalid IDs (e.g. 0) will be ignored

func (*EVEUniverseService) AddMissingTypes added in v0.63.0

func (s *EVEUniverseService) AddMissingTypes(ctx context.Context, ids set.Set[int64]) error

AddMissingTypes fetches missing typeIDs from ESI. Invalid IDs (e.g. 0) will be ignored

func (*EVEUniverseService) EntityIDsFromLocationsESI added in v0.63.0

func (s *EVEUniverseService) EntityIDsFromLocationsESI(ctx context.Context, ids []int64) (set.Set[int64], error)

EntityIDsFromLocationsESI returns the EveEntity IDs in EveLocation ids from ESI. This methods allows bulk resolving EveEntities before fetching many new locations from ESI.

func (*EVEUniverseService) FetchAlliance added in v0.63.0

func (s *EVEUniverseService) FetchAlliance(ctx context.Context, allianceID int64) (*app.EveAlliance, error)

FetchAlliance fetches an alliance from ESI and returns it.

func (*EVEUniverseService) FetchAllianceCorporations added in v0.63.0

func (s *EVEUniverseService) FetchAllianceCorporations(ctx context.Context, allianceID int64) ([]*app.EveEntity, error)

FetchAllianceCorporations fetches the corporations for an alliance from ESI and returns them.

func (*EVEUniverseService) FetchCharacterCorporationHistory added in v0.63.0

func (s *EVEUniverseService) FetchCharacterCorporationHistory(ctx context.Context, characterID int64) ([]app.MembershipHistoryItem, error)

FetchCharacterCorporationHistory returns a list of all the corporations a character has been a member of in descending order.

func (*EVEUniverseService) FetchCorporationAllianceHistory added in v0.63.0

func (s *EVEUniverseService) FetchCorporationAllianceHistory(ctx context.Context, corporationID int64) ([]app.MembershipHistoryItem, error)

FetchCorporationAllianceHistory returns a list of all the alliances a corporation has been a member of in descending order.

func (*EVEUniverseService) FetchRoute added in v0.63.0

FetchRoute fetches a route between two solar systems from ESi and returns it. When no route can be found it returns an empty slice.

func (*EVEUniverseService) FetchRoutes added in v0.63.0

func (s *EVEUniverseService) FetchRoutes(ctx context.Context, headers []app.EveRouteHeader) (map[app.EveRouteHeader][]*app.EveSolarSystem, error)

FetchRoutes returns routes for one or multiple headers.

func (*EVEUniverseService) FormatDogmaValue added in v0.63.0

func (s *EVEUniverseService) FormatDogmaValue(ctx context.Context, value float64, unitID app.EveUnitID) (string, int64)

FormatDogmaValue returns a formatted value.

func (*EVEUniverseService) GetCharacterESI added in v0.63.0

func (s *EVEUniverseService) GetCharacterESI(ctx context.Context, characterID int64) (*app.EveCharacter, error)

func (*EVEUniverseService) GetConstellationSolarSystemsESI added in v0.63.0

func (s *EVEUniverseService) GetConstellationSolarSystemsESI(ctx context.Context, id int64) ([]*app.EveSolarSystem, error)

GetConstellationSolarSystemsESI fetches and returns the solar systems for a constellations from ESI.

func (*EVEUniverseService) GetCorporation added in v0.63.0

func (s *EVEUniverseService) GetCorporation(ctx context.Context, corporationID int64) (*app.EveCorporation, error)

func (*EVEUniverseService) GetDogmaAttribute added in v0.63.0

func (s *EVEUniverseService) GetDogmaAttribute(ctx context.Context, id int64) (*app.EveDogmaAttribute, error)

func (*EVEUniverseService) GetEntity added in v0.63.0

func (s *EVEUniverseService) GetEntity(ctx context.Context, id int64) (*app.EveEntity, error)

func (*EVEUniverseService) GetLocation added in v0.63.0

func (s *EVEUniverseService) GetLocation(ctx context.Context, id int64) (*app.EveLocation, error)

func (*EVEUniverseService) GetOrCreateCategoryESI added in v0.63.0

func (s *EVEUniverseService) GetOrCreateCategoryESI(ctx context.Context, id int64) (*app.EveCategory, error)

func (*EVEUniverseService) GetOrCreateCharacterESI added in v0.63.0

func (s *EVEUniverseService) GetOrCreateCharacterESI(ctx context.Context, characterID int64) (*app.EveCharacter, bool, error)

func (*EVEUniverseService) GetOrCreateConstellationESI added in v0.63.0

func (s *EVEUniverseService) GetOrCreateConstellationESI(ctx context.Context, id int64) (*app.EveConstellation, error)

func (*EVEUniverseService) GetOrCreateCorporationESI added in v0.63.0

func (s *EVEUniverseService) GetOrCreateCorporationESI(ctx context.Context, id int64) (*app.EveCorporation, error)

func (*EVEUniverseService) GetOrCreateDogmaAttributeESI added in v0.63.0

func (s *EVEUniverseService) GetOrCreateDogmaAttributeESI(ctx context.Context, id int64) (*app.EveDogmaAttribute, error)

func (*EVEUniverseService) GetOrCreateEntityESI added in v0.63.0

func (s *EVEUniverseService) GetOrCreateEntityESI(ctx context.Context, id int64) (*app.EveEntity, error)

func (*EVEUniverseService) GetOrCreateGroupESI added in v0.63.0

func (s *EVEUniverseService) GetOrCreateGroupESI(ctx context.Context, id int64) (*app.EveGroup, error)

func (*EVEUniverseService) GetOrCreateLocationESI added in v0.63.0

func (s *EVEUniverseService) GetOrCreateLocationESI(ctx context.Context, id int64) (*app.EveLocation, error)

GetOrCreateLocationESI return a location. When the location does not yet exist in storage it tries to fetch and create a new location from ESI.

Important: For creating structures a valid token with the structure scope must be set in the context or an error will be returned

func (*EVEUniverseService) GetOrCreateMoonESI added in v0.63.0

func (s *EVEUniverseService) GetOrCreateMoonESI(ctx context.Context, id int64) (*app.EveMoon, error)

func (*EVEUniverseService) GetOrCreatePlanetESI added in v0.63.0

func (s *EVEUniverseService) GetOrCreatePlanetESI(ctx context.Context, id int64) (*app.EvePlanet, error)

func (*EVEUniverseService) GetOrCreateRaceESI added in v0.63.0

func (s *EVEUniverseService) GetOrCreateRaceESI(ctx context.Context, id int64) (*app.EveRace, error)

func (*EVEUniverseService) GetOrCreateRegionESI added in v0.63.0

func (s *EVEUniverseService) GetOrCreateRegionESI(ctx context.Context, id int64) (*app.EveRegion, error)

func (*EVEUniverseService) GetOrCreateSchematicESI added in v0.63.0

func (s *EVEUniverseService) GetOrCreateSchematicESI(ctx context.Context, id int64) (*app.EveSchematic, error)

func (*EVEUniverseService) GetOrCreateSolarSystemESI added in v0.63.0

func (s *EVEUniverseService) GetOrCreateSolarSystemESI(ctx context.Context, id int64) (*app.EveSolarSystem, error)

func (*EVEUniverseService) GetOrCreateTypeESI added in v0.63.0

func (s *EVEUniverseService) GetOrCreateTypeESI(ctx context.Context, id int64) (*app.EveType, error)

func (*EVEUniverseService) GetRegionConstellationsESI added in v0.63.0

func (s *EVEUniverseService) GetRegionConstellationsESI(ctx context.Context, id int64) ([]*app.EveEntity, error)

GetRegionConstellationsESI fetches and returns the constellations for a region.

func (*EVEUniverseService) GetSolarSystemInfoESI added in v0.63.0

func (s *EVEUniverseService) GetSolarSystemInfoESI(ctx context.Context, solarSystemID int64) (starID optional.Optional[int64], planets []app.EveSolarSystemPlanet, stargateIDs []int64, stations []*app.EveEntity, structures []*app.EveLocation, err error)

GetSolarSystemInfoESI fetches and returns details about a solar system from ESI.

func (*EVEUniverseService) GetSolarSystemPlanets added in v0.63.0

func (s *EVEUniverseService) GetSolarSystemPlanets(ctx context.Context, planets []app.EveSolarSystemPlanet) ([]*app.EvePlanet, error)

GetSolarSystemPlanets fetches and returns the planets for a solar system from ESI.

func (*EVEUniverseService) GetStarTypeID added in v0.63.0

func (s *EVEUniverseService) GetStarTypeID(ctx context.Context, id int64) (int64, error)

func (*EVEUniverseService) GetStargatesSolarSystemsESI added in v0.63.0

func (s *EVEUniverseService) GetStargatesSolarSystemsESI(ctx context.Context, stargateIDs []int64) ([]*app.EveSolarSystem, error)

GetStargatesSolarSystemsESI fetches and returns the solar systems which relates to given stargates from ESI.

func (*EVEUniverseService) GetStationServicesESI added in v0.63.0

func (s *EVEUniverseService) GetStationServicesESI(ctx context.Context, id int64) ([]string, error)

GetStationServicesESI fetches and returns the services of a station from ESI.

func (*EVEUniverseService) GetType added in v0.63.0

func (s *EVEUniverseService) GetType(ctx context.Context, id int64) (*app.EveType, error)

func (*EVEUniverseService) HasSection added in v0.63.0

func (s *EVEUniverseService) HasSection(ctx context.Context, section app.EveUniverseSection) (bool, error)

HasSection reports whether a section exists at all.

func (*EVEUniverseService) ListEntitiesByPartialName added in v0.63.0

func (s *EVEUniverseService) ListEntitiesByPartialName(ctx context.Context, partial string) ([]*app.EveEntity, error)

func (*EVEUniverseService) ListEntitiesForIDs added in v0.63.0

func (s *EVEUniverseService) ListEntitiesForIDs(ctx context.Context, ids []int64) ([]*app.EveEntity, error)

func (*EVEUniverseService) ListGroupsForCategory added in v0.63.0

func (s *EVEUniverseService) ListGroupsForCategory(ctx context.Context, categoryID int64) ([]*app.EveGroup, error)

func (*EVEUniverseService) ListLocations added in v0.63.0

func (s *EVEUniverseService) ListLocations(ctx context.Context) ([]*app.EveLocation, error)

func (*EVEUniverseService) ListSkillGroups added in v0.63.0

func (s *EVEUniverseService) ListSkillGroups(ctx context.Context) ([]*app.EveSkillGroup, error)

func (*EVEUniverseService) ListSkills added in v0.63.0

func (s *EVEUniverseService) ListSkills(ctx context.Context) ([]*app.EveSkill, error)

func (*EVEUniverseService) ListTypeDogmaAttributesForType added in v0.63.0

func (s *EVEUniverseService) ListTypeDogmaAttributesForType(ctx context.Context, typeID int64) ([]*app.EveTypeDogmaAttribute, error)

func (*EVEUniverseService) ListTypeIDs added in v0.63.0

func (s *EVEUniverseService) ListTypeIDs(ctx context.Context) (set.Set[int64], error)

func (*EVEUniverseService) MarketPrice added in v0.63.0

func (s *EVEUniverseService) MarketPrice(ctx context.Context, typeID int64) (optional.Optional[float64], error)

MarketPrice returns the average market price for a type. Or empty when no price is known for this type.

func (*EVEUniverseService) RandomizeAllAllianceNames added in v0.63.0

func (s *EVEUniverseService) RandomizeAllAllianceNames(ctx context.Context) error

RandomizeAllAllianceNames randomizes the names of all alliances.

func (*EVEUniverseService) RandomizeAllCorporationNames added in v0.63.0

func (s *EVEUniverseService) RandomizeAllCorporationNames(ctx context.Context) error

RandomizeAllCorporationNames randomizes the names of all characters.

func (*EVEUniverseService) StartUpdateTicker added in v0.63.0

func (s *EVEUniverseService) StartUpdateTicker(d time.Duration)

func (*EVEUniverseService) ToEntities added in v0.63.0

func (s *EVEUniverseService) ToEntities(ctx context.Context, ids set.Set[int64]) (map[int64]*app.EveEntity, error)

ToEntities returns the resolved EveEntities for a list of valid entity IDs. It guarantees a result for every ID and will map unknown IDs (including 0 & 1) to empty EveEntity objects.

func (*EVEUniverseService) UpdateAllCharactersESI added in v0.63.0

func (s *EVEUniverseService) UpdateAllCharactersESI(ctx context.Context) (set.Set[int64], error)

UpdateAllCharactersESI updates all known Eve characters from ESI and returns the IDs of all changed characters.

func (*EVEUniverseService) UpdateAllCorporationsESI added in v0.63.0

func (s *EVEUniverseService) UpdateAllCorporationsESI(ctx context.Context) (set.Set[int64], error)

UpdateAllCorporationsESI updates all known corporations from ESI.

func (*EVEUniverseService) UpdateAllEntitiesESI added in v0.63.0

func (s *EVEUniverseService) UpdateAllEntitiesESI(ctx context.Context) (set.Set[int64], error)

func (*EVEUniverseService) UpdateCategoryWithChildrenESI added in v0.63.0

func (s *EVEUniverseService) UpdateCategoryWithChildrenESI(ctx context.Context, categoryID int64) error

func (*EVEUniverseService) UpdateMarketPricesESI added in v0.63.0

func (s *EVEUniverseService) UpdateMarketPricesESI(ctx context.Context) (set.Set[int64], error)

UpdateMarketPricesESI updates all market prices from ESI and reports which have changed. Will only reports changes on prices for known types.

func (*EVEUniverseService) UpdateOrCreateCharacterESI added in v0.63.0

func (s *EVEUniverseService) UpdateOrCreateCharacterESI(ctx context.Context, characterID int64) (*app.EveCharacter, bool, error)

UpdateOrCreateCharacterESI updates or create a character from ESI. Returns the changed character when it was changed and reports whether it was changed. Returns app.ErrNotFound when the character does not exist.

func (*EVEUniverseService) UpdateOrCreateCorporationFromESI added in v0.63.0

func (s *EVEUniverseService) UpdateOrCreateCorporationFromESI(ctx context.Context, corporationID int64) (*app.EveCorporation, error)

func (*EVEUniverseService) UpdateOrCreateLocationESI added in v0.63.0

func (s *EVEUniverseService) UpdateOrCreateLocationESI(ctx context.Context, id int64) (*app.EveLocation, error)

UpdateOrCreateLocationESI tries to fetch and create a new location from ESI.

Important: For creating structures a valid token with the structure scope must be set in the context or an error will be returned

func (*EVEUniverseService) UpdateSectionAndRefreshIfNeeded added in v0.63.0

func (s *EVEUniverseService) UpdateSectionAndRefreshIfNeeded(ctx context.Context, section app.EveUniverseSection, forceUpdate bool)

func (*EVEUniverseService) UpdateSectionsIfNeeded added in v0.63.0

func (s *EVEUniverseService) UpdateSectionsIfNeeded(ctx context.Context, forceUpdate bool)

func (*EVEUniverseService) UpdateShipSkills added in v0.63.0

func (s *EVEUniverseService) UpdateShipSkills(ctx context.Context) error

type Params added in v0.24.0

type Params struct {
	ConcurrencyLimit   int // max number of concurrent Goroutines (per group)
	ESIClient          *esi.APIClient
	Signals            *app.Signals
	StatusCacheService StatusCache
	Storage            *storage.Storage
}

type StatusCache added in v0.63.0

type StatusCache interface {
	SetEveUniverseSection(o *app.EveUniverseSectionStatus)
	UpdateCorporations(ctx context.Context, st statuscache.Storage) error
}

Jump to

Keyboard shortcuts

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