Add introspection functions

This commit is contained in:
2022-05-07 14:59:04 -07:00
parent ff5f211a83
commit f609d5a97f
5 changed files with 133 additions and 30 deletions

View File

@@ -26,6 +26,9 @@ import (
"github.com/mitchellh/mapstructure"
)
// <= go1.17 compatibility
type any = interface{}
// Convert attempts to convert the given value to the given type
func Convert(in reflect.Value, toType reflect.Type) (reflect.Value, error) {
// Get input type

View File

@@ -18,6 +18,9 @@
package types
// <= go1.17 compatibility
type any = interface{}
// Request represents a request sent to the server
type Request struct {
ID string
@@ -29,15 +32,16 @@ type Request struct {
type ResponseType uint8
const (
ResponseTypeError ResponseType = iota
ResponseTypeNormal ResponseType = iota
ResponseTypeError
ResponseTypeChannel
ResponseTypeChannelDone
)
// Response represents a response returned by the server
type Response struct {
Type ResponseType
ID string
Error string
Return any
Type ResponseType
ID string
Error string
Return any
}