Documentation
¶
Index ¶
- Constants
- func Create(prod *Production) 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 GetByModule(id string, opts *Options) (*model.Result, error)
- func GetByOutcome(id string, opts *Options) (*model.Result, error)
- func Remove(id string) error
- func Replace(id string, prod *Production) error
- type ItemRef
- type ModuleRef
- type Options
- type Production
- type Quest
Constants ¶
View Source
const Collection = "production"
Collection indicates the MongoDB production collection
Variables ¶
This section is empty.
Functions ¶
func GetByMaterial ¶
GetByMaterial returns a result based on material
func GetByModule ¶
GetByModule returns a result based on module
func GetByOutcome ¶
GetByOutcome returns a result based on outcome
func Replace ¶
func Replace(id string, prod *Production) error
Replace replaces the data of an existing entity
Types ¶
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 ModuleRef ¶
type ModuleRef struct {
ID objectID `json:"id" bson:"id"`
Stage uint8 `json:"stage" bson:"stage"`
}
ModuleRef refers to a module and its stage
type Production ¶
type Production struct {
ID objectID `json:"_id" bson:"_id"`
Module objectID `json:"module" bson:"module"`
RequiredModules []ModuleRef `json:"requiredMods" bson:"requiredMods"`
RequiredQuests []Quest `json:"requiredQuests" bson:"requiredQuests"`
Materials []ItemRef `json:"materials" bson:"materials"`
Tools []ItemRef `json:"tools" bson:"tools"`
Outcome []ItemRef `json:"outcome" bson:"outcome"`
Duration int64 `json:"duration" bson:"duration"`
Modified timestamp `json:"_modified" bson:"_modified"`
}
Production describes the entity of a production
func GetByID ¶
func GetByID(id string) (*Production, error)
GetByID returns the entity of the given ID
func (Production) Validate ¶
func (p Production) Validate() error
Validate validates the fields of a production
Click to show internal directories.
Click to hide internal directories.