message

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUndefinedDataType       = errors.New("undefined message data types")
	ErrInvalidMessageFieldType = errors.New("invalid message field type")
)

Errors set

Functions

This section is empty.

Types

type FieldType

type FieldType int

FieldType of data represents scalar types supported by eventstream message processing

const (
	FieldTypeString FieldType = iota
	FieldTypeFixed
	FieldTypeUUID
	FieldTypeInt
	FieldTypeInt8
	FieldTypeInt32
	FieldTypeInt64
	FieldTypeUint
	FieldTypeUint8
	FieldTypeUint32
	FieldTypeUint64
	FieldTypeFloat
	FieldTypeBoolean
	FieldTypeIP
	FieldTypeDate
	FieldTypeUnixnano
	FieldTypeArrayInt32
	FieldTypeArrayInt64
)

Field scalar types enum

func TypeByString

func TypeByString(t string) FieldType

TypeByString name

func (FieldType) Cast

func (t FieldType) Cast(v any) any

Cast value into the fieldType

func (FieldType) String

func (t FieldType) String() string

String implementaion of fmt.Stringer

type Formater

type Formater interface {
	Format(msg Message) (any, error)
}

Formater processor

type Message

type Message map[string]any

Message object

func MessageDecode

func MessageDecode(data []byte, converter unmarshalel) (msg Message, err error)

MessageDecode from bytes

func (Message) Item

func (m Message) Item(key string, def any) any

Item returns the value by key name or default

func (Message) ItemCast

func (m Message) ItemCast(key string, t FieldType, length int, format string) any

ItemCast converts any key value into the field_type

func (Message) JSON

func (m Message) JSON() string

JSON data string

func (Message) Map

func (m Message) Map() map[string]any

Map returns the message as map[string]any

func (Message) String

func (m Message) String(key, def string) string

String item value

Jump to

Keyboard shortcuts

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