name.go 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. package spec
  2. // Name returns a basic string, such as int32,int64
  3. func (t PrimitiveType) Name() string {
  4. return t.RawName
  5. }
  6. // Comments returns the comments of struct
  7. func (t PrimitiveType) Comments() []string {
  8. return nil
  9. }
  10. // Documents returns the documents of struct
  11. func (t PrimitiveType) Documents() []string {
  12. return nil
  13. }
  14. // Name returns a structure string, such as User
  15. func (t DefineStruct) Name() string {
  16. return t.RawName
  17. }
  18. // Comments returns the comments of struct
  19. func (t DefineStruct) Comments() []string {
  20. return nil
  21. }
  22. // Documents returns the documents of struct
  23. func (t DefineStruct) Documents() []string {
  24. return t.Docs
  25. }
  26. // Name returns a map string, such as map[string]int
  27. func (t MapType) Name() string {
  28. return t.RawName
  29. }
  30. // Comments returns the comments of struct
  31. func (t MapType) Comments() []string {
  32. return nil
  33. }
  34. // Documents returns the documents of struct
  35. func (t MapType) Documents() []string {
  36. return nil
  37. }
  38. // Name returns a slice string, such as []int
  39. func (t ArrayType) Name() string {
  40. return t.RawName
  41. }
  42. // Comments returns the comments of struct
  43. func (t ArrayType) Comments() []string {
  44. return nil
  45. }
  46. // Documents returns the documents of struct
  47. func (t ArrayType) Documents() []string {
  48. return nil
  49. }
  50. // Name returns a pointer string, such as *User
  51. func (t PointerType) Name() string {
  52. return t.RawName
  53. }
  54. // Comments returns the comments of struct
  55. func (t PointerType) Comments() []string {
  56. return nil
  57. }
  58. // Documents returns the documents of struct
  59. func (t PointerType) Documents() []string {
  60. return nil
  61. }
  62. // Name returns a interface string, Its fixed value is interface{}
  63. func (t InterfaceType) Name() string {
  64. return t.RawName
  65. }
  66. // Comments returns the comments of struct
  67. func (t InterfaceType) Comments() []string {
  68. return nil
  69. }
  70. // Documents returns the documents of struct
  71. func (t InterfaceType) Documents() []string {
  72. return nil
  73. }