| Total Lines | 34 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | package models |
||
| 2 | |||
| 3 | import ( |
||
| 4 | "gorm.io/gorm" |
||
| 5 | ) |
||
| 6 | |||
| 7 | // Mem structure |
||
| 8 | type DeckLogs struct { |
||
| 9 | gorm.Model |
||
| 10 | DeckID uint `json:"deck_id" example:"1"` |
||
| 11 | Deck Deck |
||
| 12 | LogType DeckLogType `json:"deck_log_type" example:"1"` |
||
| 13 | Message string `json:"deck_message" example:"Added a new card"` |
||
| 14 | } |
||
| 15 | |||
| 16 | type DeckLogType int64 |
||
| 17 | |||
| 18 | const ( |
||
| 19 | DeckUndefined DeckLogType = iota |
||
| 20 | DeckCreated |
||
| 21 | DeckDeleted |
||
| 22 | DeckEdited |
||
| 23 | ) |
||
| 24 | |||
| 25 | func (s DeckLogType) ToString() string { |
||
| 26 | switch s { |
||
| 27 | case DeckCreated: |
||
| 28 | return "Deck Created" |
||
| 29 | case DeckDeleted: |
||
| 30 | return "Deck Deleted" |
||
| 31 | case DeckEdited: |
||
| 32 | return "Deck Edited" |
||
| 33 | default: |
||
| 34 | return "Unknown" |
||
| 35 | } |
||
| 37 |