MCPcopy Create free account
hub / github.com/openclaw/gogcli / buildDestinationCopyRequests

Function buildDestinationCopyRequests

internal/sheetsvalidation/copy.go:534–651  ·  view source on GitHub ↗
(
	destination *sheets.GridRange,
	spans []Span,
	segments []copySegment,
)

Source from the content-addressed store, hash-verified

532}
533
534func buildDestinationCopyRequests(
535 destination *sheets.GridRange,
536 spans []Span,
537 segments []copySegment,
538) ([]*sheets.Request, []Span, error) {
539 type copyGroup struct {
540 columns []*sheets.TableColumnProperties
541 conditions map[int64]*sheets.BooleanCondition
542 }
543 groups := make(map[string]*copyGroup)
544 protected := make([]Span, 0)
545
546 for _, span := range spans {
547 if span.SheetID != destination.SheetId {
548 continue
549 }
550
551 if _, _, ok := IntersectGridIndexes(
552 span.StartRow,
553 span.EndRow,
554 destination.StartRowIndex,
555 destination.EndRowIndex,
556 ); !ok {
557 continue
558 }
559
560 if _, _, ok := IntersectGridIndexes(
561 span.StartCol,
562 span.EndCol,
563 destination.StartColumnIndex,
564 destination.EndColumnIndex,
565 ); !ok {
566 continue
567 }
568 startRow, endRow, _ := IntersectGridIndexes(
569 span.StartRow,
570 span.EndRow,
571 destination.StartRowIndex,
572 destination.EndRowIndex,
573 )
574 startCol, endCol, _ := IntersectGridIndexes(
575 span.StartCol,
576 span.EndCol,
577 destination.StartColumnIndex,
578 destination.EndColumnIndex,
579 )
580
581 condition, ruleKey, covered := ruleCoverage(
582 segments,
583 startRow,
584 endRow,
585 startCol,
586 endCol,
587 )
588 if !covered {
589 return nil, nil, invalidf(
590 "copy into table column %d in table %s requires a table-column source covering the destination",
591 span.ColumnIndex+1,

Callers 1

BuildCopyRequestsFunction · 0.85

Calls 6

IntersectGridIndexesFunction · 0.85
ruleCoverageFunction · 0.85
ruleKeyForValidationFunction · 0.85
GridRangeCoversSpanFunction · 0.85
invalidfFunction · 0.70

Tested by

no test coverage detected