monolith

package module
v1.0.10 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2022 License: MIT Imports: 7 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitializeGobRegistry

func InitializeGobRegistry()

Types

type Args

type Args struct {
	Values []interface{}
	Index  int
}

func NewArgs

func NewArgs(values []interface{}) *Args

func NewEmptyArgs

func NewEmptyArgs() *Args

func (Args) Empty

func (args Args) Empty() bool

func (Args) Pop

func (args Args) Pop() (interface{}, error)

func (Args) PopByte

func (args Args) PopByte() (byte, error)

func (Args) PopInt

func (args Args) PopInt() (int, error)

func (Args) PopString

func (args Args) PopString() (string, error)

func (Args) Push

func (args Args) Push(value interface{})

type ArgsDynamicPart

type ArgsDynamicPart struct {
	Item ByteType
}

func (ArgsDynamicPart) Fix

func (part ArgsDynamicPart) Fix(n int) BytesPart

func (ArgsDynamicPart) MessageFromArgs

func (part ArgsDynamicPart) MessageFromArgs(args *Args, context *Context) Message

type Buffer

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

func NewBuffer

func NewBuffer(value []byte) *Buffer

func NewEmptyBuffer

func NewEmptyBuffer() *Buffer

func (*Buffer) Empty

func (buffer *Buffer) Empty() bool

func (*Buffer) Pop

func (buffer *Buffer) Pop() (byte, error)

func (*Buffer) PopBytes

func (buffer *Buffer) PopBytes(n int) ([]byte, error)

func (*Buffer) PopString added in v1.0.9

func (buffer *Buffer) PopString(n int) (string, error)

func (*Buffer) Push

func (buffer *Buffer) Push(bs []byte)

func (*Buffer) PushString added in v1.0.9

func (buffer *Buffer) PushString(s string)

type ByteType

type ByteType interface {
	Validateable
	Parseable
	Countable
	ByteFromArgs(args *Args, context *Context) (byte, error)
}

type Byteable

type Byteable interface {
	Bytes() []byte
}

type BytesMessage

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

func (BytesMessage) Bytes

func (message BytesMessage) Bytes() []byte

type BytesPart

type BytesPart struct {
	Items []ByteType
}

func (BytesPart) Count

func (part BytesPart) Count() int

func (BytesPart) MessageFromArgs

func (part BytesPart) MessageFromArgs(args *Args, context *Context) Message

func (BytesPart) Parse

func (part BytesPart) Parse(buffer *Buffer, args *Args, context *Context)

func (BytesPart) Validate

func (part BytesPart) Validate(buffer *Buffer, context *Context) Validity

type Condition

type Condition interface {
	Evaluate(value interface{}) bool
}

type Context

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

func NewEmptyContext

func NewEmptyContext() *Context

func (*Context) Get

func (context *Context) Get(name string) (interface{}, bool)

func (*Context) GetInt

func (context *Context) GetInt(name string) (int, bool)

func (*Context) Set

func (context *Context) Set(name string, value interface{})

type Countable

type Countable interface {
	Count() int
}

type Description

type Description struct {
	Parts []Monolith
}

func DecodeDescription

func DecodeDescription(encoded string) (*Description, error)

func (Description) Encode

func (description Description) Encode() (string, error)

func (Description) MessagesFromArgs

func (description Description) MessagesFromArgs(args *Args, context *Context) []Message

func (Description) Parse

func (description Description) Parse(buffer *Buffer, args *Args, context *Context)

func (Description) Validate

func (description Description) Validate(buffer *Buffer, context *Context) Validity

type DynamicPart

type DynamicPart interface {
	Fix(n int) BytesPart
}

type Empty

type Empty struct {
}

func (Empty) Count

func (part Empty) Count() int

func (Empty) MessageFromArgs

func (part Empty) MessageFromArgs(args *Args, context *Context) Message

func (Empty) Parse

func (part Empty) Parse(buffer *Buffer, args *Args, context *Context)

func (Empty) Validate

func (part Empty) Validate(buffer *Buffer, context *Context) Validity

type EnumeratedByteType

type EnumeratedByteType struct {
	Options []byte
}

func (EnumeratedByteType) ByteFromArgs

func (bt EnumeratedByteType) ByteFromArgs(args *Args, _ *Context) (byte, error)

func (EnumeratedByteType) Count

func (bt EnumeratedByteType) Count() int

func (EnumeratedByteType) Parse

func (bt EnumeratedByteType) Parse(buffer *Buffer, _ *Args, _ *Context)

func (EnumeratedByteType) Validate

func (bt EnumeratedByteType) Validate(buffer *Buffer, context *Context) Validity

type EqualsCondition

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

func (EqualsCondition) Evaluate

