title: Get inside struct values
body: <p>In this <a href="https://github.com/bxcodec/go-clean-arch" rel="nofollow noreferrer">example</a>, I changed the <code>Sql driver</code> to <code>mgo</code>, I got some confusion. Here, How can I access the inside struct value? like nested struct.</p>
  
  <p>I have two struct, </p>
  
  <p><strong>Author</strong></p>
  
  <pre><code>type Author struct {
      ID        string `bson:"id"`
      Name      string `bson:"name"`
      Timestamp time.Time
  }
  </code></pre>
  
  <p><strong>Article</strong></p>
  
  <pre><code>type Article struct {
      ID        bson.ObjectId `bson:"_id,omitempty"`
      Title     string        `bson:"title"`
      Content   string        `bson:"content"`
      Author    Author        `bson:"inline"`
      Timestamp time.Time
  }
  </code></pre>
  
  <p><strong>Function</strong></p>
  
  <pre><code>func (m *mgoArticleRepository) FindAll() ([]*models.Article, error) {
      result := make([]*models.Article, 0)
      sessionCopy := m.Conn.Copy()
      defer sessionCopy.Close()
      collection := sessionCopy.DB(DBNAME).C(COLLECTION)
      err := collection.Find(nil).All(&amp;result)
      return result, err
  }
  </code></pre>
  
  <p><strong>Output</strong></p>
  
  <p>Author object return empty (I have data in mongoDB)</p>
  
  <pre><code>[
      {
          "ID":"5b4f27c187a9e40828422cca",
          "Title":"Makan Ayam",
          "Content":"Sample values One",
          "Author":{
              "ID":"",
              "Name":"",
              "Timestamp":"0001-01-01T00:00:00Z"
          },
          "Timestamp":"0001-01-01T00:00:00Z"
      },
      {
          "ID":"5b4f27c187a9e40828422ccb",
          "Title":"Makan Ikan",
          "Content":"Sample values Two",
          "Author":{
              "ID":"",
              "Name":"",
              "Timestamp":"0001-01-01T00:00:00Z"
          },
          "Timestamp":"0001-01-01T00:00:00Z"
      },
      {
          "ID":"5b4f27c187a9e40828422ccc",
          "Title":"Makan Sayur",
          "Content":"Sample values Three",
          "Author":{
              "ID":"",
              "Name":"",
              "Timestamp":"0001-01-01T00:00:00Z"
          },
          "Timestamp":"0001-01-01T00:00:00Z"
      },
      {
          "ID":"5b4f27c187a9e40828422ccd",
          "Title":"Makan Daging",
          "Content":"Sample values Four",
          "Author":{
              "ID":"",
              "Name":"",
              "Timestamp":"0001-01-01T00:00:00Z"
          },
          "Timestamp":"0001-01-01T00:00:00Z"
      },
      {
          "ID":"5b4f27c187a9e40828422cce",
          "Title":"Makan Indomie",
          "Content":"Sample values Five",
          "Author":{
              "ID":"",
              "Name":"",
              "Timestamp":"0001-01-01T00:00:00Z"
          },
          "Timestamp":"0001-01-01T00:00:00Z"
      },
      {
          "ID":"5b4f27c187a9e40828422ccf",
          "Title":"Makan Soto",
          "Content":"Sample values Six",
          "Author":{
              "ID":"",
              "Name":"",
              "Timestamp":"0001-01-01T00:00:00Z"
          },
          "Timestamp":"0001-01-01T00:00:00Z"
      }
    ]
  </code></pre>
  
  <p>Here, How can I make the relationship for both structs? Thanks.</p>