Passed
Push — main ( 26be31...19cade )
by Yume
01:25
created

models.DeckLogType.ToString   A

Complexity

Conditions 5

Size

Total Lines 10
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 5
eloc 10
nop 0
dl 0
loc 10
rs 9.3333
c 0
b 0
f 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
	DeckCreated DeckLogType = iota + 1
20
	DeckDeleted
21
	DeckEdited
22
)
23
24
func (s DeckLogType) ToString() string {
25
	switch s {
26
	case DeckCreated:
27
		return "Deck Created"
28
	case DeckDeleted:
29
		return "Deck Deleted"
30
	case DeckEdited:
31
		return "Deck Edited"
32
	default:
33
		return "Unknown"
34
	}
35
}
36