2020-05-01 13:10:43 +02:00
|
|
|
package entity
|
|
|
|
|
2020-05-10 19:43:49 +02:00
|
|
|
type KeywordMap map[string]Keyword
|
|
|
|
|
2020-05-11 14:41:20 +02:00
|
|
|
func (m KeywordMap) Get(name string) Keyword {
|
|
|
|
if result, ok := m[name]; ok {
|
|
|
|
return result
|
|
|
|
}
|
|
|
|
|
|
|
|
return *NewKeyword(name)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m KeywordMap) Pointer(name string) *Keyword {
|
|
|
|
if result, ok := m[name]; ok {
|
|
|
|
return &result
|
|
|
|
}
|
|
|
|
|
|
|
|
return NewKeyword(name)
|
|
|
|
}
|
|
|
|
|
2020-05-10 19:43:49 +02:00
|
|
|
var KeywordFixtures = KeywordMap{
|
2020-05-01 13:10:43 +02:00
|
|
|
"bridge": {
|
|
|
|
ID: 1000000,
|
|
|
|
Keyword: "bridge",
|
|
|
|
Skip: false,
|
|
|
|
},
|
|
|
|
"beach": {
|
|
|
|
ID: 1000001,
|
|
|
|
Keyword: "beach",
|
|
|
|
Skip: false,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
// CreateKeywordFixtures inserts known entities into the database for testing.
|
|
|
|
func CreateKeywordFixtures() {
|
|
|
|
for _, entity := range KeywordFixtures {
|
|
|
|
Db().Create(&entity)
|
|
|
|
}
|
|
|
|
}
|