Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebRPCServicesMap - helper variable #69

Closed
wants to merge 2 commits into from
Closed

Conversation

david-littlefarmer
Copy link

Adding WebRPCServicesMap of type map[string]map[string]struct{} for easier checking if service/method exists.

var WebRPCServicesMap = map[string]map[string]struct{}{
	"ExampleAPI": {
		"Ping":     struct{}{},
		"Status":   struct{}{},
		"GetUsers": struct{}{},
	},
}

I know about WebRPCServices but []string is not so convenient for checking if service/method exists, because of iterating of slice.

var WebRPCServices = map[string][]string{
	"ExampleAPI": {
		"Ping",
		"Status",
		"GetUsers",
	},
}

@david-littlefarmer david-littlefarmer changed the title WebRPCServicesMap - helper variabel WebRPCServicesMap - helper variable Apr 29, 2024
@david-littlefarmer david-littlefarmer marked this pull request as draft April 29, 2024 13:00
Copy link
Contributor

@VojtechVitek VojtechVitek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a great idea 🎉 and I think it's implemented as part of #71 right now.

See https://github.com/webrpc/gen-golang/pull/71/files#diff-18cafa6607363936ca43d6b906f9ea824c07f91388bc5b177e9bfd2a0ede1094R33

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants