コード例 #1
0
// Add an commodity which buys from the current provider.
func (eb *EntityDTOBuilder) Buys(commodityType proto.CommodityDTO_CommodityType, key string, used float64) *EntityDTOBuilder {
	if eb.currentProvider == nil {
		// TODO should have error message. Notify set current provider first
		eb.err = fmt.Errorf("Provider has not been set for %v", commodityType)
		return eb
	}
	commDTO := new(proto.CommodityDTO)
	commDTO.CommodityType = &commodityType
	commDTO.Key = &key
	commDTO.Used = &used
	eb.BuysCommodity(commDTO)
	return eb
}