-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9983e26
commit c964153
Showing
10 changed files
with
129 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package jetstream | ||
|
||
import ( | ||
"github.com/foomo/keel/markdown" | ||
) | ||
|
||
type ( | ||
publisher struct { | ||
Namespace string | ||
Stream string | ||
Subject string | ||
} | ||
subscriber struct { | ||
Namespace string | ||
Stream string | ||
Subject string | ||
} | ||
) | ||
|
||
var ( | ||
publishers []publisher | ||
subscribers []subscriber | ||
) | ||
|
||
func Readme() string { | ||
if len(publishers) == 0 && len(subscribers) == 0 { | ||
return "" | ||
} | ||
|
||
var rows [][]string | ||
md := &markdown.Markdown{} | ||
md.Println("### NATS") | ||
md.Println("") | ||
md.Println("List of all registered nats publishers & subscribers.") | ||
md.Println("") | ||
|
||
if len(publishers) > 0 { | ||
for _, value := range publishers { | ||
rows = append(rows, []string{ | ||
markdown.Code(value.Namespace), | ||
markdown.Code(value.Stream), | ||
markdown.Code(value.Subject), | ||
markdown.Code("publish"), | ||
}) | ||
} | ||
} | ||
|
||
if len(subscribers) > 0 { | ||
for _, value := range subscribers { | ||
rows = append(rows, []string{ | ||
markdown.Code(value.Namespace), | ||
markdown.Code(value.Stream), | ||
markdown.Code(value.Subject), | ||
markdown.Code("subscribe"), | ||
}) | ||
} | ||
} | ||
|
||
md.Table([]string{"Namespace", "Stream", "Subject", "Type"}, rows) | ||
|
||
return md.String() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters