Version: v1.0.7 Latest Latest

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

Go to latest
Published: May 14, 2021 License: MIT Imports: 5 Imported by: 0




View Source
const JournalHeader = "Journal-Id"

JournalHeader http/rpc header中的名字


This section is empty.


func ToJournalHeader

func ToJournalHeader(header http.Header) map[string]string


type Dialog

type Dialog struct {
	Request     *Request    `json:"request"`
	Responses   []*Response `json:"responses"`
	Success     bool        `json:"success"`
	CostSeconds float64     `json:"cost_seconds"`
	// contains filtered or unexported fields

Dialog 内部调用其它方接口的会话信息;失败时会有retry操作,所以response会有多次。

func (*Dialog) AppendResponse

func (d *Dialog) AppendResponse(resp *Response)

AppendResponse 按转的追加response信息

func (*Dialog) ID

func (d *Dialog) ID() string

ID ...

type Journal

type Journal struct {
	Identifier  string    `json:"id"`
	Request     *Request  `json:"request"`
	Response    *Response `json:"response"`
	Dialogs     []*Dialog `json:"dialogs"`
	Success     bool      `json:"success"`
	CostSeconds float64   `json:"cost_seconds"`
	// contains filtered or unexported fields

Journal 包含一次rpc请求的全部参数和内部调用其它方接口的过程

func NewJournal

func NewJournal(id string) *Journal

NewJournal 创建Journal

func (*Journal) AppendDialog

func (j *Journal) AppendDialog(dialog *Dialog) *Journal

AppendDialog 安全的追加内部调用过程dialog

func (*Journal) ID

func (j *Journal) ID() string

ID 唯一标识符

func (*Journal) WithRequest

func (j *Journal) WithRequest(req *Request) *Journal

WithRequest 设置request

func (*Journal) WithResponse

func (j *Journal) WithResponse(resp *Response) *Journal

WithResponse 设置response

type Request

type Request struct {
	TTL        string            `json:"ttl"`
	Method     string            `json:"method"`
	DecodedURL string            `json:"decoded_url"`
	Header     map[string]string `json:"header"`
	Body       string            `json:"body"`

Request 请求信息

type Response

type Response struct {
	Header      map[string]string `json:"header"`
	StatusCode  int               `json:"status_code"`
	Status      string            `json:"status"`
	Body        interface{}       `json:"body"`
	CostSeconds float64           `json:"cost_seconds"`

Response 响应信息

type T

type T interface {
	ID() string
	// contains filtered or unexported methods

T 约束

Source Files

Jump to

Keyboard shortcuts

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