envelope

package
v0.16.2 Latest Latest
Warning

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

Go to latest
Published: May 3, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PROTOCOL  string = "protocol"
	VENDOR    string = "vendor"
	NAMESPACE string = "namespace"
	VERSION   string = "version"
	SCHEMA    string = "schema"
	IS_VALID  string = "isValid"
)
View Source
const HTTP_HEADERS_CONTEXT string = "io.silverton/buz/internal/contexts/httpHeaders/v1.0.json"

Variables

This section is empty.

Functions

This section is empty.

Types

type Annotations added in v0.11.13

type Annotations struct{}

Reserving this for future use.

type Contexts added in v0.13.0

type Contexts map[string]interface{}

func BuildContextsFromRequest added in v0.12.1

func BuildContextsFromRequest(c *gin.Context) Contexts

func (Contexts) Scan added in v0.13.0

func (c Contexts) Scan(input interface{}) error

func (Contexts) Value added in v0.13.0

func (c Contexts) Value() (driver.Value, error)

type Envelope

type Envelope struct {
	Uuid            uuid.UUID        `json:"uuid"`
	Timestamp       time.Time        `json:"timestamp" sql:"index"`
	BuzTimestamp    time.Time        `json:"buzTimestamp" sql:"index"`
	BuzVersion      string           `json:"buzVersion"`
	BuzName         string           `json:"buzName"`
	BuzEnv          string           `json:"buzEnv"`
	Protocol        string           `json:"protocol"`
	Schema          string           `json:"schema"`
	Vendor          string           `json:"vendor"`
	Namespace       string           `json:"namespace"`
	Version         string           `json:"version"`
	IsValid         bool             `json:"isValid"`
	ValidationError *ValidationError `json:"validationError,omitempty" gorm:"type:json"`
	Contexts        *Contexts        `json:"contexts,omitempty" gorm:"type:json"`
	Payload         Payload          `json:"payload" gorm:"type:json"`
}

An envelope consisting of minimally-defined properties

func NewEnvelope added in v0.14.0

func NewEnvelope(conf config.App) Envelope

Build a new envelope with base fields populated

func (*Envelope) AsByte

func (e *Envelope) AsByte() ([]byte, error)

func (*Envelope) AsMap

func (e *Envelope) AsMap() (map[string]interface{}, error)

func (*Envelope) OutputLocation added in v0.15.7

func (e *Envelope) OutputLocation() OutputLocation

type Event added in v0.13.0

type Event interface {
	SchemaName() *string
	PayloadAsByte() ([]byte, error)
	Value() (driver.Value, error)
	Scan(input interface{}) error
}

type JsonbEnvelope

type JsonbEnvelope struct {
	Uuid            uuid.UUID        `json:"uuid" gorm:"type:uuid"`
	Timestamp       time.Time        `json:"timestamp" sql:"index"`
	BuzTimestamp    time.Time        `json:"buzTimestamp" sql:"index"`
	BuzVersion      string           `json:"buzVersion"`
	BuzName         string           `json:"buzName"`
	BuzEnv          string           `json:"buzEnv"`
	Protocol        string           `json:"protocol"`
	Schema          string           `json:"schema"`
	Vendor          string           `json:"vendor"`
	Namespace       string           `json:"namespace"`
	Version         string           `json:"version"`
	IsValid         bool             `json:"isValid"`
	ValidationError *ValidationError `json:"validationError,omitempty" gorm:"type:jsonb"`
	Contexts        *Contexts        `json:"contexts,omitempty" gorm:"type:jsonb"`
	Payload         Payload          `json:"payload" gorm:"type:jsonb"`
}

The only reason for this struct's existence is to properly create database tables with jsonb columns.

type OutputLocation added in v0.15.7

type OutputLocation struct {
	Path        string
	DatabaseFqn string
	Namespace   string
}

func NewOutputLocationFromEnvelope added in v0.15.7

func NewOutputLocationFromEnvelope(e *Envelope) OutputLocation

Build an OutputLocation using Envelope contents

type Payload added in v0.13.0

type Payload map[string]interface{}

func (*Payload) AsByte added in v0.13.0

func (p *Payload) AsByte() ([]byte, error)

func (Payload) Scan added in v0.13.0

func (p Payload) Scan(input interface{}) error

func (Payload) Value added in v0.13.0

func (p Payload) Value() (driver.Value, error)

type PayloadValidationError

type PayloadValidationError struct {
	Field       string `json:"field,omitempty"`
	Description string `json:"description,omitempty"`
	ErrorType   string `json:"errorType,omitempty"`
}

type SelfDescribingContext added in v0.13.0

type SelfDescribingContext SelfDescribingPayload

type SelfDescribingEvent added in v0.13.0

type SelfDescribingEvent struct {
	Contexts `json:"contexts"`
	Payload  SelfDescribingPayload `json:"payload"`
}

type SelfDescribingPayload added in v0.13.0

type SelfDescribingPayload struct {
	Schema string                 `json:"schema"`
	Data   map[string]interface{} `json:"data"`
}

func (SelfDescribingPayload) AsByte added in v0.13.0

func (e SelfDescribingPayload) AsByte() ([]byte, error)

func (SelfDescribingPayload) AsMap added in v0.13.0

func (e SelfDescribingPayload) AsMap() (map[string]interface{}, error)

func (SelfDescribingPayload) PayloadAsByte added in v0.13.0

func (e SelfDescribingPayload) PayloadAsByte() ([]byte, error)

func (SelfDescribingPayload) Scan added in v0.13.0

func (e SelfDescribingPayload) Scan(input interface{}) error

func (SelfDescribingPayload) SchemaName added in v0.13.0

func (e SelfDescribingPayload) SchemaName() *string

func (SelfDescribingPayload) Value added in v0.13.0

func (e SelfDescribingPayload) Value() (driver.Value, error)

type StringEnvelope

type StringEnvelope struct {
	Uuid            uuid.UUID        `json:"uuid" gorm:"type:uuid"`
	Timestamp       time.Time        `json:"timestamp" sql:"index"`
	BuzTimestamp    time.Time        `json:"buzTimestamp" sql:"index"`
	BuzVersion      string           `json:"buzVersion"`
	BuzName         string           `json:"buzName"`
	BuzEnv          string           `json:"buzEnv"`
	Protocol        string           `json:"protocol"`
	Schema          string           `json:"schema"`
	Vendor          string           `json:"vendor"`
	Namespace       string           `json:"namespace"`
	Version         string           `json:"version"`
	IsValid         bool             `json:"isValid"`
	ValidationError *ValidationError `json:"validationError,omitempty" gorm:"type:string"`
	Contexts        *Contexts        `json:"contexts,omitempty" gorm:"type:string"`
	Payload         Payload          `json:"payload" gorm:"type:string"`
}

The only reason for this struct's existence is to properly create database tables with string columns.

type Validation

type Validation struct {
	IsValid *bool            `json:"isValid"`
	Error   *ValidationError `json:"error,omitempty"`
}

func (Validation) Scan

func (e Validation) Scan(input interface{}) error

func (Validation) Value

func (e Validation) Value() (driver.Value, error)

type ValidationError

type ValidationError struct {
	ErrorType       *string                  `json:"errorType,omitempty"`
	ErrorResolution *string                  `json:"errorResolution,omitempty"`
	Errors          []PayloadValidationError `json:"payloadValidationErrors,omitempty"`
}

func (*ValidationError) Scan

func (e *ValidationError) Scan(input interface{}) error

func (*ValidationError) Value

func (e *ValidationError) Value() (driver.Value, error)

Jump to

Keyboard shortcuts

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