func fillTupleData()

in datahub/resultmodel.go [526:565]


func fillTupleData(tr *TupleRecord, recordEntry *pbmodel.RecordEntry) error {
	if recordEntry.ShardId != nil {
		tr.ShardId = *recordEntry.ShardId
	}
	if recordEntry.HashKey != nil {
		tr.HashKey = *recordEntry.HashKey
	}
	if recordEntry.PartitionKey != nil {
		tr.Sequence = *recordEntry.Sequence
	}
	if recordEntry.Cursor != nil {
		tr.Cursor = *recordEntry.Cursor
	}
	if recordEntry.NextCursor != nil {
		tr.NextCursor = *recordEntry.NextCursor
	}
	if recordEntry.Sequence != nil {
		tr.Sequence = *recordEntry.Sequence
	}
	if recordEntry.SystemTime != nil {
		tr.SystemTime = *recordEntry.SystemTime
	}
	if recordEntry.Attributes != nil {
		for _, pair := range recordEntry.Attributes.Attributes {
			tr.Attributes[*pair.Key] = *pair.Value
		}
	}
	data := recordEntry.Data.Data

	for idx, v := range data {
		if v.Value != nil {
			tv, err := castValueFromString(string(v.Value), tr.RecordSchema.Fields[idx].Type)
			if err != nil {
				return err
			}
			tr.Values[idx] = tv
		}
	}
	return nil
}