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

app/models/deck.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.DeckStatus.ToString 0 10 5
1
package models
2
3
import (
4
	"gorm.io/gorm"
5
)
6
7
// Deck structure
8
type Deck struct {
9
	gorm.Model  `swaggerignore:"true"`
10
	DeckName    string     `json:"deck_name" example:"First Deck"`
11
	Description string     `json:"deck_description" example:"A simple demo deck"`
12
	Banner      string     `json:"deck_banner" example:"A banner url"`
13
	Status      DeckStatus `json:"deck_status" example:"0"` // 1: Draft - 2: Private - 3: Published
14
}
15
16
type DeckStatus int64
17
18
const (
19
	DeckDraft DeckStatus = iota + 1
20
	DeckPrivate
21
	DeckPublic
22
)
23
24
func (s DeckStatus) ToString() string {
25
	switch s {
26
	case DeckDraft:
27
		return "Deck Draft"
28
	case DeckPrivate:
29
		return "Deck Private"
30
	case DeckPublic:
31
		return "Deck Public"
32
	default:
33
		return "Unknown"
34
	}
35
}
36