v0.0.0-...-8a06add Latest Latest

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

Go to latest
Published: Dec 7, 2019 License: MIT Imports: 8 Imported by: 0




View Source
const (
	// EventTypeCreated ...
	EventTypeCreated = "CREATED"
	// EventTypeUpdated ...
	EventTypeUpdated = "UPDATED"
	// EventTypeDeleted ...
	EventTypeDeleted = "DELETED"
View Source
const (
	ORMChangeEvent = "com.graphql.orm.change"


This section is empty.


This section is empty.


type Event

type Event struct {
	ID      string         `json:"id"`
	Changes []*EventChange `json:"changes"`

Event ...

func NewEvent

func NewEvent(meta EventMetadata) Event

NewEvent ...

func (*Event) AddNewValue

func (e *Event) AddNewValue(column string, v EventDataValue)

AddNewValue ...

func (*Event) AddOldValue

func (e *Event) AddOldValue(column string, v EventDataValue)

AddOldValue ...

func (*Event) Change

func (e *Event) Change(column string) (ec *EventChange)

func (Event) ChangedColumns

func (e Event) ChangedColumns() []string

ChangedColumns returns list of names of changed columns

func (Event) HasChangedColumn

func (e Event) HasChangedColumn(c string) bool

HasChangedColumn check if given event has changes on specific column

type EventChange

type EventChange struct {
	Name     string `json:"name"`
	OldValue string `json:"oldValue"`
	NewValue string `json:"newValue"`

EventChange ...

func (*EventChange) NewValueAs

func (ec *EventChange) NewValueAs(data interface{}) error

func (*EventChange) OldValueAs

func (ec *EventChange) OldValueAs(data interface{}) error

func (*EventChange) SetNewValue

func (ec *EventChange) SetNewValue(value interface{}) error

func (*EventChange) SetOldValue

func (ec *EventChange) SetOldValue(value interface{}) error

type EventController

type EventController struct {
	// contains filtered or unexported fields

func NewEventController

func NewEventController() (ec EventController, err error)

func (*EventController) SendEvent

func (c *EventController) SendEvent(ctx context.Context, e *Event) (err error)

SendEvent ...

type EventDataValue

type EventDataValue interface{}

type EventMetadata

type EventMetadata struct {
	Type        EventType `json:"type"`
	Cursor      string    `json:"cursor"`
	Entity      string    `json:"entity"`
	EntityID    string    `json:"entityId"`
	Date        int64     `json:"date"`
	PrincipalID *string   `json:"principalId"`

type EventType

type EventType string

EventType ...

Jump to

Keyboard shortcuts

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