47 lines
847 B
Go
47 lines
847 B
Go
package cli
|
|
|
|
import "time"
|
|
|
|
type Param struct {
|
|
Key string
|
|
Value string
|
|
}
|
|
|
|
type Params []Param
|
|
|
|
type HandleFunc func(ctx *Context) (err error)
|
|
|
|
type Middleware func(next HandleFunc) HandleFunc
|
|
|
|
type responsePayload struct {
|
|
Type uint8 `json:"-"`
|
|
Code int `json:"code"`
|
|
Reason string `json:"reason,omitempty"`
|
|
Data any `json:"data,omitempty"`
|
|
}
|
|
|
|
type Info struct {
|
|
ID int64 `json:"id"`
|
|
OS string `json:"os"`
|
|
Name string `json:"name"`
|
|
Version string `json:"version"`
|
|
ServerTime time.Time `json:"server_time"`
|
|
RemoteAddr string `json:"remote_addr"`
|
|
}
|
|
|
|
type Command struct {
|
|
Path string
|
|
Handle HandleFunc
|
|
Description string
|
|
}
|
|
|
|
type commander struct {
|
|
Name string
|
|
Path string
|
|
Description string
|
|
}
|
|
|
|
type encoder interface {
|
|
Marshal() ([]byte, error)
|
|
}
|