web

package
v0.0.0-...-c772d2a Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2020 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Normalize

func Normalize(data string) string

This function expects that the json is well-formed.

Types

type HttpListener

type HttpListener struct {
	JsonCommandParser       core_interface.JsonCommandParser
	BlockDBCommandProcessor core_interface.BlockDBCommandProcessor
	Config                  HttpListenerConfig
	BusinessReader          *core.BusinessReader
	// contains filtered or unexported fields
}

func (*HttpListener) Action

func (l *HttpListener) Action(rw http.ResponseWriter, req *http.Request)

func (*HttpListener) Actions

func (l *HttpListener) Actions(rw http.ResponseWriter, req *http.Request)

func (*HttpListener) CurrentValue

func (l *HttpListener) CurrentValue(rw http.ResponseWriter, req *http.Request)

func (*HttpListener) Handle

func (l *HttpListener) Handle(rw http.ResponseWriter, req *http.Request)

func (*HttpListener) Health

func (l *HttpListener) Health(rw http.ResponseWriter, req *http.Request)

func (*HttpListener) Info

func (l *HttpListener) Info(rw http.ResponseWriter, req *http.Request)

func (*HttpListener) Name

func (l *HttpListener) Name() string

func (*HttpListener) Setup

func (l *HttpListener) Setup()

func (*HttpListener) Start

func (l *HttpListener) Start()

func (*HttpListener) Stop

func (l *HttpListener) Stop()

func (*HttpListener) Value

func (l *HttpListener) Value(rw http.ResponseWriter, req *http.Request)

func (*HttpListener) Values

func (l *HttpListener) Values(rw http.ResponseWriter, req *http.Request)

type HttpListenerConfig

type HttpListenerConfig struct {
	Port              int
	MaxContentLength  int64
	DBActionTimeoutMs int
}

type Message

type Message struct {
	OpStr     json.RawMessage `json:"op_str"`
	PublicKey string          `json:"public_key"`
	OpHash    string          `json:"op_hash"`
	Signature string          `json:"signature"`
}

type Result

type Result struct {
	// Type is the json type
	Type Type
	// Raw is the raw json
	Raw string
	// Str is the json string
	Str string
	// Num is the json number
	Num float64
	// Index of raw value in original json, zero means index unknown
	Index int
}

Result represents a json value that is returned from Get().

func Parse

func Parse(json string) Result

Parse parses the json and returns a result.

This function expects that the json is well-formed, and does not validate. Invalid json will not panic, but it may return back unexpected results. If you are consuming JSON from an unpredictable source then you may want to use the Valid function first.

func (Result) Value

func (t Result) Value() interface{}

Value returns one of these types:

bool, for JSON booleans
float64, for JSON numbers
Number, for JSON numbers
string, for JSON string literals
nil, for JSON null
map[string]interface{}, for JSON objects
[]interface{}, for JSON arrays

type Type

type Type int

Type is Result type

const (
	// Null is a null json value
	Null Type = iota
	// False is a json false boolean
	False
	// Number is json number
	Number
	// String is a json string
	String
	// True is a json true boolean
	True
	// JSON is a raw block of JSON
	JSON
)

Jump to

Keyboard shortcuts

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