utils

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2025 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	RequestsTotal = promauto.NewCounter(prometheus.CounterOpts{
		Name: "dofus_requestsTotal",
		Help: "The total number of processed requests over all endpoints",
	})

	RequestsSearchTotal = promauto.NewCounter(prometheus.CounterOpts{
		Name: "dofus_requestsSearchTotal",
		Help: "The total number of searches on the global /search endpoint",
	})

	RequestsItemsSearch = promauto.NewCounter(prometheus.CounterOpts{
		Name: "dofus_requestsAllItemsSearch",
		Help: "The total number of searched items requests",
	})

	RequestsMountsSearch = promauto.NewCounter(prometheus.CounterOpts{
		Name: "dofus_requestsAllMountsSearch",
		Help: "The total number of searched mounts requests",
	})

	RequestsSetsSearch = promauto.NewCounter(prometheus.CounterOpts{
		Name: "dofus_requestsAllSetsSearch",
		Help: "The total number of searched sets requests",
	})

	RequestsItemsList = promauto.NewCounter(prometheus.CounterOpts{
		Name: "dofus_requestsAllItemsList",
		Help: "The total number of list items requests",
	})

	RequestsMountsList = promauto.NewCounter(prometheus.CounterOpts{
		Name: "dofus_requestsAllMountsList",
		Help: "The total number of list mounts requests",
	})

	RequestsSetsList = promauto.NewCounter(prometheus.CounterOpts{
		Name: "dofus_requestsAllSetsList",
		Help: "The total number list sets requests",
	})

	RequestsItemsSingle = promauto.NewCounter(prometheus.CounterOpts{
		Name: "dofus_requestsAllItemsSingle",
		Help: "The total number of single item requests",
	})

	RequestsMountsSingle = promauto.NewCounter(prometheus.CounterOpts{
		Name: "dofus_requestsAllMountsSingle",
		Help: "The total number of single mount requests",
	})

	RequestsSetsSingle = promauto.NewCounter(prometheus.CounterOpts{
		Name: "dofus_requestsAllSetsSingle",
		Help: "The total number of single set requests",
	})

	RequestsAlmanaxSingle = promauto.NewCounter(prometheus.CounterOpts{
		Name: "dofus_requestsAlmanaxSingle",
		Help: "The total number of single almanax requests",
	})

	RequestsAlmanaxRange = promauto.NewCounter(prometheus.CounterOpts{
		Name: "dofus_requestsAlmanaxRange",
		Help: "The total number of almanax range requests",
	})
)

Functions

func CategoryIdApiMapping

func CategoryIdApiMapping(id int) string

func CategoryIdMapping

func CategoryIdMapping(id int) string

func CleanJSON

func CleanJSON(jsonStr string) string

func Concat

func Concat[T any](first []T, second []T) []T

func CurrentRedBlueVersionStr

func CurrentRedBlueVersionStr(redBlueValue bool) string

func DownloadExtract

func DownloadExtract(filename string, dockerMountDataPath string, releaseUrl string) error

func DownloadImages

func DownloadImages(dockerMountDataPath string, releaseUrl string) error

func ImageUrls

func ImageUrls(iconId int, apiType string, resolutions []string, apiScheme string, doduapiMajorVersion int, apiHostname string, beta bool) []string

func LoadPersistedElements

func LoadPersistedElements(elementsUrl string, typesUrl string) (PersistentStringKeysMap, PersistentStringKeysMap, error)

func Max

func Max(a, b int) int

func Min

func Min(a, b int) int

func NextRedBlueVersionStr

func NextRedBlueVersionStr(redBlueValue bool) string

func PartitionSlice

func PartitionSlice[T any](items []T, parts int) (chunks [][]T)

func SetJsonHeader

func SetJsonHeader(w *http.ResponseWriter)

func WriteCacheHeader

func WriteCacheHeader(w *http.ResponseWriter)

Types

type GameVersion

type GameVersion struct {
	Version     string    `json:"version"`
	Release     string    `json:"release"`
	UpdateStamp time.Time `json:"update_stamp"`
}

type Pagination

type Pagination struct {
	PageNumber int
	PageSize   int
}

func PageninationWithState

func PageninationWithState(paginationStr string) Pagination
func (p *Pagination) BuildLinks(mainUrl url.URL, listSize int, apiScheme string, apiHostname string) (PaginationLinks, bool)

func (*Pagination) CalculateStartEndIndex

func (p *Pagination) CalculateStartEndIndex(listSize int) (int, int)

func (*Pagination) ValidatePagination

func (p *Pagination) ValidatePagination(listSize int) int
type PaginationLinks struct {
	First *string `json:"first"`
	Prev  *string `json:"prev"`
	Next  *string `json:"next"`
	Last  *string `json:"last"`
}

type PersistentStringKeysMap

type PersistentStringKeysMap struct {
	Entries *treebidimap.Map `json:"entries"`
	NextId  int              `json:"next_id"`
}

Jump to

Keyboard shortcuts

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