func (cond EqualsCondition) Evaluate(value interface{}) bool

type FixedByteType

type FixedByteType struct {
	Byte byte
}

func (FixedByteType) ByteFromArgs

func (bt FixedByteType) ByteFromArgs(_ *Args, _ *Context) (byte, error)

func (FixedByteType) Count

func (bt FixedByteType) Count() int

func (FixedByteType) Parse

func (bt FixedByteType) Parse(buffer *Buffer, _ *Args, _ *Context)

func (FixedByteType) Validate

func (bt FixedByteType) Validate(buffer *Buffer, context *Context) Validity

type FixedStringType

type FixedStringType struct {
	String string
}

func (FixedStringType) Count

func (f FixedStringType) Count() int

func (FixedStringType) Parse

func (f FixedStringType) Parse(buffer *Buffer, args *Args, context *Context)

func (FixedStringType) StringFromArgs

func (f FixedStringType) StringFromArgs(args *Args, context *Context) (string, error)

func (FixedStringType) Validate

func (f FixedStringType) Validate(buffer *Buffer, context *Context) Validity

type GreaterCondition

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

func (GreaterCondition) Evaluate

func (cond GreaterCondition) Evaluate(value interface{}) bool

type Instance

type Instance struct {
	Desc Description
	Args *Args
}

func DecodeInstance

func DecodeInstance(encoded string) (*Instance, error)

func (Instance) Encode

func (instance Instance) Encode() (string, error)

func (Instance) Messages

func (instance Instance) Messages() []Message

type LesserCondition

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

func (LesserCondition) Evaluate

func (cond LesserCondition) Evaluate(value interface{}) bool

type Message

type Message interface {
	Byteable
}

type Messageable

type Messageable interface {
	MessageFromArgs(args *Args, context *Context) Message
}

type Monolith

type Monolith interface {
	Messageable
	Parseable
	Validateable
}

type Parseable

type Parseable interface {
	Parse(buffer *Buffer, args *Args, context *Context)
}

type RandomByteType

type RandomByteType struct {
}

func (RandomByteType) ByteFromArgs

func (bt RandomByteType) ByteFromArgs(args *Args, _ *Context) (byte, error)

func (RandomByteType) Count

func (bt RandomByteType) Count() int

func (RandomByteType) Parse

func (bt RandomByteType) Parse(buffer *Buffer, _ *Args, _ *Context)

func (RandomByteType) Validate

func (bt RandomByteType) Validate(buffer *Buffer, context *Context) Validity

type RandomEnumeratedByteType

type RandomEnumeratedByteType struct {
	RandomOptions []byte
}

func (RandomEnumeratedByteType) ByteFromArgs

func (bt RandomEnumeratedByteType) ByteFromArgs(args *Args, _ *Context) (byte, error)

func (RandomEnumeratedByteType) Count

func (bt RandomEnumeratedByteType) Count() int

func (RandomEnumeratedByteType) Parse

func (bt RandomEnumeratedByteType) Parse(buffer *Buffer, _ *Args, _ *Context)

func (RandomEnumeratedByteType) Validate

func (bt RandomEnumeratedByteType) Validate(buffer *Buffer, context *Context) Validity

type SemanticByteType

type SemanticByteType struct {
}

type SemanticIntConsumerByteType

type SemanticIntConsumerByteType struct {
	Name string
}

Consumes an int from a Context

func (SemanticIntConsumerByteType) ByteFromArgs

func (bt SemanticIntConsumerByteType) ByteFromArgs(_ *Args, context *Context) (byte, error)

func (SemanticIntConsumerByteType) Count

func (bt SemanticIntConsumerByteType) Count() int

func (SemanticIntConsumerByteType) Parse

func (bt SemanticIntConsumerByteType) Parse(buffer *Buffer, args *Args, context *Context)

func (SemanticIntConsumerByteType) Validate

func (bt SemanticIntConsumerByteType) Validate(buffer *Buffer, context *Context) Validity

type SemanticIntConsumerOptionalPart

type SemanticIntConsumerOptionalPart struct {
	Name      string
	Condition Condition
	Item      BytesPart
	Cached    *BytesPart
}

func (*SemanticIntConsumerOptionalPart) Count

func (part *SemanticIntConsumerOptionalPart) Count() int

func (*SemanticIntConsumerOptionalPart) Fix

func (*SemanticIntConsumerOptionalPart) MessageFromArgs

func (part *SemanticIntConsumerOptionalPart) MessageFromArgs(args *Args, context *Context) Message

func (*SemanticIntConsumerOptionalPart) Parse

func (part *SemanticIntConsumerOptionalPart) Parse(buffer *Buffer, args *Args, context *Context)

func (*SemanticIntConsumerOptionalPart) Validate

