diff --git a/common.go b/common.go index 2c06713d..f041c8df 100644 --- a/common.go +++ b/common.go @@ -24,6 +24,7 @@ package span import ( + "encoding/base64" "fmt" ) @@ -45,3 +46,11 @@ type Skip struct { func (s Skip) Error() string { return fmt.Sprintf("[skip] %s", s.Reason) } + +// GenFincID returns a finc.id string consisting of an arbitraty prefix (e.g. +// "ai"), source id and URL safe record id. No additional checks, sid and rid +// should not be empty. +func GenFincID(sid, rid string) string { + return fmt.Sprintf("ai-%s-%s", sid, + base64.RawURLEncoding.EncodeToString([]byte(rid))) +} diff --git a/id_test.go b/common_test.go similarity index 100% rename from id_test.go rename to common_test.go diff --git a/id.go b/id.go deleted file mode 100644 index 285be663..00000000 --- a/id.go +++ /dev/null @@ -1,14 +0,0 @@ -package span - -import ( - "encoding/base64" - "fmt" -) - -// GenFincID returns a finc.id string consisting of an arbitraty prefix (e.g. -// "ai"), source id and URL safe record id. No additional checks, sid and rid -// should not be empty. -func GenFincID(sid, rid string) string { - return fmt.Sprintf("ai-%s-%s", sid, - base64.RawURLEncoding.EncodeToString([]byte(rid))) -}