Documentation
¶
Index ¶
- Constants
- Variables
- func DecodeHash(dst []byte, src []byte) error
- type AuthHeader
- type Event
- type EventBody
- func (eb EventBody) Bytes() []byte
- func (eb EventBody) Data() []byte
- func (eb EventBody) DataType() byte
- func (eb EventBody) MarshalJSON() ([]byte, error)
- func (eb EventBody) Parent() Hash
- func (eb EventBody) SetParent(hash Hash)
- func (eb EventBody) String() string
- func (eb EventBody) Type() uint16
- func (eb EventBody) Unmarshal(v any) error
- func (eb *EventBody) UnmarshalJSON(b []byte) error
- func (eb EventBody) Version() byte
- type EventHeader
- type EventInput
- type EventInputVerifierFunc
- type EventQuery
- type EventRepository
- type EventResponse
- type EventService
- type Handler
- type HandlerFunc
- type Hash
- type HashQuery
- type HashRepository
- type HashService
- type Query
- type Repository
- type Service
- type SystemEvent
Constants ¶
View Source
const ( EventBodyBasic = 1 + iota EventBodyLinked JSONDataType = 1 )
View Source
const ( HashSize = 32 HashLen = 43 )
Variables ¶
View Source
var ( ErrInvalidEventBodyVersion = status.New( pletyvo.CodeInvalidArgument, "invalid event body version", ) ErrInvalidEventBodyDataType = status.New( pletyvo.CodeInvalidArgument, "invalid event body data type", ) ErrInvalidEventType = status.New( pletyvo.CodeInvalidArgument, "unsupported event type", ) EventBodyMetaSize = [3]int{EventBodyBasic: 4, EventBodyLinked: 36} )
Functions ¶
func DecodeHash ¶
Types ¶
type AuthHeader ¶
type Event ¶
type Event struct { ID uuid.UUID `json:"id"` Body EventBody `json:"body"` Auth AuthHeader `json:"auth"` }
type EventBody ¶
type EventBody []byte
func NewEventBody ¶
func (EventBody) MarshalJSON ¶
func (*EventBody) UnmarshalJSON ¶
type EventHeader ¶
type EventInput ¶
type EventInput struct { Body EventBody `json:"body"` Auth AuthHeader `json:"auth"` }
func (*EventInput) Verify ¶
func (ei *EventInput) Verify(f EventInputVerifierFunc) bool
type EventInputVerifierFunc ¶
type EventInputVerifierFunc func(*EventInput) bool
type EventQuery ¶
type EventRepository ¶
type EventRepository interface { EventQuery Create(context.Context, *SystemEvent) error }
type EventResponse ¶
type EventService ¶
type EventService interface { EventQuery Create(context.Context, *EventInput) (*EventResponse, error) }
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func NewHandler ¶
func NewHandler() *Handler
func (*Handler) Register ¶
func (h *Handler) Register(eventType uint16, handlerFunc HandlerFunc)
type HandlerFunc ¶
type HandlerFunc func(context.Context, *SystemEvent) error
type HashQuery ¶
type HashQuery interface {
GetByID(context.Context, Hash) (*EventResponse, error)
}
type HashRepository ¶
type HashRepository interface { HashQuery Create(context.Context, *EventHeader) error }
type HashService ¶
type HashService interface{ HashQuery }
type Query ¶
type Query struct { Event EventQuery Hash HashQuery }
type Repository ¶
type Repository struct { Event EventRepository Hash HashRepository }
type Service ¶
type Service struct { Event EventService Hash HashService }
type SystemEvent ¶
type SystemEvent struct { *EventHeader *EventInput Author Hash }
Click to show internal directories.
Click to hide internal directories.