forked from sirkon/protoast
-
Notifications
You must be signed in to change notification settings - Fork 0
/
service.go
47 lines (36 loc) · 819 Bytes
/
service.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package ast
var _ Node = (*Service)(nil)
var _ Named = (*Service)(nil)
var _ Commented = (*Service)(nil)
var _ OptionsBearer = (*Service)(nil)
// Service представление для сервисов
type Service struct {
unique
File *File
Name string
Comment *Comment
Methods []*Method
Options []*Option
}
func (s *Service) GetComment() *Comment {
return s.Comment
}
func (s *Service) GetOptions() []*Option {
return s.Options
}
// Method поиск метода по имени
func (s *Service) Method(name string) *Method {
for _, method := range s.Methods {
if method.Name == name {
return method
}
}
return nil
}
func (s *Service) GetName() string {
return s.Name
}
func (s *Service) GetFullName() string {
return s.File.Package + "." + s.Name
}
func (s *Service) node() {}