-
-
Notifications
You must be signed in to change notification settings - Fork 54
/
Copy pathinput.go
62 lines (53 loc) · 1.06 KB
/
input.go
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package house
import (
"database/sql"
)
// goverter:converter
// goverter:extend SQLStringToPString
type Converter interface {
ConvertHouse(source DBHouse) APIHouse
// goverter:map Name FirstName
// goverter:ignore Age
ConvertPerson(source DBPerson) APIPerson
// goverter:map Owner.Name OwnerName
ConvertApartment(source DBApartment) APIApartment
}
func SQLStringToPString(value sql.NullString) *string {
if value.Valid {
return &value.String
}
return nil
}
type DBHouse struct {
Address string
Apartments map[int]DBApartment
}
type DBApartment struct {
Position uint
Owner DBPerson
CoResident []DBPerson
}
type DBPerson struct {
ID int
Name string
MiddleName sql.NullString
Friends []DBPerson
}
type APIHouse struct {
Address string
Apartments map[APIRoomNR]APIApartment
}
type APIRoomNR int
type APIApartment struct {
Position uint
Owner APIPerson
OwnerName string
CoResident []APIPerson
}
type APIPerson struct {
ID int
MiddleName *string
FirstName *string
Friends []APIPerson
Age int
}