util

package
v0.0.0-...-8c43e32 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2021 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MessageDiff

func MessageDiff(a, b proto.Message, pre string) (r []string, e error)

MessageDiff compares a & b, returns a slice of differing field names

            returns an error if types are different.
			   This borrows a lot from the proto.Merge code

func NodeURLJoin

func NodeURLJoin(node, url string) string

func NodeURLSplit

func NodeURLSplit(s string) (node string, url string)

func ProtoName

func ProtoName(m types.Message) string

func ResolveOrMakeURL

func ResolveOrMakeURL(url string, context reflect.Value) (v reflect.Value, e error)

ResolveOrMakeURL is like ResolveURL, except it will create any referenced but non-defined objects

func ResolveURL

func ResolveURL(url string, context reflect.Value) (v reflect.Value, e error)

ResolveURL turns a state URL (string) into an interface reference

func SliceToURL

func SliceToURL(s []string) (url string)

func StringToValue

func StringToValue(s string, t reflect.Type) (r reflect.Value)

StringToValue creats values for a type. It returns a zero for the type if it's an unsupported type We always return a valid value. If we fail to parse, you get a zero value

func URLPush

func URLPush(url string, elem string) string

func URLShift

func URLShift(url string) (root string, sub string)

URLShift gives the current root of a url and the remaining url

func URLToSlice

func URLToSlice(url string) (s []string)

func ValueToString

func ValueToString(v reflect.Value) (s string)

ValueToString does its best to convert values into sensible strings for printing

Types

type Fixture

type Fixture struct {
	Boolean              bool                   `protobuf:"varint,1,opt,name=Boolean,proto3" json:"Boolean,omitempty"`
	UInt                 uint32                 `protobuf:"varint,2,opt,name=UInt,proto3" json:"UInt,omitempty"`
	Slice                []string               `protobuf:"bytes,3,rep,name=Slice,proto3" json:"Slice,omitempty"`
	Map                  map[string]uint32      `` /* 148-byte string literal not displayed */
	Sub                  *SubFixture            `protobuf:"bytes,5,opt,name=Sub,proto3" json:"Sub,omitempty"`
	SliceSub             []*SubFixture          `protobuf:"bytes,6,rep,name=SliceSub,proto3" json:"SliceSub,omitempty"`
	MapSub               map[uint32]*SubFixture `` /* 154-byte string literal not displayed */
	XXX_NoUnkeyedLiteral struct{}               `json:"-"`
	XXX_unrecognized     []byte                 `json:"-"`
	XXX_sizecache        int32                  `json:"-"`
}

func (*Fixture) Descriptor

func (*Fixture) Descriptor() ([]byte, []int)

func (*Fixture) GetBoolean

func (m *Fixture) GetBoolean() bool

func (*Fixture) GetMap

func (m *Fixture) GetMap() map[string]uint32

func (*Fixture) GetMapSub

func (m *Fixture) GetMapSub() map[uint32]*SubFixture

func (*Fixture) GetSlice

func (m *Fixture) GetSlice() []string

func (*Fixture) GetSliceSub

func (m *Fixture) GetSliceSub() []*SubFixture

func (*Fixture) GetSub

func (m *Fixture) GetSub() *SubFixture

func (*Fixture) GetUInt

func (m *Fixture) GetUInt() uint32

func (*Fixture) ProtoMessage

func (*Fixture) ProtoMessage()

func (*Fixture) Reset

func (m *Fixture) Reset()

func (*Fixture) String

func (m *Fixture) String() string

func (*Fixture) XXX_DiscardUnknown

func (m *Fixture) XXX_DiscardUnknown()

func (*Fixture) XXX_Marshal

func (m *Fixture) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Fixture) XXX_Merge

func (m *Fixture) XXX_Merge(src proto.Message)

func (*Fixture) XXX_Size

func (m *Fixture) XXX_Size() int

func (*Fixture) XXX_Unmarshal

func (m *Fixture) XXX_Unmarshal(b []byte) error

type SubFixture

type SubFixture struct {
	A                    string   `protobuf:"bytes,1,opt,name=A,proto3" json:"A,omitempty"`
	B                    string   `protobuf:"bytes,2,opt,name=B,proto3" json:"B,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*SubFixture) Descriptor

func (*SubFixture) Descriptor() ([]byte, []int)

func (*SubFixture) GetA

func (m *SubFixture) GetA() string

func (*SubFixture) GetB

func (m *SubFixture) GetB() string

func (*SubFixture) ProtoMessage

func (*SubFixture) ProtoMessage()

func (*SubFixture) Reset

func (m *SubFixture) Reset()

func (*SubFixture) String

func (m *SubFixture) String() string

func (*SubFixture) XXX_DiscardUnknown

func (m *SubFixture) XXX_DiscardUnknown()

func (*SubFixture) XXX_Marshal

func (m *SubFixture) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SubFixture) XXX_Merge

func (m *SubFixture) XXX_Merge(src proto.Message)

func (*SubFixture) XXX_Size

func (m *SubFixture) XXX_Size() int

func (*SubFixture) XXX_Unmarshal

func (m *SubFixture) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

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