Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
2
22a7f0099
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Summer2022
22a7f0099
Commits
a1e8e535
Commit
a1e8e535
authored
3 years ago
by
Patrick
Browse files
Options
Downloads
Patches
Plain Diff
add BaseApplicationMetadataIdentifier
parent
631e1f34
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
metadata/identifier/base_metadata_identifier.go
+17
-0
17 additions, 0 deletions
metadata/identifier/base_metadata_identifier.go
metadata/identifier/subscribe_metadata_identifier.go
+5
-6
5 additions, 6 deletions
metadata/identifier/subscribe_metadata_identifier.go
with
22 additions
and
6 deletions
metadata/identifier/base_metadata_identifier.go
+
17
−
0
View file @
a1e8e535
...
...
@@ -90,3 +90,20 @@ func withPathSeparator(path string) string {
}
return
path
}
// BaseApplicationMetadataIdentifier is the base implement of BaseApplicationMetadataIdentifier interface
type
BaseApplicationMetadataIdentifier
struct
{
Application
string
}
// getIdentifierKey returns string that format is service:Version:Group:Side:param1:param2...
func
(
madi
*
BaseApplicationMetadataIdentifier
)
getIdentifierKey
(
params
...
string
)
string
{
return
madi
.
Application
+
joinParams
(
constant
.
KEY_SEPARATOR
,
params
)
}
// getFilePathKey returns string that format is metadata/application/revision
func
(
madi
*
BaseApplicationMetadataIdentifier
)
getFilePathKey
(
params
...
string
)
string
{
return
constant
.
DEFAULT_PATH_TAG
+
madi
.
Application
+
joinParams
(
constant
.
PATH_SEPARATOR
,
params
)
}
This diff is collapsed.
Click to expand it.
metadata/identifier/subscribe_metadata_identifier.go
+
5
−
6
View file @
a1e8e535
...
...
@@ -20,25 +20,24 @@ package identifier
// SubscriberMetadataIdentifier is inherit baseMetaIdentifier with service params: Revision
type
SubscriberMetadataIdentifier
struct
{
Revision
string
MetadataIdentifier
BaseApplication
MetadataIdentifier
}
func
NewSubscriberMetadataIdentifier
(
application
string
,
revision
string
)
*
SubscriberMetadataIdentifier
{
return
&
SubscriberMetadataIdentifier
{
Revision
:
revision
,
MetadataIdentifier
:
MetadataIdentifier
{
Application
:
application
,
BaseMetadataIdentifier
:
BaseMetadataIdentifier
{},
BaseApplicationMetadataIdentifier
:
BaseApplicationMetadataIdentifier
{
Application
:
application
,
},
}
}
// GetIdentifierKey returns string that format is service:Version:Group:Side:Revision
func
(
mdi
*
SubscriberMetadataIdentifier
)
GetIdentifierKey
()
string
{
return
mdi
.
BaseMetadataIdentifier
.
getIdentifierKey
(
mdi
.
Revision
)
return
mdi
.
Base
Application
MetadataIdentifier
.
getIdentifierKey
(
mdi
.
Revision
)
}
// GetFilePathKey returns string that format is metadata/path/Version/Group/Side/Revision
func
(
mdi
*
SubscriberMetadataIdentifier
)
GetFilePathKey
()
string
{
return
mdi
.
BaseMetadataIdentifier
.
getFilePathKey
(
mdi
.
Revision
)
return
mdi
.
Base
Application
MetadataIdentifier
.
getFilePathKey
(
mdi
.
Revision
)
}
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment