contract

package
v0.0.0-...-42841ab Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2022 License: MIT Imports: 4 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Data2HopeFunc

type Data2HopeFunc func(data []byte) (IHope, error)

type Dto

type Dto struct {
	Id   string `json:"id"`
	Data []byte `json:"data"`
}

func NewDto

func NewDto(prefixedId string, payload schema.IPayload) (*Dto, error)

NewDto accepts an Id as a string in the format "prefix-string" and returns an IDto Injector

func (*Dto) GetData

func (d *Dto) GetData() []byte

GetData The Data attached to the Event serialized to bytes.

func (*Dto) GetID

func (d *Dto) GetID() (schema.IIdentity, error)

func (*Dto) GetId

func (d *Dto) GetId() string

GetBehaviorId returns the NewDto's Id as a string

func (*Dto) GetPayload

func (d *Dto) GetPayload(payload schema.IPayload) error

func (*Dto) SetData

func (d *Dto) SetData(data []byte) IDto

SetData add the Data attached to the Event serialized to bytes.

func (*Dto) SetPayload

func (d *Dto) SetPayload(payload schema.IPayload) error

SetJsonData serializes the given payload and assigns it to the Dto.Data field.

type Fact

type Fact struct {
	*Dto
}

func NewFact

func NewFact(behaviorId string, p schema.IPayload) (*Fact, error)

type Fbk

type Fbk struct {
	*Dto
	Status   int      `json:"status"`
	Errors   []string `json:"errors"`
	Warnings []string `json:"warnings"`
	Infos    []string `json:"infos"`
}

func (*Fbk) GetBehaviorId

func (f *Fbk) GetBehaviorId() string

func (*Fbk) GetErrors

func (f *Fbk) GetErrors() []string

func (*Fbk) GetFlattenedErrors

func (f *Fbk) GetFlattenedErrors() string

func (*Fbk) GetStatus

func (f *Fbk) GetStatus() int

func (*Fbk) IsSuccess

func (f *Fbk) IsSuccess() bool

func (*Fbk) SetError

func (f *Fbk) SetError(s string)

func (*Fbk) SetInfo

func (f *Fbk) SetInfo(s string)

func (*Fbk) SetStatus

func (f *Fbk) SetStatus(s int) int

func (*Fbk) SetWarning

func (f *Fbk) SetWarning(s string)

type Fbk2DataFunc

type Fbk2DataFunc func(fbk IFbk) ([]byte, error)

type GenData2HopeFunc

type GenData2HopeFunc[THope IHope] func([]byte) (THope, error)

func Data2Hope

func Data2Hope[THope IHope]() GenData2HopeFunc[THope]

type Hope

type Hope struct {
	*Dto
}

func NewHope

func NewHope(behaviorId string, payload schema.IPayload) (*Hope, error)

type HopeType

type HopeType string

type IDto

type IDto interface {
	SetPayload(payload schema.IPayload) error
	GetId() string
	GetPayload(payload schema.IPayload) error
	GetID() (schema.IIdentity, error)
	SetData(data []byte) IDto
	GetData() []byte
}

type IFact

type IFact interface {
	IDto
}

IFact is the injector for DI type discrimination based on Facts

type IFbk

type IFbk interface {
	IDto
	GetBehaviorId() string
	IsSuccess() bool
	GetErrors() []string
	GetFlattenedErrors() string
	GetStatus() int
	SetError(s string)
	SetWarning(s string)
	SetInfo(s string)
	SetStatus(s int) int
}

func NewFbk

func NewFbk(behId string, status int, err string) IFbk

type IHope

type IHope interface {
	IDto
}

type IReq

type IReq interface {
	IDto
}

type IRsp

type IRsp interface {
	IFbk
}

type Req

type Req struct {
	*Dto
}

func NewReq

func NewReq(reqId string, payload schema.IPayload) (*Req, error)

type Rsp

type Rsp struct {
	*Fbk
}

func NewRsp

func NewRsp(reqId string, payload schema.IPayload) (*Rsp, error)

Jump to

Keyboard shortcuts

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