Documentation ¶
Index ¶
- Constants
- func Create(mod *Module) error
- func GetAll(opts *Options) (*model.Result, error)
- func GetByIDs(ids []string, opts *Options) (*model.Result, error)
- func GetByMaterial(id string, opts *Options) (*model.Result, error)
- func GetByText(q string, opts *Options) (*model.Result, error)
- func Remove(id string) error
- func Replace(id string, mod *Module) error
- type Bonus
- type ItemRef
- type Module
- type Options
- type Ref
- type Requirement
- type Stage
Constants ¶
View Source
const Collection = "modules"
Collection indicates the MongoDB module collection
Variables ¶
This section is empty.
Functions ¶
func GetByMaterial ¶
GetByMaterial returns a result based on stage materials
Types ¶
type Bonus ¶
type Bonus struct { Description string `json:"description" bson:"description"` Value float64 `json:"value,omitempty" bson:"value,omitempty"` SkillType string `json:"skillType,omitempty" bson:"skillType,omitempty"` Type string `json:"type" bson:"type"` }
Bonus describes a bonus of a stage
type ItemRef ¶
type ItemRef struct { ID objectID `json:"id" bson:"id"` Count uint64 `json:"count,omitempty" bson:"count,omitempty"` Resources uint64 `json:"resources,omitempty" bson:"resources,omitempty"` Kind item.Kind `json:"kind" bson:"kind"` }
ItemRef refers to an item and specifies its quantity
type Module ¶
type Module struct { ID objectID `json:"_id" bson:"_id"` Name string `json:"name" bson:"name"` RequiresPower bool `json:"requiresPower" bson:"requiresPower"` Stages []Stage `json:"stages" bson:"stages"` Modified timestamp `json:"_modified" bson:"_modified"` }
Module describes the entity of a module
type Ref ¶
type Ref struct { ID objectID `json:"id" bson:"id"` Stage uint8 `json:"stage" bson:"stage"` }
Ref refers to a module and its stage
type Requirement ¶
type Requirement struct { Name string `json:"name" bson:"name"` Level uint8 `json:"level,omitempty" bson:"level,omitempty"` Type string `json:"type" bson:"type"` }
Requirement describes a requirement of different types of a stage
func (Requirement) Validate ¶
func (r Requirement) Validate() error
Validate validates the fields of a module requirement
type Stage ¶
type Stage struct { Description string `json:"description" bson:"description"` Bonuses []Bonus `json:"bonuses" bson:"bonuses"` Requirements []Requirement `json:"requirements" bson:"requirements"` RequiredModules []Ref `json:"requiredMods" bson:"requiredMods"` Materials []ItemRef `json:"materials" bson:"materials"` ConstructionTime int64 `json:"constructionTime" bson:"constructionTime"` }
Stage describes a stage of a module
Click to show internal directories.
Click to hide internal directories.