unit_scope.go 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. package voipHelpers
  2. import (
  3. "fmt"
  4. m "devel.mephi.ru/dyokunev/go-asu-models"
  5. I "devel.mephi.ru/dyokunev/wwwvoip/app/iface"
  6. vModels "devel.mephi.ru/dyokunev/wwwvoip/app/models"
  7. "github.com/xaionaro/reform"
  8. )
  9. var (
  10. ErrCannotModify error = fmt.Errorf("Modifying of this object is forbidden")
  11. ErrNotImplemented error = fmt.Errorf("Not implemented (yet?)")
  12. )
  13. type UnitScope struct {
  14. m.UnitScope
  15. vModels.ItemCommon
  16. }
  17. func NewUnitScope(scope m.UnitScope) *UnitScope {
  18. return &UnitScope{UnitScope: scope}
  19. }
  20. func (scope UnitScope) IsStruct() bool {
  21. return false
  22. }
  23. func (scope UnitScope) BeforeSave() error {
  24. return nil
  25. }
  26. func (scope UnitScope) AfterRestore() {
  27. return
  28. }
  29. func (scope UnitScope) GetKeyColumnName() string {
  30. panic(ErrNotImplemented)
  31. return ""
  32. }
  33. func (scope UnitScope) GetReformDB() *reform.DB {
  34. panic(ErrNotImplemented)
  35. return nil
  36. }
  37. func (scope UnitScope) IWhere(requiredArg interface{}, in_args ...interface{}) I.Scope {
  38. return NewUnitScope(*scope.Where(requiredArg, in_args...))
  39. }
  40. func (scope UnitScope) CanCache() bool {
  41. return false
  42. }
  43. func (scope UnitScope) CanSave() error {
  44. return ErrCannotModify
  45. }
  46. func (scope UnitScope) Create(controller I.Controller) error {
  47. return ErrCannotModify
  48. }
  49. func (scope UnitScope) Destroy(controller I.Controller) error {
  50. return ErrCannotModify
  51. }
  52. func (scope UnitScope) DefaultReformQuerier() I.ReformBackendQuerier {
  53. panic(ErrNotImplemented)
  54. return nil
  55. }
  56. func (scope UnitScope) FieldPtrByName(fieldName string) interface{} {
  57. panic(ErrNotImplemented)
  58. return nil
  59. }
  60. func (scope UnitScope) FieldValueByName(fieldName string) interface{} {
  61. panic(ErrNotImplemented)
  62. return nil
  63. }
  64. func (scope UnitScope) FlushCache() error {
  65. return nil
  66. }
  67. func (scope UnitScope) GetDisplayName() string {
  68. panic(ErrNotImplemented)
  69. return ""
  70. }
  71. func (scope UnitScope) IAsuFindByKey(key interface{}) (I.Item, error) {
  72. panic(ErrNotImplemented)
  73. return nil, nil
  74. }
  75. func (scope UnitScope) IDB(db *reform.DB) I.Scope {
  76. panic(ErrNotImplemented)
  77. return nil
  78. }
  79. func (scope UnitScope) IDiffFieldsTo(compareItem I.Item) [][]string {
  80. panic(ErrNotImplemented)
  81. return nil
  82. }
  83. func (scope UnitScope) IElem() (I.Item) {
  84. panic(ErrNotImplemented)
  85. return nil
  86. }
  87. func (scope UnitScope) IFirst(args ...interface{}) (I.Item, error) {
  88. panic(ErrNotImplemented)
  89. return nil, nil
  90. }
  91. func (scope UnitScope) IFixPairByFieldName(fieldName string) I.ItemPtr {
  92. panic(ErrNotImplemented)
  93. return nil
  94. }
  95. func (scope UnitScope) IGetTemplatesForSimilars() (result []I.Item) {
  96. panic(ErrNotImplemented)
  97. return nil
  98. }
  99. func (scope UnitScope) IGroup(argsI ...interface{}) I.Scope {
  100. panic(ErrNotImplemented)
  101. return nil
  102. }
  103. func (scope UnitScope) IIsIdenticalTo(compareItem I.Item) bool {
  104. panic(ErrNotImplemented)
  105. return false
  106. }
  107. func (scope UnitScope) ILimit(limit int) I.Scope {
  108. panic(ErrNotImplemented)
  109. return nil
  110. }
  111. func (scope UnitScope) INewKeyMap() I.ItemKeyMap {
  112. panic(ErrNotImplemented)
  113. return nil
  114. }
  115. func (scope UnitScope) IOrder(argsI ...interface{}) I.Scope {
  116. panic(ErrNotImplemented)
  117. return nil
  118. }
  119. func (scope UnitScope) IPrepareForRender() I.ItemPtr {
  120. panic(ErrNotImplemented)
  121. return nil
  122. }
  123. func (scope UnitScope) ISelect(args ...interface{}) (I.Slice, error) {
  124. panic(ErrNotImplemented)
  125. return nil, nil
  126. }
  127. func (scope UnitScope) ISetDB(dbI interface{}) I.ItemPtr {
  128. panic(ErrNotImplemented)
  129. return nil
  130. }
  131. func (scope UnitScope) ISetGroup(group []string) I.Scope {
  132. panic(ErrNotImplemented)
  133. return nil
  134. }
  135. func (scope UnitScope) ISetOrder(order []string) I.Scope {
  136. panic(ErrNotImplemented)
  137. return nil
  138. }
  139. func (scope UnitScope) ISetReformScope(anotherScope reform.GormImitateScope) reform.GormImitateScope {
  140. panic(ErrNotImplemented)
  141. return nil
  142. }
  143. func (scope UnitScope) ISetWhere(where [][]interface{}) I.Scope {
  144. panic(ErrNotImplemented)
  145. return nil
  146. }
  147. func (scope UnitScope) Model(newModel I.Model) I.Scope {
  148. panic(ErrNotImplemented)
  149. return nil
  150. }