| 426 | } |
| 427 | |
| 428 | func (doc *Document) BodyBytes(ctx context.Context) ([]byte, error) { |
| 429 | if doc._rawBody != nil { |
| 430 | return doc._rawBody, nil |
| 431 | } |
| 432 | |
| 433 | if doc._body == nil { |
| 434 | return nil, nil |
| 435 | } |
| 436 | |
| 437 | bodyBytes, err := base.JSONMarshal(doc._body) |
| 438 | if err != nil { |
| 439 | return nil, pkgerrors.Wrapf(err, "Error marshalling document body") |
| 440 | } |
| 441 | doc._rawBody = bodyBytes |
| 442 | return doc._rawBody, nil |
| 443 | } |
| 444 | |
| 445 | // Builds the Meta Map for use in the Sync Function. This meta map currently only includes the user xattr, however, this |
| 446 | // can be expanded upon in the future. |