123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- package rest
- /*
- type IResponse interface {
- IsError() bool
- KeySet(key string, val any)
- FileSet(name string, file IReadCloserLen)
- Close()
- Send(writer any) IErrorArgs
- }
- func NewResponse() *Response {
- return &Response{
- RCode: 200,
- RData: make(json.Map),
- RFiles: make(map[string]IReadCloserLen),
- }
- }
- type Response struct {
- RCode int
- RErr IErrorArgs
- RData json.Map
- RFiles map[string]IReadCloserLen
- }
- func (s *Response) IsError() bool {
- return s.RCode != 200
- }
- func (s *Response) KeySet(key string, val any) {
- s.RData[key] = val
- }
- func (s *Response) FileSet(name string, file IReadCloserLen) {
- s.RFiles[name] = file
- }
- func (s *Response) Close() {
- for _, file := range s.RFiles {
- file.Close()
- }
- }
- func (s *Response) Code() int {
- return s.RCode
- }
- func (s *Response) Data() json.Map {
- return s.RData
- }
- func (s *Response) Files() map[string]IReadCloserLen {
- return s.RFiles
- }
- func (s *Response) Err() IErrorArgs {
- return s.RErr
- }
- */
|