MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / formatRequest

Method formatRequest

sqlchain/observer/api.go:567–597  ·  view source on GitHub ↗
(req *types.Request)

Source from the content-addressed store, hash-verified

565}
566
567func (a *explorerAPI) formatRequest(req *types.Request) map[string]interface{} {
568 // get queries
569 queries := make([]map[string]interface{}, 0, req.Header.BatchCount)
570
571 for _, q := range req.Payload.Queries {
572 args := make([]map[string]interface{}, 0, len(q.Args))
573
574 for _, a := range q.Args {
575 args = append(args, map[string]interface{}{
576 "name": a.Name,
577 "value": a.Value,
578 })
579 }
580
581 queries = append(queries, map[string]interface{}{
582 "pattern": q.Pattern,
583 "args": args,
584 })
585 }
586
587 return map[string]interface{}{
588 "request": map[string]interface{}{
589 "hash": req.Header.Hash().String(),
590 "timestamp": a.formatTime(req.Header.Timestamp),
591 "node": req.Header.NodeID,
592 "type": req.Header.QueryType.String(),
593 "count": req.Header.BatchCount,
594 "queries": queries,
595 },
596 }
597}
598
599func (a *explorerAPI) formatResponseHeader(resp *types.SignedResponseHeader) map[string]interface{} {
600 return map[string]interface{}{

Callers 2

GetRequestMethod · 0.95
formatBlockV3Method · 0.95

Calls 3

formatTimeMethod · 0.95
HashMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected