/
handler.go
50 lines (44 loc) · 1.02 KB
/
handler.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
package web
import (
"time"
)
// GenericListResponse[T]
// @Description Some Generic List Response
type GenericListResponse[T any] struct {
// Items from the list response
Items []T
// Status of some other stuff
Status string
}
// GenericListResponseMulti[T, X]
// @Description this contains a few things
type GenericListResponseMulti[T any, X any] struct {
// ItemsOne is the first thing
ItemsOne []T
// ItemsTwo is the second thing
ItemsTwo []X
// Status of the things
Status string
}
type Post struct {
ID int `json:"id" example:"1" format:"int64"`
// Post name
Name string `json:"name" example:"poti"`
// Post data
Data struct {
// Post tag
Tag []string `json:"name"`
} `json:"data"`
}
// APIError
// @Description API error
// @Description with information about it
// Other some summary
type APIError struct {
// Error an Api error
Error string // Error this is Line comment
// Error `number` tick comment
ErrorNo int64
ErrorCtx string // Error `context` tick comment
CreatedAt time.Time // Error time
}