storage

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 4, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("object not found")

Functions

func InitDB

func InitDB(dsn string) (*sql.DB, error)

InitDB initializes the database and returns it.

Types

type CreateEveCharacterParams

type CreateEveCharacterParams struct {
	ID             int32
	AllianceID     int32
	Birthday       time.Time
	CorporationID  int32
	Description    string
	FactionID      int32
	Gender         string
	Name           string
	RaceID         int32
	SecurityStatus float64
	Title          string
}

type CreateMailParams

type CreateMailParams struct {
	Body          string
	MyCharacterID int32
	FromID        int32
	LabelIDs      []int32
	IsRead        bool
	MailID        int32
	RecipientIDs  []int32
	Subject       string
	Timestamp     time.Time
}

type MailLabelParams

type MailLabelParams struct {
	MyCharacterID int32
	Color         string
	LabelID       int32
	Name          string
	UnreadCount   int
}

type Storage

type Storage struct {
	// contains filtered or unexported fields
}

func New

func New(db *sql.DB) *Storage

New returns a new storage object.

func (*Storage) CreateEveCategory

func (r *Storage) CreateEveCategory(ctx context.Context, id int32, name string, is_published bool) (*model.EveCategory, error)

func (*Storage) CreateEveCharacter

func (r *Storage) CreateEveCharacter(ctx context.Context, arg CreateEveCharacterParams) error

func (*Storage) CreateEveConstellation

func (r *Storage) CreateEveConstellation(ctx context.Context, id, eve_region_id int32, name string) error

func (*Storage) CreateEveEntity

func (r *Storage) CreateEveEntity(ctx context.Context, id int32, name string, category model.EveEntityCategory) (*model.EveEntity, error)

func (*Storage) CreateEveGroup

func (r *Storage) CreateEveGroup(ctx context.Context, id, eve_category_id int32, name string, is_published bool) error

func (*Storage) CreateEveRace

func (r *Storage) CreateEveRace(ctx context.Context, id int32, description, name string) (*model.EveRace, error)

func (*Storage) CreateEveRegion

func (r *Storage) CreateEveRegion(ctx context.Context, description string, id int32, name string) (*model.EveRegion, error)

func (*Storage) CreateEveSolarSystem

func (r *Storage) CreateEveSolarSystem(ctx context.Context, id int32, eve_constellation_id int32, name string, security_status float64) error

func (*Storage) CreateEveType

func (r *Storage) CreateEveType(ctx context.Context, id int32, description string, eve_group_id int32, name string, is_published bool) error

func (*Storage) CreateMail

func (r *Storage) CreateMail(ctx context.Context, arg CreateMailParams) (int64, error)

func (*Storage) CreateMailList

func (r *Storage) CreateMailList(ctx context.Context, characterID, mailListID int32) error

func (*Storage) DeleteDictEntry

func (r *Storage) DeleteDictEntry(ctx context.Context, key string) error

func (*Storage) DeleteEveCharacter

func (r *Storage) DeleteEveCharacter(ctx context.Context, characterID int32) error

func (*Storage) DeleteMail

func (r *Storage) DeleteMail(ctx context.Context, characterID, mailID int32) error

func (*Storage) DeleteMyCharacter

func (r *Storage) DeleteMyCharacter(ctx context.Context, characterID int32) error

func (*Storage) DeleteObsoleteMailLabels

func (r *Storage) DeleteObsoleteMailLabels(ctx context.Context, characterID int32) error

func (*Storage) DeleteObsoleteMailLists

func (r *Storage) DeleteObsoleteMailLists(ctx context.Context, characterID int32) error

func (*Storage) GetDictEntry

func (r *Storage) GetDictEntry(ctx context.Context, key string) ([]byte, error)

func (*Storage) GetEveCategory

func (r *Storage) GetEveCategory(ctx context.Context, id int32) (*model.EveCategory, error)

func (*Storage) GetEveCharacter

func (r *Storage) GetEveCharacter(ctx context.Context, characterID int32) (*model.EveCharacter, error)

func (*Storage) GetEveConstellation

func (r *Storage) GetEveConstellation(ctx context.Context, id int32) (*model.EveConstellation, error)

func (*Storage) GetEveEntity

func (r *Storage) GetEveEntity(ctx context.Context, id int32) (*model.EveEntity, error)

func (*Storage) GetEveGroup

func (r *Storage) GetEveGroup(ctx context.Context, id int32) (*model.EveGroup, error)

func (*Storage) GetEveRace

func (r *Storage) GetEveRace(ctx context.Context, id int32) (*model.EveRace, error)

func (*Storage) GetEveRegion

func (r *Storage) GetEveRegion(ctx context.Context, id int32) (*model.EveRegion, error)

func (*Storage) GetEveSolarSystem

func (r *Storage) GetEveSolarSystem(ctx context.Context, id int32) (*model.EveSolarSystem, error)

func (*Storage) GetEveType

func (r *Storage) GetEveType(ctx context.Context, id int32) (*model.EveType, error)

