File size: 520 Bytes
16cdcb7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
package subscriptionworkflow

import (
	"github.com/oklog/ulid/v2"

	"github.com/openmeterio/openmeter/pkg/models"
)

const (
	AnnotationEditUniqueKey = "subscription.workflow.patchid"
)

type annotationParser struct{}

var AnnotationParser = annotationParser{}

func (a annotationParser) SetUniquePatchID(annotations models.Annotations) models.Annotations {
	id := ulid.Make().String()

	if annotations == nil {
		annotations = models.Annotations{}
	}

	annotations[AnnotationEditUniqueKey] = id

	return annotations
}