-
Notifications
You must be signed in to change notification settings - Fork 64
/
Copy pathchanges.go
31 lines (25 loc) · 993 Bytes
/
changes.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package lib
import (
"context"
"github.com/qri-io/qri/changes"
)
// ChangeReportParams defines parameters for diffing two sources
type ChangeReportParams struct {
LeftRef string `schema:"leftRef" json:"leftRef"`
RightRef string `schema:"rightRef" json:"rightRef"`
}
// ChangeReport is a simple utility type declaration
type ChangeReport = changes.ChangeReportResponse
// Changes resolves the requested datasets and tries to generate a change report
func (m DiffMethods) Changes(ctx context.Context, p *ChangeReportParams) (*ChangeReport, error) {
got, _, err := m.d.Dispatch(ctx, dispatchMethodName(m, "changes"), p)
if res, ok := got.(*ChangeReport); ok {
return res, err
}
return nil, dispatchReturnError(got, err)
}
// Changes generates report of changes between two datasets
func (diffImpl) Changes(scope scope, p *ChangeReportParams) (*ChangeReport, error) {
svc := changes.New(scope.Loader(), scope.Stats())
return svc.Report(scope.Context(), p.LeftRef, p.RightRef)
}