aboutsummaryrefslogtreecommitdiffstats
path: root/entity/merge.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2021-01-24 19:45:21 +0100
committerMichael Muré <batolettre@gmail.com>2021-02-14 12:19:00 +0100
commitdc5059bc3372941e2908739831188768335ac50b (patch)
tree7294aed90cf5f04809d7a99b4967b513bdb409d5 /entity/merge.go
parent8d63c983c982f93cc48d3996d6bd097ddeeb327f (diff)
downloadgit-bug-dc5059bc3372941e2908739831188768335ac50b.tar.gz
entity: more progress on merging and signing
Diffstat (limited to 'entity/merge.go')
-rw-r--r--entity/merge.go37
1 files changed, 25 insertions, 12 deletions
diff --git a/entity/merge.go b/entity/merge.go
index 7d1f3f43..1b68b4de 100644
--- a/entity/merge.go
+++ b/entity/merge.go
@@ -24,10 +24,10 @@ type MergeResult struct {
Id Id
Status MergeStatus
- // Only set for invalid status
+ // Only set for Invalid status
Reason string
- // Not set for invalid status
+ // Only set for New or Updated status
Entity Interface
}
@@ -48,29 +48,42 @@ func (mr MergeResult) String() string {
}
}
-func NewMergeError(err error, id Id) MergeResult {
+// TODO: Interface --> *Entity ?
+func NewMergeNewStatus(id Id, entity Interface) MergeResult {
return MergeResult{
- Err: err,
Id: id,
- Status: MergeStatusError,
+ Status: MergeStatusNew,
+ Entity: entity,
}
}
-// TODO: Interface --> *Entity ?
-func NewMergeStatus(status MergeStatus, id Id, entity Interface) MergeResult {
+func NewMergeInvalidStatus(id Id, reason string) MergeResult {
return MergeResult{
Id: id,
- Status: status,
+ Status: MergeStatusInvalid,
+ Reason: reason,
+ }
+}
- // Entity is not set for an invalid merge result
+func NewMergeUpdatedStatus(id Id, entity Interface) MergeResult {
+ return MergeResult{
+ Id: id,
+ Status: MergeStatusUpdated,
Entity: entity,
}
}
-func NewMergeInvalidStatus(id Id, reason string) MergeResult {
+func NewMergeNothingStatus(id Id) MergeResult {
return MergeResult{
Id: id,
- Status: MergeStatusInvalid,
- Reason: reason,
+ Status: MergeStatusNothing,
+ }
+}
+
+func NewMergeError(err error, id Id) MergeResult {
+ return MergeResult{
+ Id: id,
+ Status: MergeStatusError,
+ Err: err,
}
}