mirror of
https://github.com/MichaelMure/git-bug.git
synced 2024-12-13 20:13:15 +03:00
Merge pull request #763 from MichaelMure/resolve-entity
entity: allow to resolve identities when numashalling operations
This commit is contained in:
commit
069a4c975f
@ -71,7 +71,7 @@ func idOperation(op Operation, base *OpBase) entity.Id {
|
||||
return base.id
|
||||
}
|
||||
|
||||
func operationUnmarshaller(author identity.Interface, raw json.RawMessage) (dag.Operation, error) {
|
||||
func operationUnmarshaller(author identity.Interface, raw json.RawMessage, resolver identity.Resolver) (dag.Operation, error) {
|
||||
var t struct {
|
||||
OperationType OperationType `json:"type"`
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ func (o *op2) Author() identity.Interface {
|
||||
return o.author
|
||||
}
|
||||
|
||||
func unmarshaler(author identity.Interface, raw json.RawMessage) (Operation, error) {
|
||||
func unmarshaler(author identity.Interface, raw json.RawMessage, resolver identity.Resolver) (Operation, error) {
|
||||
var t struct {
|
||||
OperationType int `json:"type"`
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ type Definition struct {
|
||||
// the Namespace in git references (bugs, prs, ...)
|
||||
Namespace string
|
||||
// a function decoding a JSON message into an Operation
|
||||
OperationUnmarshaler func(author identity.Interface, raw json.RawMessage) (Operation, error)
|
||||
OperationUnmarshaler func(author identity.Interface, raw json.RawMessage, resolver identity.Resolver) (Operation, error)
|
||||
// the expected format version number, that can be used for data migration/upgrade
|
||||
FormatVersion uint
|
||||
}
|
||||
|
@ -314,7 +314,7 @@ func unmarshallPack(def Definition, resolver identity.Resolver, data []byte) ([]
|
||||
|
||||
for _, raw := range aux.Operations {
|
||||
// delegate to specialized unmarshal function
|
||||
op, err := def.OperationUnmarshaler(author, raw)
|
||||
op, err := def.OperationUnmarshaler(author, raw, resolver)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user