models

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2018 License: MIT Imports: 7 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EnvFeature added in v1.0.0

type EnvFeature struct {
	Env     string
	Feature string
}

type Environment

type Environment struct {
	Name      string    `json:"name"`
	CreatedAt time.Time `json:"created_at"`
}

type EnvironmentCreated added in v1.0.0

type EnvironmentCreated struct {
	Name string `json:"name"`
}

func (*EnvironmentCreated) Notify added in v1.0.0

func (*EnvironmentCreated) PrePersist added in v1.0.0

func (e *EnvironmentCreated) PrePersist(*State) (Event, error)

func (*EnvironmentCreated) Update added in v1.0.0

func (e *EnvironmentCreated) Update(s *State, t time.Time) *State

func (*EnvironmentCreated) Validate added in v1.0.0

func (e *EnvironmentCreated) Validate(s *State) (error, error)

type EnvironmentsOrdered added in v1.0.0

type EnvironmentsOrdered struct {
	Order []string `json:"order"`
}

func (*EnvironmentsOrdered) Notify added in v1.0.0

func (*EnvironmentsOrdered) PrePersist added in v1.0.0

func (e *EnvironmentsOrdered) PrePersist(*State) (Event, error)

func (*EnvironmentsOrdered) Update added in v1.0.0

func (e *EnvironmentsOrdered) Update(s *State, t time.Time) *State

func (*EnvironmentsOrdered) Validate added in v1.0.0

func (e *EnvironmentsOrdered) Validate(s *State) (error, error)

type Event added in v1.0.0

type Event interface {
	// Validate validates the event data against given (immutable) state.
	Validate(*State) (error, error)
	// PrePersist can return a modified event just before persisting.
	PrePersist(*State) (Event, error)
	// Update returns the new state with the event's effect applied.
	Update(*State, time.Time) *State
	// Notify can call a notifier about the event.
	Notify(*State, notifier.Notifier)
}

func EventForType added in v1.0.0

func EventForType(eventType string) (Event, error)

type Feature

type Feature struct {
	Name      string    `json:"name"`
	CreatedAt time.Time `json:"created_at"`
}

type FeatureCreated added in v1.0.0

type FeatureCreated struct {
	Name string `json:"name"`
}

func (*FeatureCreated) Notify added in v1.0.0

func (*FeatureCreated) PrePersist added in v1.0.0

func (e *FeatureCreated) PrePersist(*State) (Event, error)

func (*FeatureCreated) Update added in v1.0.0

func (e *FeatureCreated) Update(s *State, t time.Time) *State

func (*FeatureCreated) Validate added in v1.0.0

func (e *FeatureCreated) Validate(s *State) (error, error)

type FeatureDeleted added in v1.0.0

type FeatureDeleted struct {
	Name string `json:"name"`
}

func (*FeatureDeleted) Notify added in v1.0.0

func (*FeatureDeleted) PrePersist added in v1.0.0

func (e *FeatureDeleted) PrePersist(*State) (Event, error)

func (*FeatureDeleted) Update added in v1.0.0

func (e *FeatureDeleted) Update(s *State, t time.Time) *State

func (*FeatureDeleted) Validate added in v1.0.0

func (e *FeatureDeleted) Validate(s *State) (error, error)

type FeatureToggled added in v1.0.0

type FeatureToggled struct {
	Feature     string `json:"feature"`
	Environment string `json:"environment"`
	Status      bool   `json:"status"`
}

func (*FeatureToggled) Notify added in v1.0.0

func (e *FeatureToggled) Notify(s *State, n notifier.Notifier)

func (*FeatureToggled) PrePersist added in v1.0.0

func (e *FeatureToggled) PrePersist(*State) (Event, error)

func (*FeatureToggled) Update added in v1.0.0

func (e *FeatureToggled) Update(s *State, t time.Time) *State

func (*FeatureToggled) Validate added in v1.0.0

func (e *FeatureToggled) Validate(s *State) (error, error)

type State added in v1.0.0

type State struct {
	Users        []User
	Environments []Environment
	Features     []Feature
	Enabled      map[EnvFeature]bool
}

func NewState added in v1.0.0

func NewState() *State

type User

type User struct {
	Username     string    `json:"name"`
	PasswordHash string    `json:"password_hash"`
	CreatedAt    time.Time `json:"created_at"`
}

type UserCreated added in v1.0.0

type UserCreated struct {
	Username     string  `json:"username"`
	Password     *string `json:"password,omitempty"`
	PasswordHash string  `json:"password_hash"`
}

func (*UserCreated) Notify added in v1.0.0

func (e *UserCreated) Notify(*State, notifier.Notifier)

func (*UserCreated) PrePersist added in v1.0.0

func (e *UserCreated) PrePersist(s *State) (Event, error)

func (*UserCreated) Update added in v1.0.0

func (e *UserCreated) Update(s *State, t time.Time) *State

func (*UserCreated) Validate added in v1.0.0

func (e *UserCreated) Validate(s *State) (error, error)

Jump to

Keyboard shortcuts

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