Create is a convenience function to create a bug
(author identity.Interface, unixTime int64, title, message string, files []repository.Hash, metadata map[string]string)
| 102 | |
| 103 | // Create is a convenience function to create a bug |
| 104 | func Create(author identity.Interface, unixTime int64, title, message string, files []repository.Hash, metadata map[string]string) (*Bug, *CreateOperation, error) { |
| 105 | b := NewBug() |
| 106 | op := NewCreateOp(author, unixTime, title, message, files) |
| 107 | for key, val := range metadata { |
| 108 | op.SetMetadata(key, val) |
| 109 | } |
| 110 | if err := op.Validate(); err != nil { |
| 111 | return nil, op, err |
| 112 | } |
| 113 | b.Append(op) |
| 114 | return b, op, nil |
| 115 | } |