Line data Source code
1 : // Package request は HTTP ハンドラが受け取る入力DTO(Query/Body)の型をまとめます。
2 : package request
3 :
4 : // ListUserAddressQuery は /profile/address のクエリパラメータ。
5 : type ListUserAddressQuery struct {
6 : ListPagingQuery
7 : Sort string `form:"sort" binding:"omitempty,sort_key=addresses"`
8 : PurposeID *uint64 `form:"purpose_id" binding:"omitempty"`
9 : Country *string `form:"country" binding:"omitempty"`
10 : City *string `form:"city" binding:"omitempty"`
11 : }
12 :
13 : // Normalize はゼロ値にデフォルト値を入れたり、上限等を丸めます。
14 0 : func (q *ListUserAddressQuery) Normalize() {
15 0 : q.ListPagingQuery.Normalize()
16 0 :
17 0 : if q.Sort == "" {
18 0 : q.Sort = "created_at"
19 0 : }
20 : }
|