github.com/GeniusesGroup/libgo@v0.0.0-20220929090155-5ff932cb408e/protocol/service-action.go (about) 1 /* For license and copyright information please see LEGAL file in repository */ 2 3 package protocol 4 5 // CRUD indicate all CRUD. 6 type CRUD uint8 7 8 // CRUD 9 // Can mix by binary OR e.g. CRUDCreate|CRUDRead 10 const ( 11 CRUDNone CRUD = 0b00000000 12 CRUDCreate CRUD = 0b00000001 13 CRUDRead CRUD = 0b00000010 14 CRUDUpdate CRUD = 0b00000100 15 CRUDDelete CRUD = 0b00001000 16 // Approve 17 CRUDAll CRUD = 0b11111111 18 ) 19 20 // String return name of crud in app language. 21 func (crud CRUD) String() string { 22 switch AppLanguage { 23 case LanguageEnglish: 24 switch crud { 25 case CRUDNone: 26 return "None" 27 case CRUDCreate: 28 return "Create" 29 case CRUDRead: 30 return "Read" 31 case CRUDUpdate: 32 return "Update" 33 case CRUDDelete: 34 return "Delete" 35 case CRUDAll: 36 return "All" 37 } 38 case LanguagePersian: 39 switch crud { 40 case CRUDNone: 41 return "هیچ کدام" 42 case CRUDCreate: 43 return "ایجاد کردن" 44 case CRUDRead: 45 return "خواندن" 46 case CRUDUpdate: 47 return "بروزرسانی" 48 case CRUDDelete: 49 return "حذف" 50 case CRUDAll: 51 return "همه" 52 } 53 } 54 return "" 55 }