event

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Types = []Type{
		BuildSubmitted,
		BuildStarted,
		BuildFinished,
		BuildTagged,
		InviteSent,
		InviteAccepted,
		Namespaces,
		Cron,
		Images,
		Objects,
		Variables,
		SSHKeys,
	}

	ErrUnknown       = errors.New("unknown event")
	ErrNilDispatcher = errors.New("nil dispatcher")
)

Functions

This section is empty.

Types

type Dispatcher

type Dispatcher interface {
	Dispatch(ev *Event) error
}

func MultiDispatcher

func MultiDispatcher(dispatchers ...Dispatcher) Dispatcher

type Event

type Event struct {
	ID          uuid.UUID
	NamespaceID sql.NullInt64
	Type        Type
	Data        map[string]interface{}
	CreatedAt   time.Time
}

func New

func New(namespaceId sql.NullInt64, typ Type, data map[string]interface{}) *Event

type Type

type Type uint
const (
	BuildSubmitted Type = 1 << iota // build.submitted
	BuildStarted                    // build.started
	BuildFinished                   // build.finished
	BuildTagged                     // build.tagged
	InviteSent                      // invite.sent
	InviteAccepted                  // invite.accepted
	InviteRejected                  // invite.rejected
	Namespaces                      // namespaces
	Cron                            // cron
	Images                          // images
	Objects                         // objects
	Variables                       // variables
	SSHKeys                         // ssh_keys
)

func Lookup

func Lookup(name string) (Type, bool)

func UnmarshalType

func UnmarshalType(names ...string) (Type, error)

func (Type) Has

func (t Type) Has(mask Type) bool

func (*Type) Scan

func (t *Type) Scan(v interface{}) error

func (Type) String

func (i Type) String() string

func (Type) Value

func (t Type) Value() (driver.Value, error)

Jump to

Keyboard shortcuts

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