-
Notifications
You must be signed in to change notification settings - Fork 0
/
model.go
37 lines (29 loc) · 1.09 KB
/
model.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
package web
import (
"context"
"github.com/go-pay/limiter"
"github.com/go-pay/xtime"
)
const (
_HookShutdown hookType = "shutdown"
_HookExit hookType = "exit"
)
type hookType string
type HookFunc func(c context.Context)
type Config struct {
Addr string `json:"addr" yaml:"addr" toml:"addr"` // addr, default :2233
ReadTimeout xtime.Duration `json:"read_timeout" yaml:"read_timeout" toml:"read_timeout"` // read_timeout, default 60s
WriteTimeout xtime.Duration `json:"write_timeout" yaml:"write_timeout" toml:"write_timeout"` // write_timeout, default 60s
Debug bool `json:"debug" yaml:"debug" toml:"debug"` // is show log
Limiter *limiter.Config `json:"limiter" yaml:"limiter" toml:"limiter"` // interface limit
}
type CommonRsp struct {
Code int `json:"code"`
Message string `json:"message"`
Data any `json:"data,omitempty"`
}
type HttpRsp[V any] struct {
Code int `json:"code"`
Message string `json:"message"`
Data V `json:"data,omitempty"`
}