Line data Source code
1 : // Package request は HTTP ハンドラが受け取る入力DTO(Query/Body)の型をまとめます。
2 : package request
3 :
4 : // ListIdentitiesQuery は /profile/identities のクエリパラメータ。
5 : type ListIdentitiesQuery struct {
6 : // ページング共通部
7 : ListPagingQuery
8 :
9 : // 並び替えキー。許容値は sort_key バリデータで制御。
10 : // 例: created_at / provider / uid / email_at_signup
11 : Sort string `form:"sort" binding:"omitempty,sort_key=identities"`
12 :
13 : // フリーテキスト検索。未指定なら空扱い。
14 : Q *string `form:"q" binding:"omitempty,max=200"`
15 : }
16 :
17 : // Normalize はゼロ値にデフォルト値を入れたり、上限等を丸めます。
18 0 : func (q *ListIdentitiesQuery) Normalize() {
19 0 : // ページング共通処理
20 0 : q.ListPagingQuery.Normalize()
21 0 :
22 0 : // ソートキーのデフォルト
23 0 : if q.Sort == "" {
24 0 : q.Sort = "created_at"
25 0 : }
26 : }
|