payload

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArrayTransformer

func ArrayTransformer(value *interface{}) *arrayTransformer

ArrayTransformer : return the array/slice transformer for the specific map type

func Empty

func Empty() moleculer.Payload

func EmptyList

func EmptyList() moleculer.Payload

func Error

func Error(msgs ...interface{}) moleculer.Payload

func GetValueType

func GetValueType(value *interface{}) string

GetValueType : return a string that represents the map type. examples: map[string]int , map[string]string, map[string]float32 and etc there are a few possible implementations, Reflection is not very popular in GO.. so this uses mt.Sprintf .. but we need to test a second version of this with Reflect to check what is faster

func MapTransformer

func MapTransformer(value *interface{}) *mapTransformer

MapTransformer : return the map transformer for the specific map type

func New

func New(source interface{}) moleculer.Payload

Types

type RawPayload

type RawPayload struct {
	// contains filtered or unexported fields
}

RawPayload is a payload implementation for raw types.

func (*RawPayload) Add

func (p *RawPayload) Add(field string, value interface{}) moleculer.Payload

Add add the field:value pair to the existing values and return a new payload.

func (*RawPayload) AddItem

func (p *RawPayload) AddItem(value interface{}) moleculer.Payload

func (*RawPayload) AddMany

func (p *RawPayload) AddMany(toAdd map[string]interface{}) moleculer.Payload

AddMany merge the maps with eh existing values and return a new payload.

func (*RawPayload) Array

func (p *RawPayload) Array() []moleculer.Payload

func (*RawPayload) Bool

func (p *RawPayload) Bool() bool

func (*RawPayload) BoolArray

func (p *RawPayload) BoolArray() []bool

func (*RawPayload) Bson

func (p *RawPayload) Bson() bson.M

TODO refactor out as a transformer.. just not depend on bson.

func (*RawPayload) BsonArray

func (p *RawPayload) BsonArray() bson.A

func (*RawPayload) ByteArray

func (p *RawPayload) ByteArray() []byte

func (*RawPayload) Error

func (p *RawPayload) Error() error

func (*RawPayload) Exists

func (p *RawPayload) Exists() bool

func (*RawPayload) First

func (p *RawPayload) First() moleculer.Payload

func (*RawPayload) Float

func (p *RawPayload) Float() float64

func (*RawPayload) Float32

func (p *RawPayload) Float32() float32

func (*RawPayload) Float32Array

func (p *RawPayload) Float32Array() []float32

func (*RawPayload) FloatArray

func (p *RawPayload) FloatArray() []float64

func (*RawPayload) ForEach

func (p *RawPayload) ForEach(iterator func(key interface{}, value moleculer.Payload) bool)

func (*RawPayload) Get

func (p *RawPayload) Get(path string) moleculer.Payload

func (*RawPayload) Int

func (p *RawPayload) Int() int

func (*RawPayload) Int64

func (p *RawPayload) Int64() int64

func (*RawPayload) Int64Array

func (p *RawPayload) Int64Array() []int64

func (*RawPayload) IntArray

func (p *RawPayload) IntArray() []int

func (*RawPayload) IsArray

func (p *RawPayload) IsArray() bool

func (*RawPayload) IsError

func (p *RawPayload) IsError() bool

func (*RawPayload) IsMap

func (p *RawPayload) IsMap() bool

func (*RawPayload) Len

func (p *RawPayload) Len() int

func (*RawPayload) Map

func (p *RawPayload) Map() map[string]moleculer.Payload

func (*RawPayload) MapArray

func (p *RawPayload) MapArray() []map[string]interface{}

func (*RawPayload) Only

func (p *RawPayload) Only(path string) moleculer.Payload

Only return a payload containing only the field specified

func (*RawPayload) RawMap

func (p *RawPayload) RawMap() map[string]interface{}

func (*RawPayload) Remove

func (p *RawPayload) Remove(fields ...string) moleculer.Payload

func (*RawPayload) Sort

func (p *RawPayload) Sort(field string) moleculer.Payload

func (*RawPayload) String

func (p *RawPayload) String() string

func (*RawPayload) StringArray

func (p *RawPayload) StringArray() []string

func (*RawPayload) Time

func (p *RawPayload) Time() time.Time

func (*RawPayload) TimeArray

func (p *RawPayload) TimeArray() []time.Time

func (*RawPayload) Uint

func (p *RawPayload) Uint() uint64

func (*RawPayload) UintArray

func (p *RawPayload) UintArray() []uint64

func (*RawPayload) Value

func (p *RawPayload) Value() interface{}

func (*RawPayload) ValueArray

func (p *RawPayload) ValueArray() []interface{}

type Sortable

type Sortable struct {
	Field string
	List  []moleculer.Payload
}

func (*Sortable) Len

func (s *Sortable) Len() int

func (*Sortable) Less

func (s *Sortable) Less(i, j int) bool

Less reports whether the element with index i should sort before the element with index j.

func (*Sortable) Payload

func (s *Sortable) Payload() moleculer.Payload

func (*Sortable) Swap

func (s *Sortable) Swap(i, j int)

Swap swaps the elements with indexes i and j.

type Stringer

type Stringer interface {
	String() string
}

Jump to

Keyboard shortcuts

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