wobj

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 3, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckExit

func CheckExit() bool

CheckExit - Проверяем надо ли выходить

func EndRq

func EndRq()

EndRq - отмечаем что запрос закончился

func Init

func Init(p Param) (exitChan chan bool)

Init это функция инициализации

func StartRq

func StartRq(i int)

StartRq - Отмечаем что идет запрос

Types

type Answer

type Answer struct {
	Path     []string
	Redirect string
	Cookie   string
	Data     interface{}
	Exited   bool
	Code     int
	Meta     AnswerMeta
	IsJSON   bool
	CspMap   map[string]string
}

Answer объект содержащий ответ

type AnswerMeta

type AnswerMeta struct {
	Title       string `json:"title"`
	Description string `json:"description"`
}

AnswerMeta объект содержит заголовок и описание страницы

type Cookie struct {
	Name   string
	Domain string
	Path   string
	Time   int
	Secure bool
}

Cookie - Объект с описание кукисов

type Obj

type Obj struct {
	W            http.ResponseWriter
	R            *http.Request
	TimeStart    time.Time
	Ans          Answer
	AppendFunc   func(*Obj, map[string]interface{}) map[string]interface{}
	Cache        map[string]interface{}
	Debug        bool
	ServerTiming bool
}

Obj основной объект запроса

func (*Obj) SendAnswer

func (wo *Obj) SendAnswer()

SendAnswer - функция отправки ответа

func (*Obj) Tmpl

func (wo *Obj) Tmpl() (str string, err error)

Tmpl преобразуем объект в json и шаблонизируем

type Param

type Param struct {
	Port          int
	Route         func(*Obj)
	WsRoute       func(*http.Request, *WsConn)
	WsPath        string
	MaxArgLeg     int
	YateScript    string
	NodeScript    string
	Cookie        Cookie
	CspMap        map[string]string
	Csp           string
	ParseRequest  func(http.ResponseWriter, *http.Request)
	Middlewares   []func(next http.Handler) http.Handler
	PerfomanceLog string
	AlwaysJSON    bool
}

Param это переменные для инициализации класса

type WsConn

type WsConn struct {
	Reader chan []byte
	Writer chan []byte
	Close  chan bool
	Conn   *websocket.Conn
}

WsConn - объект коннекта вебсокета

type WsData

type WsData struct {
	Action string          `json:"action"`
	Data   json.RawMessage `json:"data"`
}

WsData - структура данны хдля веб-сокета

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL