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

app/models/deck_logs.go   A

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
cc 5
eloc 23
dl 0
loc 33
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A models.DeckLogType.ToString 0 10 5
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