schema

package
v0.0.0-...-7f9b049 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HTTPCommandBus commandBusAdapter = iota
	GRPCCommandBus
	NATSCommandBus
)
View Source
const (
	HTTPCommandBusName = "http"
	GRPCCommandBusName = "grpc"
	NATSCommandBusName = "nats"
)
View Source
const (
	KafkaStreamPublisher publisherAdapter = iota
	ConnectorStreamPublisher
)
View Source
const (
	KafkaStreamPublisherName     = "kafka"
	ConnectorStreamPublisherName = "wal"
)
View Source
const (
	DefaultStreamStorage storageAdapter = iota
	RedisStreamStorage
	PostgresStreamStorage
)
View Source
const (
	DefaultName               = "mem"
	RedisStreamStorageName    = "redis"
	PostgresStreamStorageName = "postgres"
)
View Source
const (
	// Events
	EventMutationAddon        = "EventMutation"
	EventMutationTestAddon    = "EventMutationTest"
	EventMutationImplAddon    = "EventMutationImpl"
	EventControllerAddon      = "EventController"
	EventStateAddon           = "EventState"
	EventsEventsAddon         = "EventsEventsAddon"
	EventsEventsEncodingAddon = "EventsEventsEncodingAddon"

	// Commands
	CommandMutationAddon        = "CommandMutation"
	CommandMutationImplAddon    = "CommandMutationImpl"
	CommandMutationTestAddon    = "CommandMutationTest"
	CommandControllerAddon      = "CommandController"
	CommandStateAddon           = "CommandState"
	CommandsAddon               = "Commands"
	CommandsEncodingAddon       = "CommandsEncoding"
	CommandsEventsAddon         = "CommandEvents"
	CommandsEventsEncodingAddon = "CommandEventsEncoding"

	// Projection
	ProjectionTestAddon                = "ProjectionTest"
	CommandMutationProjectionAddon     = "CommandMutationProjection"
	CommandMutationImplProjectionAddon = "CommandMutationImplProjection"
	CommandControllerProjectionAddon   = "CommandControllerProjection"
	EventMutationProjectionAddon       = "EventMutationProjection"
	EventMutationImplProjectionAddon   = "EventMutationImplProjection"
	EventControllerProjectionAddon     = "EventControllerProjection"
)
View Source
const (
	YesOp = "yes"
	NoOp  = "no"
)

Variables

View Source
var CommandBusAdapters = map[commandBusAdapter]string{
	NATSCommandBus: NATSCommandBus.String(),
	GRPCCommandBus: GRPCCommandBus.String(),
	HTTPCommandBus: HTTPCommandBus.String(),
}
View Source
var PublisherAdapters = map[publisherAdapter]string{
	KafkaStreamPublisher:     KafkaStreamPublisher.String(),
	ConnectorStreamPublisher: ConnectorStreamPublisher.String(),
}

Functions

func CheckUnique

func CheckUnique(s string) bool

func EncodeManifest

func EncodeManifest(m *Manifest) ([]byte, error)

func Index

func Index(m *Manifest)

func IndexCommandMutation

func IndexCommandMutation(c CommandMutation)

func IndexEventMutation

func IndexEventMutation(c EventMutation)

func NormalizePath

func NormalizePath(filePath string, m *Manifest) string

func SanitizeManifest

func SanitizeManifest(m *Manifest)

func SetDefaultGoModules

func SetDefaultGoModules(manifest *Manifest)

func SetGoModules

func SetGoModules(manifest *Manifest, modules []string)

func Validate

func Validate(path string, m *Manifest) error

func ValidateManifest

func ValidateManifest(m *Manifest) error

func Walk

func Walk(path string, m *Manifest, fn func(File) error) error

func WalkCommandMutationAddons

func WalkCommandMutationAddons(path string, m *Manifest, fn func(CommandMutation, File) error) error

func WalkEventMutationAddons

func WalkEventMutationAddons(path string, m *Manifest, fn func(EventMutation, File) error) error

Types

type Command

type Command struct {
	Name    string `yaml:"name"`
	Payload string `yaml:"payload"`
}

type CommandMutation

type CommandMutation struct {
	Mutation string  `yaml:"mutation"`
	Command  Command `yaml:"in_command"`
	Event    Event   `yaml:"out_event"`
	Create   string  `yaml:"allow_create_stream,omitempty"`
	Delete   string  `yaml:"allow_delete_stream,omitempty"`
}

func (CommandMutation) ControllerName

func (c CommandMutation) ControllerName() string

type Contributor

type Contributor struct {
	Author string `yaml:"author"`
	Email  string `yaml:"email"`
}

type Event

type Event struct {
	Name    string `yaml:"name"`
	Payload string `yaml:"payload"`
}

func (Event) LcFirstName

func (e Event) LcFirstName() string

type EventMutation

type EventMutation struct {
	Mutation string `yaml:"mutation"`
	InEvent  Event  `yaml:"in_event"`
	OutEvent Event  `yaml:"out_event"`
	Create   string `yaml:"allow_create_stream,omitempty"`
	Delete   string `yaml:"allow_delete_stream,omitempty"`
}

func (EventMutation) ControllerName

func (c EventMutation) ControllerName() string

type File

type File struct {
	IsDir        bool
	Path         string
	Template     string
	TemplateData []byte
	HasTemplate  bool
	Addon        string
	// contains filtered or unexported fields
}

func AddonFiles

func AddonFiles(path string, m *Manifest, required bool) []File

func (File) IsGo

func (f File) IsGo() bool

func (File) String

func (f File) String() string

type Manifest

type Manifest struct {
	Name            string        `yaml:"name"`
	PackageName     string        `yaml:"go_package_name"`
	StreamName      string        `yaml:"go_stream_name"`
	GoModules       string        `yaml:"go_modules"`
	GoVersion       string        `yaml:"go_version"`
	GoGetPackages   []string      `yaml:"go_get_packages"`
	EventsPkgName   string        `yaml:"go_events_pkg_name"`
	CommandsPkgName string        `yaml:"go_commands_pkg_name"`
	StreamPkgName   string        `yaml:"go_stream_pkg_name"`
	Description     string        `yaml:"description"`
	Mutations       Mutations     `yaml:"mutations"`
	ImportEvents    []string      `yaml:"import_events"`
	StreamStorage   streamStorage `yaml:"storage_adapter"`
	StreamPublisher publisher     `yaml:"publisher_adapter"`
	CommandBus      commandBus    `yaml:"commandbus_adapter"`
	Contributors    []Contributor `yaml:"contributors"`
	CreatedAt       time.Time     `yaml:"created_at"`
	UpdatedAt       time.Time     `yaml:"updated_at"`
}

func DecodeManifest

func DecodeManifest(data []byte) (*Manifest, error)

func New

func New() *Manifest

func (*Manifest) SetCommandBusFromString

func (m *Manifest) SetCommandBusFromString(name string)

func (*Manifest) SetPublisherFromString

func (m *Manifest) SetPublisherFromString(name string)

func (*Manifest) SetStreamStorageFromString

func (m *Manifest) SetStreamStorageFromString(name string, journal bool)

type Mutations

type Mutations struct {
	Commands []CommandMutation `yaml:"from_commands"`
	Events   []EventMutation   `yaml:"from_events"`
}

func (Mutations) HasCommands

func (m Mutations) HasCommands() bool

func (Mutations) HasEvents

func (m Mutations) HasEvents() bool

Jump to

Keyboard shortcuts

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