MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / addAttachments

Method addAttachments

db/crud.go:2354–2365  ·  view source on GitHub ↗
(ctx context.Context, newAttachments updatedAttachments)

Source from the content-addressed store, hash-verified

2352}
2353
2354func (db *DatabaseCollectionWithUser) addAttachments(ctx context.Context, newAttachments updatedAttachments) error {
2355 // Need to check and add attachments here to ensure the attachment is within size constraints
2356 err := db.setAttachments(ctx, newAttachments)
2357 if err != nil {
2358 if errors.Is(err, ErrAttachmentTooLarge) || err.Error() == "document value was too large" {
2359 err = base.HTTPErrorf(http.StatusRequestEntityTooLarge, "Attachment too large")
2360 } else {
2361 err = errors.Wrap(err, "Error adding attachment")
2362 }
2363 }
2364 return err
2365}
2366
2367// assignSequence assigns a global sequence number from database.
2368func (c *DatabaseCollectionWithUser) assignSequence(ctx context.Context, docSequence uint64, doc *Document, unusedSequences []uint64) ([]uint64, error) {

Callers 1

documentUpdateFuncMethod · 0.95

Calls 3

setAttachmentsMethod · 0.95
HTTPErrorfFunction · 0.92
ErrorMethod · 0.45

Tested by

no test coverage detected