Firestore云功能:从事件获取DocumentSnapshot

I'm listening for change events of collection documents, just making a dump what I'm receiving:

func ForwardUserChanged(ctx context.Context, e cloudfn.FirestoreEvent) error {
    raw, err := json.Marshal(e.Value.Fields)
    if err != nil {
        return err
    }
    fmt.Println(string(raw))

    return nil
}

where FirestoreEvent is a custom struct:

// FirestoreEvent is the payload of a Firestore event.
type FirestoreEvent struct {
    OldValue   FirestoreValue `json:"oldValue"`
    Value      FirestoreValue `json:"value"`
    UpdateMask struct {
        FieldPaths []string `json:"fieldPaths"`
    } `json:"updateMask"`
}

type FirestoreValue struct {
    CreateTime time.Time `json:"createTime"`
    Fields     map[string]interface{} `json:"fields"`
    Name       string                 `json:"name"`
    UpdateTime time.Time              `json:"updateTime"`
}

What I want is a simple way of decoding the Fields into my struct, which was saved into the in the same collection before. The thing is that the Fields looks in a pretty complex way and it's not just an easy mapping map[string]interface{} to the struct fields. For example, the Fields looks like this:

{"answers":
  {"mapValue":
    {"fields":
      {"fish-1":
        {"mapValue":
          {"fields":{"option":{"stringValue":"yes"},

but the original struct is

type Report struct {
  Answers map[string]Answer
}

type Answer struct {
  Option string
}

Is there an easy way to de-serialize the map into the struct? Or it should be done "by hand"?

There should be a way to get a DocumentSnapshot from this data. The data from the Firestore look like the protobuf message and it even can be seen in the Document struct from the google.golang.org/genproto/googleapis/firestore/v1.

It's typical with code that deals with Cloud Firestore for it to manually copy the values from a DocumentSnapshot into a data structure of your own definition.

The exception to this is with Java code, where the Firestore SDK can use reflection to automatically map field values to and from POJO properties. But not everyone chooses this, as they might need to modify the values going in and out. But I don't think the Firestore SDKs for other languages have this sort of support.