func (*Storage) GetFirstMyCharacter

func (r *Storage) GetFirstMyCharacter(ctx context.Context) (model.MyCharacter, error)

func (*Storage) GetMail

func (r *Storage) GetMail(ctx context.Context, characterID, mailID int32) (model.Mail, error)

func (*Storage) GetMailLabel

func (r *Storage) GetMailLabel(ctx context.Context, characterID, labelID int32) (*model.MailLabel, error)

func (*Storage) GetMailLabelUnreadCounts

func (r *Storage) GetMailLabelUnreadCounts(ctx context.Context, characterID int32) (map[int32]int, error)

func (*Storage) GetMailListUnreadCounts

func (r *Storage) GetMailListUnreadCounts(ctx context.Context, characterID int32) (map[int32]int, error)

func (*Storage) GetMailUnreadCount

func (r *Storage) GetMailUnreadCount(ctx context.Context, characterID int32) (int, error)

func (*Storage) GetMyCharacter

func (r *Storage) GetMyCharacter(ctx context.Context, characterID int32) (model.MyCharacter, error)

func (*Storage) GetOrCreateEveEntity

func (r *Storage) GetOrCreateEveEntity(ctx context.Context, id int32, name string, category model.EveEntityCategory) (*model.EveEntity, error)

func (*Storage) GetOrCreateMailLabel

func (r *Storage) GetOrCreateMailLabel(ctx context.Context, arg MailLabelParams) (*model.MailLabel, error)

func (*Storage) GetToken

func (r *Storage) GetToken(ctx context.Context, characterID int32) (model.Token, error)

func (*Storage) ListEveCharacterIDs

func (r *Storage) ListEveCharacterIDs(ctx context.Context) ([]int32, error)

func (*Storage) ListEveEntitiesByName

func (r *Storage) ListEveEntitiesByName(ctx context.Context, name string) ([]*model.EveEntity, error)

func (*Storage) ListEveEntitiesByPartialName

func (r *Storage) ListEveEntitiesByPartialName(ctx context.Context, partial string) ([]*model.EveEntity, error)

func (*Storage) ListEveEntityByNameAndCategory

func (r *Storage) ListEveEntityByNameAndCategory(ctx context.Context, name string, category model.EveEntityCategory) ([]*model.EveEntity, error)

func (*Storage) ListEveEntityIDs

func (r *Storage) ListEveEntityIDs(ctx context.Context) ([]int32, error)

func (*Storage) ListMailIDs

func (r *Storage) ListMailIDs(ctx context.Context, characterID int32) ([]int32, error)

func (*Storage) ListMailIDsForLabelOrdered

func (r *Storage) ListMailIDsForLabelOrdered(ctx context.Context, characterID int32, labelID int32) ([]int32, error)

ListMailsForLabel returns a character's mails for a label in descending order by timestamp. Return mails for all labels, when labelID = 0

func (*Storage) ListMailIDsForListOrdered

func (r *Storage) ListMailIDsForListOrdered(ctx context.Context, characterID int32, listID int32) ([]int32, error)

func (*Storage) ListMailLabelsOrdered

func (r *Storage) ListMailLabelsOrdered(ctx context.Context, characterID int32) ([]*model.MailLabel, error)

func (*Storage) ListMailListsOrdered

func (r *Storage) ListMailListsOrdered(ctx context.Context, characterID int32) ([]*model.EveEntity, error)

func (*Storage) ListMyCharacterIDs

func (r *Storage) ListMyCharacterIDs(ctx context.Context) ([]int32, error)

func (*Storage) ListMyCharacters

func (r *Storage) ListMyCharacters(ctx context.Context) ([]model.MyCharacterShort, error)

func (*Storage) MissingEveEntityIDs

func (r *Storage) MissingEveEntityIDs(ctx context.Context, ids []int32) (*set.Set[int32], error)

func (*Storage) SetDictEntry

func (r *Storage) SetDictEntry(ctx context.Context, key string, bb []byte) error

func (*Storage) UpdateEveCharacter

func (r *Storage) UpdateEveCharacter(ctx context.Context, c *model.EveCharacter) error

func (*Storage) UpdateMail

func (r *Storage) UpdateMail(ctx context.Context, characterID int32, mailPK int64, isRead bool, labelIDs []int32) error

func (*Storage) UpdateOrCreateEveEntity

func (r *Storage) UpdateOrCreateEveEntity(ctx context.Context, id int32, name string, category model.EveEntityCategory) (*model.EveEntity, error)

func (*Storage) UpdateOrCreateMailLabel

func (r *Storage) UpdateOrCreateMailLabel(ctx context.Context, arg MailLabelParams) (*model.MailLabel, error)

func (*Storage) UpdateOrCreateMyCharacter

func (r *Storage) UpdateOrCreateMyCharacter(ctx context.Context, c *model.MyCharacter) error

func (*Storage) UpdateOrCreateToken

func (r *Storage) UpdateOrCreateToken(ctx context.Context, t *model.Token) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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