Implementing list endpoints

This commit is contained in:
Brandon Watson
2023-08-14 20:21:33 -05:00
parent 6799b59f9c
commit bdb7a39a91
8 changed files with 135 additions and 12 deletions

View File

@ -34,6 +34,13 @@ func (s *charactersrvc) GetCharacter(ctx context.Context, p *character.GetCharac
return
}
func (s *charactersrvc) ListCharacters(ctx context.Context) (res []*character.Character, err error) {
for _, value := range s.characters {
res = append(res, value)
}
return
}
// CreateCharacter implements createCharacter.
func (s *charactersrvc) CreateCharacter(ctx context.Context, p *character.Character) (res *character.Character, err error) {
s.logger.Print("character.createCharacter")

View File

@ -33,8 +33,14 @@ var _ = Service("character", func() {
})
})
// Method("listCharacters", func() {
// })
Method("listCharacters", func() {
Payload(Empty)
Result(ArrayOf(Character))
GRPC(func() {
Response(CodeOK)
})
})
Method("createCharacter", func() {
Payload(Character)