database

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2025 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DatabaseName = "almanax.db"
View Source
var Indexes map[string]SearchIndexes

Functions

This section is empty.

Types

type Almanax

type Almanax struct {
	ID          int64      `db:"id"`
	BonusID     int64      `db:"bonus_id"`
	TributeID   int64      `db:"tribute_id"`
	Date        string     `db:"date"`
	RewardKamas int64      `db:"reward_kamas"`
	XpRatio     float64    `db:"xp_ratio"`
	OptimalLvl  int        `db:"optimal_lvl"`
	Duration    float64    `db:"duration"`
	CreatedAt   time.Time  `db:"created_at"`
	UpdatedAt   time.Time  `db:"updated_at"`
	DeletedAt   *time.Time `db:"deleted_at"`
}

type Bonus

type Bonus struct {
	ID            int64      `db:"id"`
	BonusTypeID   int64      `db:"bonus_type_id"`
	DescriptionEn string     `db:"description_en"`
	DescriptionFr string     `db:"description_fr"`
	DescriptionEs string     `db:"description_es"`
	DescriptionDe string     `db:"description_de"`
	DescriptionPt string     `db:"description_pt"`
	CreatedAt     time.Time  `db:"created_at"`
	UpdatedAt     time.Time  `db:"updated_at"`
	DeletedAt     *time.Time `db:"deleted_at"`
}

type BonusType

type BonusType struct {
	ID        int64      `db:"id"`
	NameID    string     `db:"name_id"`
	NameEn    string     `db:"name_en"`
	NameFr    string     `db:"name_fr"`
	NameEs    string     `db:"name_es"`
	NameDe    string     `db:"name_de"`
	NamePt    string     `db:"name_pt"`
	CreatedAt time.Time  `db:"created_at"`
	UpdatedAt time.Time  `db:"updated_at"`
	DeletedAt *time.Time `db:"deleted_at"`
}

type MappedAlmanax

type MappedAlmanax struct {
	Almanax   Almanax
	Bonus     Bonus
	BonusType BonusType
	Tribute   Tribute
}

type Repository

type Repository struct {
	Db *sql.DB
	// contains filtered or unexported fields
}

func NewDatabaseRepository

func NewDatabaseRepository(ctx context.Context, workdir string) *Repository

func (*Repository) CreateBonus

func (r *Repository) CreateBonus(bonus *Bonus) (int64, error)

func (*Repository) CreateBonusType

func (r *Repository) CreateBonusType(bonusType *BonusType) (int64, error)

func (*Repository) CreateOrUpdate

func (r *Repository) CreateOrUpdate(date string, almanax *dodumap.MappedMultilangNPCAlmanaxUnity) (int64, error)

func (*Repository) CreateTribute

func (r *Repository) CreateTribute(tribute *Tribute) (int64, error)

func (*Repository) Deinit

func (r *Repository) Deinit()

func (*Repository) GetAlmanaxByDateRange

func (r *Repository) GetAlmanaxByDateRange(from, to string) ([]MappedAlmanax, error)

func (*Repository) GetAlmanaxByDateRangeAndNameID

func (r *Repository) GetAlmanaxByDateRangeAndNameID(from, to, nameID string) ([]MappedAlmanax, error)

func (*Repository) GetBonusTypes

func (r *Repository) GetBonusTypes() ([]BonusType, error)

func (*Repository) Init

func (r *Repository) Init(ctx context.Context, workdir string) error

func (*Repository) UpdateAlmanax

func (r *Repository) UpdateAlmanax(almanax *Almanax) error

func (*Repository) UpdateFuture

func (r *Repository) UpdateFuture(data map[string]dodumap.MappedMultilangNPCAlmanaxUnity) error

type SearchIndexes

type SearchIndexes struct {
	AllItems meilisearch.IndexManager
	Sets     meilisearch.IndexManager
	Mounts   meilisearch.IndexManager
}

type Tribute

type Tribute struct {
	ID             int64      `db:"id"`
	ItemNameEn     string     `db:"item_name_en"`
	ItemNameFr     string     `db:"item_name_fr"`
	ItemNameEs     string     `db:"item_name_es"`
	ItemNameDe     string     `db:"item_name_de"`
	ItemNamePt     string     `db:"item_name_pt"`
	ItemAnkamaID   int64      `db:"item_ankama_id"`
	ItemCategoryId int        `db:"item_category_id"`
	ItemDoduapiUri string     `db:"item_doduapi_uri"`
	Quantity       int        `db:"quantity"`
	CreatedAt      time.Time  `db:"created_at"`
	UpdatedAt      time.Time  `db:"updated_at"`
	DeletedAt      *time.Time `db:"deleted_at"`
}

type VersionT

type VersionT struct {
	Search bool
	MemDb  bool
}
var Version VersionT

Jump to

Keyboard shortcuts

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