gorm.proto 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. syntax = "proto3";
  2. package gorm;
  3. option go_package = "github.com/infobloxopen/protoc-gen-gorm/options;gorm";
  4. import "google/protobuf/descriptor.proto";
  5. // TODO: The option number 52119 lies within the internally reserved extension
  6. // range. I believe a publicly unique number should be requested.
  7. // Currently no file options
  8. extend google.protobuf.FileOptions {
  9. GormFileOptions file_opts = 52119;
  10. }
  11. message GormFileOptions {
  12. }
  13. // Validation rules applied at the message level
  14. extend google.protobuf.MessageOptions {
  15. // ormable will cause orm code to be generated for this message/object
  16. GormMessageOptions opts = 52119;
  17. }
  18. message GormMessageOptions {
  19. bool ormable = 1;
  20. repeated ExtraField include = 2;
  21. string table = 3;
  22. bool multi_account = 4;
  23. }
  24. message ExtraField {
  25. string type = 1;
  26. string name = 2;
  27. GormTag tag = 3;
  28. string package = 4;
  29. }
  30. // Field level specifications
  31. extend google.protobuf.FieldOptions {
  32. GormFieldOptions field = 52119;
  33. }
  34. message GormFieldOptions {
  35. GormTag tag = 1;
  36. bool drop = 2;
  37. oneof association {
  38. HasOneOptions has_one = 3;
  39. BelongsToOptions belongs_to = 4;
  40. HasManyOptions has_many = 5;
  41. ManyToManyOptions many_to_many = 6;
  42. }
  43. string reference_of = 7;
  44. }
  45. message GormTag {
  46. string column = 1;
  47. string type = 2;
  48. int32 size = 3;
  49. int32 precision = 4;
  50. bool primary_key = 5;
  51. bool unique = 6;
  52. string default = 7;
  53. bool not_null = 8;
  54. bool auto_increment = 9;
  55. string index = 10;
  56. string unique_index = 11;
  57. bool embedded = 12;
  58. string embedded_prefix = 13;
  59. bool ignore = 14;
  60. string foreignkey = 15;
  61. string association_foreignkey = 16;
  62. string many_to_many = 17;
  63. string jointable_foreignkey = 18;
  64. string association_jointable_foreignkey = 19;
  65. bool association_autoupdate = 20;
  66. bool association_autocreate = 21;
  67. bool association_save_reference = 22;
  68. bool preload = 23;
  69. }
  70. message HasOneOptions {
  71. string foreignkey = 1;
  72. GormTag foreignkey_tag = 2;
  73. string association_foreignkey = 3;
  74. bool association_autoupdate = 4;
  75. bool association_autocreate = 5;
  76. bool association_save_reference = 6;
  77. bool preload = 7;
  78. bool replace = 8;
  79. bool append = 9;
  80. bool clear = 10;
  81. }
  82. message BelongsToOptions {
  83. string foreignkey = 1;
  84. GormTag foreignkey_tag = 2;
  85. string association_foreignkey = 3;
  86. bool association_autoupdate = 4;
  87. bool association_autocreate = 5;
  88. bool association_save_reference = 6;
  89. bool preload = 7;
  90. }
  91. message HasManyOptions {
  92. string foreignkey = 1;
  93. GormTag foreignkey_tag = 2;
  94. string association_foreignkey = 3;
  95. string position_field = 4;
  96. GormTag position_field_tag = 5;
  97. bool association_autoupdate = 6;
  98. bool association_autocreate = 7;
  99. bool association_save_reference = 8;
  100. bool preload = 9;
  101. bool replace = 10;
  102. bool append = 11;
  103. bool clear = 12;
  104. }
  105. message ManyToManyOptions {
  106. string jointable = 1;
  107. string foreignkey = 2;
  108. string jointable_foreignkey = 3;
  109. string association_foreignkey = 4;
  110. string association_jointable_foreignkey = 5;
  111. bool association_autoupdate = 6;
  112. bool association_autocreate = 7;
  113. bool association_save_reference = 8;
  114. bool preload = 9;
  115. bool replace = 10;
  116. bool append = 11;
  117. bool clear = 13;
  118. }
  119. // To be used in (leiu of) the interceptor
  120. extend google.protobuf.ServiceOptions {
  121. AutoServerOptions server = 52119;
  122. }
  123. message AutoServerOptions {
  124. bool autogen = 1;
  125. bool txn_middleware = 2;
  126. bool with_tracing = 3;
  127. }
  128. extend google.protobuf.MethodOptions {
  129. MethodOptions method = 52119;
  130. }
  131. message MethodOptions {
  132. string object_type = 1;
  133. }