armor

package
v0.0.0-...-0cfb223 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2024 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const Collection = "statistics.ammunition.armor"

Collection indicates the MongoDB feature collection

Variables

This section is empty.

Functions

func Create

func Create(stats *AmmoArmorStatistics) error

Create creates a new entity

func GetAll

func GetAll(opts *Options) (*model.Result, error)

GetAll returns a result based on filters

func GetByRefs

func GetByRefs(ammo, armor []string, r *RangeOptions, opts *Options) (*model.Result, error)

GetByRefs returns a result by given ammo and armor IDs

func Remove

func Remove(id string) error

Remove removes an entity

func Replace

func Replace(id string, stats *AmmoArmorStatistics) error

Replace replaces the data of an existing entity

Types

type AmmoArmorStatistics

type AmmoArmorStatistics struct {
	ID                        objectID   `json:"_id" bson:"_id"`
	Ammo                      objectID   `json:"ammo" bson:"ammo"`
	Armor                     ItemRef    `json:"armor" bson:"armor"`
	Distance                  uint64     `json:"distance" bson:"distance"`
	PenetrationChance         [4]float64 `json:"penetrationChance" bson:"penetrationChance"`
	AverageShotsToDestruction Statistics `json:"avgShotsToDestruct" bson:"avgShotsToDestruct"`
	AverageShotsTo50Damage    Statistics `json:"avgShotsTo50Damage" bson:"avgShotsTo50Damage"`
	Modified                  timestamp  `json:"_modified" bson:"_modified"`
}

AmmoArmorStatistics describes the entity of a ammo against armor statistics

func GetByID

func GetByID(id string) (*AmmoArmorStatistics, error)

GetByID returns the entity of the given ID

func (AmmoArmorStatistics) Validate

func (d AmmoArmorStatistics) Validate() error

Validate validates the fields of a ArmorStatistics

type ItemRef

type ItemRef struct {
	ID   objectID  `json:"id" bson:"id"`
	Kind item.Kind `json:"kind" bson:"kind"`
}

ItemRef refers to an item entity

func (ItemRef) Validate

func (d ItemRef) Validate() error

Validate validates the fields of a ItemRef

type Options

type Options struct {
	Sort   bson.D
	Limit  int64
	Offset int64
}

Options represents the options for a database operation

type RangeOptions

type RangeOptions struct {
	GTE *uint64
	LTE *uint64
}

RangeOptions represents the range options of a query

type Statistics

type Statistics struct {
	Min    float64 `json:"min" bson:"min"`
	Max    float64 `json:"max" bson:"max"`
	Mean   float64 `json:"mean" bson:"mean"`
	Median float64 `json:"median" bson:"median"`
	StdDev float64 `json:"stdDev" bson:"stdDev"`
}

Statistics describes the statistical values

Jump to

Keyboard shortcuts

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