func (part *SemanticIntConsumerOptionalPart) Validate(buffer *Buffer, context *Context) Validity

type SemanticIntProducerByteType

type SemanticIntProducerByteType struct {
	Name  string
	Value ByteType
}

Produces an int into a Context

func (SemanticIntProducerByteType) ByteFromArgs

func (bt SemanticIntProducerByteType) ByteFromArgs(args *Args, context *Context) (byte, error)

func (SemanticIntProducerByteType) Count

func (bt SemanticIntProducerByteType) Count() int

func (SemanticIntProducerByteType) Parse

func (bt SemanticIntProducerByteType) Parse(buffer *Buffer, _ *Args, context *Context)

func (SemanticIntProducerByteType) Validate

func (bt SemanticIntProducerByteType) Validate(buffer *Buffer, context *Context) Validity

type SemanticLengthConsumerDynamicPart

type SemanticLengthConsumerDynamicPart struct {
	Name   string
	Item   ByteType
	Cached *BytesPart
}

func (*SemanticLengthConsumerDynamicPart) Count

func (part *SemanticLengthConsumerDynamicPart) Count() int

func (*SemanticLengthConsumerDynamicPart) Fix

func (*SemanticLengthConsumerDynamicPart) MessageFromArgs

func (part *SemanticLengthConsumerDynamicPart) MessageFromArgs(args *Args, context *Context) Message

func (*SemanticLengthConsumerDynamicPart) Parse

func (part *SemanticLengthConsumerDynamicPart) Parse(buffer *Buffer, args *Args, context *Context)

func (*SemanticLengthConsumerDynamicPart) Validate

func (part *SemanticLengthConsumerDynamicPart) Validate(buffer *Buffer, context *Context) Validity

type SemanticSeedConsumerDynamicPart

type SemanticSeedConsumerDynamicPart struct {
	Name   string
	Item   ByteType
	Cached *BytesPart
}

func (*SemanticSeedConsumerDynamicPart) Count

func (part *SemanticSeedConsumerDynamicPart) Count() int

func (*SemanticSeedConsumerDynamicPart) Fix

func (*SemanticSeedConsumerDynamicPart) MessageFromArgs

func (part *SemanticSeedConsumerDynamicPart) MessageFromArgs(args *Args, context *Context) Message

func (*SemanticSeedConsumerDynamicPart) Parse

func (part *SemanticSeedConsumerDynamicPart) Parse(buffer *Buffer, args *Args, context *Context)

func (*SemanticSeedConsumerDynamicPart) Validate

func (part *SemanticSeedConsumerDynamicPart) Validate(buffer *Buffer, context *Context) Validity

type StringMessage

type StringMessage struct {
	String string
}

func (StringMessage) Bytes

func (s StringMessage) Bytes() []byte

type StringType

type StringType interface {
	Validateable
	Parseable
	StringFromArgs(args *Args, context *Context) (string, error)
}

type StringsPart

type StringsPart struct {
	Items []StringType
}

func (StringsPart) MessageFromArgs

func (s StringsPart) MessageFromArgs(args *Args, context *Context) Message

func (StringsPart) Parse

func (s StringsPart) Parse(buffer *Buffer, args *Args, context *Context)

func (StringsPart) Validate

func (s StringsPart) Validate(buffer *Buffer, context *Context) Validity

type TimedMessage

type TimedMessage struct {
	Milliseconds uint
	// contains filtered or unexported fields
}

func (TimedMessage) Bytes

func (message TimedMessage) Bytes() []byte

type TimedPart

type TimedPart struct {
	Milliseconds uint
	Items        []ByteType
}

func (TimedPart) Count

func (part TimedPart) Count() int

func (TimedPart) MessageFromArgs

func (part TimedPart) MessageFromArgs(args *Args, context *Context) Message

func (TimedPart) Parse

func (part TimedPart) Parse(buffer *Buffer, args *Args, context *Context)

func (TimedPart) Validate

func (part TimedPart) Validate(buffer *Buffer, context *Context) Validity

type Validateable

type Validateable interface {
	Validate(buffer *Buffer, context *Context) Validity
}

type Validity

type Validity int
const (
	Valid Validity = iota
	Invalid
	Incomplete
)

func (Validity) String

func (v Validity) String() string

type VariableStringType

type VariableStringType struct {
	EndDelimiter byte
}

func (VariableStringType) Parse

func (f VariableStringType) Parse(buffer *Buffer, args *Args, context *Context)

func (VariableStringType) StringFromArgs

func (f VariableStringType) StringFromArgs(args *Args, context *Context) (string, error)

func (VariableStringType) Validate

func (f VariableStringType) Validate(buffer *Buffer, context *Context) Validity

Jump to

Keyboard shortcuts

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