node

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2022 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FinishDebug

func FinishDebug(ctx context.Context) []byte

FinishDebug строит финальный JSON со всей отладочной информацией

func StartDebug

func StartDebug(ctx context.Context, debug bool) context.Context

StartDebug стартует отладку, если передано true сделано так, чтобы сюда можно было просто передать поле debug из запроса после вызова этой функции с true, начинет работать создание нод ниже по контексту

Types

type DataBlock

type DataBlock interface {
	Type() string
	Data() interface{}
}

type DataBlockJSON

type DataBlockJSON struct {
	Type string
	Data json.RawMessage
}

type DebugJSON

type DebugJSON struct {
	ThisIsDebugger  bool
	DebuggerVersion string
	Nodes           map[string]NodeJSON
}

type DebugViz

type DebugViz struct {
	// contains filtered or unexported fields
}

func (*DebugViz) JSON

func (d *DebugViz) JSON() []byte

type Dummy

type Dummy struct{}

type Node

type Node struct {
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context, name, descr string) (*Node, context.Context)

New создает новую отладочную ноду возвращенный контекст следует обязательно использовать в последующей работе приложения ибо через него будет определяться, какая нода от какой зависит

func NewCollapse

func NewCollapse(ctx context.Context, name, descr string) (*Node, context.Context)

NewCollapse создает новую ноду, которая идет после всех детей текущей ноды контекста используется, когда у вас в функции было запущено несколько горутин с нодами, они отработали и нужно, чтобы создаваемая нода шла после них в схеме то есть, когда выполнение программы разветвилось, а потом результат выполнения соединился обратно

           ┌───────┐
           │ node1 │ <- контекст этой ноды передаём в NewCollapse(...)
           └┬──┬──┬┘
┌───────────┘  │  └───────────┐

┌───▼───┐ ┌───▼───┐ ┌───▼───┐ │ node2 │ │ node3 │ │ node4 │ <- эти ребята отработали независимо в горутинах └───┬───┘ └───┬───┘ └───┬───┘

└────────────┐ │ ┌────────────┘
      -------│ │ │-------- collapse
           ┌─▼─▼─▼─┐
           │ node5 │ <- нода, созданная функцией NewCollapse(...)
           └───────┘

func (*Node) Data

func (n *Node) Data() NodeJSON

func (*Node) NewRequestBlock

func (n *Node) NewRequestBlock(serviceName, handlerName string) *request.Block

func (*Node) NewTableBlock

func (n *Node) NewTableBlock(caption string) *table.Block

func (*Node) Print

func (n *Node) Print(values ...interface{}) *Node

func (*Node) Printf

func (n *Node) Printf(template string, params ...interface{}) *Node

type NodeID

type NodeID int64

func (NodeID) String

func (n NodeID) String() string

type NodeJSON

type NodeJSON struct {
	ID         string
	Name       string
	Descr      string
	DependsOn  []string
	Text       []string
	DataBlocks []DataBlockJSON
	DebugViz   json.RawMessage
}

Jump to

Keyboard shortcuts

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