blob: c8c6538618f0856037cb16f504031633452a7dda (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
package grils
import (
"database/sql"
"fmt"
"strconv"
"strings"
"time"
"github.com/lib/pq"
)
type DataSource int
const (
DataSourceACD DataSource = iota
DataSourceAniDB
)
type Gril struct {
ID int
KanjiName string
RomajiName string
OtherNames []string
Age sql.NullInt64
Birthday pq.NullTime
Tags []string
ForeignIDs map[DataSource]int
UpdatedAt time.Time
Lists []int
}
func (g *Gril) Slug() string {
if g.RomajiName == "" {
return strconv.Itoa(g.ID)
}
return fmt.Sprintf(
"%d/%s",
g.ID,
strings.Replace(g.RomajiName, " ", "", -1))
}
|