2020-05-13 19:46:49 +02:00
|
|
|
package entity
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
|
|
|
type LensMap map[string]Lens
|
|
|
|
|
|
|
|
func (m LensMap) Get(name string) Lens {
|
|
|
|
if result, ok := m[name]; ok {
|
|
|
|
return result
|
|
|
|
}
|
|
|
|
|
|
|
|
return *NewLens(name, "")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m LensMap) Pointer(name string) *Lens {
|
|
|
|
if result, ok := m[name]; ok {
|
|
|
|
return &result
|
|
|
|
}
|
|
|
|
|
|
|
|
return NewLens(name, "")
|
|
|
|
}
|
|
|
|
|
|
|
|
var LensFixtures = LensMap{
|
|
|
|
"lens-f-380": {
|
|
|
|
ID: 1000000,
|
|
|
|
LensSlug: "lens-f-380",
|
2020-05-29 18:04:30 +02:00
|
|
|
LensName: "Apple F380",
|
2020-05-13 19:46:49 +02:00
|
|
|
LensMake: "Apple",
|
2020-05-29 18:04:30 +02:00
|
|
|
LensModel: "F380",
|
2020-05-13 19:46:49 +02:00
|
|
|
LensType: "",
|
|
|
|
LensDescription: "",
|
|
|
|
LensNotes: "Notes",
|
|
|
|
CreatedAt: time.Date(2019, 1, 1, 0, 0, 0, 0, time.UTC),
|
|
|
|
UpdatedAt: time.Date(2019, 1, 1, 0, 0, 0, 0, time.UTC),
|
|
|
|
DeletedAt: nil,
|
|
|
|
},
|
2022-04-02 20:13:56 +02:00
|
|
|
"4.15mm-f/2.2": {
|
|
|
|
ID: 1000001,
|
|
|
|
LensSlug: "4.15mm-f/2.2",
|
|
|
|
LensName: "Apple iPhone SE back camera 4.15mm f/2.2",
|
|
|
|
LensMake: "Apple",
|
|
|
|
LensModel: "iPhone SE back camera 4.15mm f/2.2",
|
|
|
|
LensType: "",
|
|
|
|
LensDescription: "",
|
|
|
|
LensNotes: "Notes",
|
|
|
|
CreatedAt: time.Date(2019, 1, 1, 0, 0, 0, 0, time.UTC),
|
|
|
|
UpdatedAt: time.Date(2019, 1, 1, 0, 0, 0, 0, time.UTC),
|
|
|
|
DeletedAt: nil,
|
|
|
|
},
|
2020-05-13 19:46:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// CreateLensFixtures inserts known entities into the database for testing.
|
|
|
|
func CreateLensFixtures() {
|
|
|
|
for _, entity := range LensFixtures {
|
|
|
|
Db().Create(&entity)
|
|
|
|
}
|
|
|
|
}
|