Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-1305

Allow inline fields to be pointers of struct

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 1.1.1
    • Fix Version/s: 1.2.0
    • Component/s: BSON, CRUD
    • Labels:
      None

      Description

      Instant of Stock cannot be written because a pointer of Quantity struct is used inside it.
      type Quantity struct {
          InCarton float64 `json:"InCarton" bson:"InCarton"`
          InPallet float64 `json:"InPallet" bson:"InPallet"`
          InKg float64 `json:"InKg" bson:"InKg"`
          InCBM float64 `json:"InCBM" bson:"InCBM"`

      type Stock struct {
          Batch `json:",inline" bson:",inline"`
          Quantity *Quantity `json:",inline" bson:",inline"`
          MovementHistory Movements `json:"MovementHistory" bson:"MovementHistory"`
          CostPerKg `json:"" bson:""`

      Error message is described as below:

      panic: cannot transform type *simcel.TransportOrderLine to a BSON Document: (struct simcel.Stock) inline fields must be either a struct or a map

        Attachments

          Activity

            People

            Assignee:
            isabella.siu Isabella Siu
            Reporter:
            phuong.nguyen@cel-consulting.com Nguyen Phuong
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: