package model import ( operationPb "kpt-tmr-group/proto/go/backend/operation" "time" ) type FormulaEstimate struct { Id int32 `json:"id"` PastureId int32 `json:"pasture_id"` PastureName string `json:"pasture_name"` BarnId int32 `json:"barn_id"` FeedFormulaId int32 `json:"feed_formula_id"` FeedFormulaName string `json:"feed_formula_name"` CowNumber int32 `json:"cow_number"` DryFormulaNumber int32 `json:"dry_formula_number"` DryTmrFeed int32 `json:"dry_tmr_feed"` DryFoodIntake int32 `json:"dry_food_intake"` MjFormulaNumber int32 `json:"mj_formula_number"` MjTmrFeed int32 `json:"mj_tmr_feed"` MjFoodIntake int32 `json:"mj_food_intake"` NndFormulaNumber int32 `json:"nnd_formula_number"` NndTmrFeed int32 `json:"nnd_tmr_feed"` NndFoodIntake int32 `json:"nnd_food_intake"` CpgFormulaNumber int32 `json:"cpg_formula_number"` CpgTmrFeed int32 `json:"cpg_tmr_feed"` CpgFoodIntake int32 `json:"cpg_food_intake"` PgFormulaNumber int32 `json:"pg_formula_number"` PgTmrFeed int32 `json:"pg_tmr_feed"` PgFoodIntake int32 `json:"pg_food_intake"` DmFormulaNumber int32 `json:"dm_formula_number"` DmTmrFeed int32 `json:"dm_tmr_feed"` DmFoodIntake int32 `json:"dm_food_intake"` CpdmFormulaNumber int32 `json:"cpdm_formula_number"` CpdmTmrFeed int32 `json:"cpdm_tmr_feed"` CpdmFoodIntake int32 `json:"cpdm_food_intake"` FatFormulaNumber int32 `json:"fat_formula_number"` FatTmrFeed int32 `json:"fat_tmr_feed"` FatFoodIntake int32 `json:"fat_food_intake"` StarchFormulaNumber int32 `json:"starch_formula_number"` StarchTmrFeed int32 `json:"starch_tmr_feed"` StarchFoodIntake int32 `json:"starch_food_intake"` NdfFormulaNumber int32 `json:"ndf_formula_number"` NdfTmrFeed int32 `json:"ndf_tmr_feed"` NdfFoodIntake int32 `json:"ndf_food_intake"` CpNdfFormulaNumber int32 `json:"cp_ndf_formula_number"` CpNdfTmrFeed int32 `json:"cp_ndf_tmr_feed"` CpNdfFoodIntake int32 `json:"cp_ndf_food_intake"` AdfFormulaNumber int32 `json:"adf_formula_number"` AdfTmrFeed int32 `json:"adf_tmr_feed"` AdfFoodIntake int32 `json:"adf_food_intake"` CalciumFormulaNumber int32 `json:"calcium_formula_number"` CalciumTmrFeed int32 `json:"calcium_tmr_feed"` CalciumFoodIntake int32 `json:"calcium_food_intake"` PdmFormulaNumber int32 `json:"pdm_formula_number"` PdmTmrFeed int32 `json:"pdm_tmr_feed"` PdmFoodIntake int32 `json:"pdm_food_intake"` CfRatioFormulaNumber int32 `json:"cf_ratio_formula_number"` CfRatioTmrFeed int32 `json:"cf_ratio_tmr_feed"` CfRatioFoodIntake int32 `json:"cf_ratio_food_intake"` CreatedAt int32 `json:"created_at"` UpdatedAt int32 `json:"updated_at"` } func (f *FormulaEstimate) TableName() string { return "formula_estimate" } type FormulaEstimateSlice []*FormulaEstimate func (f FormulaEstimateSlice) ToPB() []*operationPb.AddFormulaEstimateRequest { res := make([]*operationPb.AddFormulaEstimateRequest, len(f)) for i, v := range f { res[i] = &operationPb.AddFormulaEstimateRequest{ Id: v.Id, PastureId: v.PastureId, PastureName: v.PastureName, BarnId: v.BarnId, FeedFormulaId: v.FeedFormulaId, FeedFormulaName: v.FeedFormulaName, CowNumber: v.CowNumber, DryFoodIntake: v.DryFoodIntake, DryFormulaNumber: v.DryFormulaNumber, DryTmrFeed: v.DryTmrFeed, MjFoodIntake: v.MjFoodIntake, MjFormulaNumber: v.MjFormulaNumber, MjTmrFeed: v.MjTmrFeed, NndFoodIntake: v.NndFoodIntake, NndFormulaNumber: v.NndFormulaNumber, NndTmrFeed: v.NndTmrFeed, CpgFoodIntake: v.CpgFoodIntake, CpgFormulaNumber: v.CpgFormulaNumber, CpgTmrFeed: v.CpgTmrFeed, PgFoodIntake: v.PgFoodIntake, PgFormulaNumber: v.PgFormulaNumber, PgTmrFeed: v.PgTmrFeed, DmFoodIntake: v.DmFoodIntake, DmFormulaNumber: v.DmFormulaNumber, DmTmrFeed: v.DmTmrFeed, CpdmFoodIntake: v.CpdmFoodIntake, CpdmFormulaNumber: v.CpdmFormulaNumber, CpdmTmrFeed: v.CpdmTmrFeed, FatFoodIntake: v.FatFoodIntake, FatFormulaNumber: v.FatFormulaNumber, FatTmrFeed: v.FatTmrFeed, StarchFoodIntake: v.StarchFoodIntake, StarchFormulaNumber: v.StarchFormulaNumber, StarchTmrFeed: v.StarchTmrFeed, NdfFoodIntake: v.NdfFoodIntake, NdfFormulaNumber: v.NdfFormulaNumber, NdfTmrFeed: v.NdfTmrFeed, CpNdfFoodIntake: v.CpNdfFoodIntake, CpNdfFormulaNumber: v.CpNdfFormulaNumber, CpNdfTmrFeed: v.CpNdfTmrFeed, AdfFoodIntake: v.AdfFoodIntake, AdfFormulaNumber: v.AdfFormulaNumber, AdfTmrFeed: v.AdfTmrFeed, CalciumFoodIntake: v.CalciumFoodIntake, CalciumFormulaNumber: v.CalciumFormulaNumber, CalciumTmrFeed: v.CalciumTmrFeed, PdmFoodIntake: v.PdmFoodIntake, PdmFormulaNumber: v.PdmFormulaNumber, PdmTmrFeed: v.PdmTmrFeed, CfRatioFoodIntake: v.CfRatioFoodIntake, CfRatioFormulaNumber: v.CfRatioFormulaNumber, CfRatioTmrFeed: v.CfRatioTmrFeed, CreatedAt: v.CreatedAt, CreatedAtFormat: time.Unix(int64(v.CreatedAt), 0).Format(LayoutTime), } } return res }