Passed
Push — main ( 3bacef...ab25eb )
by Yume
01:02
created

app/models/logs_deck.go   A

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
cc 5
eloc 24
dl 0
loc 34
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
	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
	}
36
}
37