library

package
v0.0.0-...-f40d0ba Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CreateBookCommand eventhorizon.CommandType = "CreateBook"
	DeleteBookCommand eventhorizon.CommandType = "DeleteBook"
	UpdateBookCommand eventhorizon.CommandType = "UpdateBook"
)
View Source
const (
	BookCreatedEvent eventhorizon.EventType = "BookCreated"
	BookDeletedEvent eventhorizon.EventType = "BookDeleted"
	BookUpdatedEvent eventhorizon.EventType = "BookUpdated"
)
View Source
const BookAggregateType eventhorizon.AggregateType = "Book"

Variables

This section is empty.

Functions

func BookCommandTypes

func BookCommandTypes() *bookCommandTypes

func BookEventTypes

func BookEventTypes() *bookEventTypes

Types

type Book

type Book struct {
	Title       string             `json:"title" eh:"optional"`
	Description string             `json:"description" eh:"optional"`
	Language    string             `json:"language" eh:"optional"`
	ReleaseDate *time.Time         `json:"releaseDate" eh:"optional"`
	Edition     string             `json:"edition" eh:"optional"`
	Category    string             `json:"category" eh:"optional"`
	Author      *person.PersonName `json:"author" eh:"optional"`
	Location    *Location          `json:"location" eh:"optional"`
	Id          uuid.UUID          `json:"id" eh:"optional"`
}

func NewBook

func NewBook() (ret *Book)

func NewBookByPropNames

func NewBookByPropNames(intSalt int) (ret *Book)

func NewBooksByPropNames

func NewBooksByPropNames(count int) []*Book

func (*Book) EntityID

func (o *Book) EntityID() uuid.UUID

func (*Book) FindByPattern

func (o *Book) FindByPattern(pattern string) (ret *Book, err error)

func (*Book) FindByTitle

func (o *Book) FindByTitle(title string) (ret *Book, err error)

type BookAggregateInitializer

type BookAggregateInitializer struct {
	*eh.AggregateInitializer
	*BookCommandHandler
	*BookEventHandler
	ProjectorHandler *BookEventHandler `json:"projectorHandler" eh:"optional"`
}

func NewBookAggregateInitializer

func NewBookAggregateInitializer(eventStore eventhorizon.EventStore, eventBus eventhorizon.EventBus, commandBus *bus.CommandHandler,
	readRepos func(string, func() (ret eventhorizon.Entity)) (ret eventhorizon.ReadWriteRepo)) (ret *BookAggregateInitializer)

type BookCli

type BookCli struct {
}

func NewBookCli

func NewBookCli() (ret *BookCli)

type BookClient

type BookClient struct {
	Url    string       `json:"url" eh:"optional"`
	Client *http.Client `json:"client" eh:"optional"`
}

func NewBookClient

func NewBookClient(url string, client *http.Client) (ret *BookClient)

func (*BookClient) Create

func (o *BookClient) Create(items []*Book) (err error)

func (*BookClient) ImportJSON

func (o *BookClient) ImportJSON(fileJSON string) (err error)

func (*BookClient) ReadFileJSON

func (o *BookClient) ReadFileJSON(fileJSON string) (ret []*Book, err error)

type BookCommandHandler

type BookCommandHandler struct {
	CreateHandler func(*CreateBook, *Book, eh.AggregateStoreEvent) (err error) `json:"createHandler" eh:"optional"`
	DeleteHandler func(*DeleteBook, *Book, eh.AggregateStoreEvent) (err error) `json:"deleteHandler" eh:"optional"`
	UpdateHandler func(*UpdateBook, *Book, eh.AggregateStoreEvent) (err error) `json:"updateHandler" eh:"optional"`
}

func (*BookCommandHandler) AddCreatePreparer

func (o *BookCommandHandler) AddCreatePreparer(preparer func(*CreateBook, *Book) (err error))

func (*BookCommandHandler) AddDeletePreparer

func (o *BookCommandHandler) AddDeletePreparer(preparer func(*DeleteBook, *Book) (err error))

func (*BookCommandHandler) AddUpdatePreparer

func (o *BookCommandHandler) AddUpdatePreparer(preparer func(*UpdateBook, *Book) (err error))

func (*BookCommandHandler) Execute

func (*BookCommandHandler) SetupCommandHandler

func (o *BookCommandHandler) SetupCommandHandler() (err error)

type BookCommandType

type BookCommandType struct {
	// contains filtered or unexported fields
}

func (BookCommandType) GetBSON

func (o BookCommandType) GetBSON() (ret interface{}, err error)

func (*BookCommandType) IsCreateBook

func (o *BookCommandType) IsCreateBook() bool

func (*BookCommandType) IsDeleteBook

func (o *BookCommandType) IsDeleteBook() bool

func (*BookCommandType) IsUpdateBook

func (o *BookCommandType) IsUpdateBook() bool

func (BookCommandType) MarshalJSON

func (o BookCommandType) MarshalJSON() (ret []byte, err error)

func (*BookCommandType) Name

func (o *BookCommandType) Name() string

func (*BookCommandType) Ordinal

func (o *BookCommandType) Ordinal() int

func (*BookCommandType) SetBSON

func (o *BookCommandType) SetBSON(raw bson.Raw) (err error)

func (*BookCommandType) UnmarshalJSON

func (o *BookCommandType) UnmarshalJSON(data []byte) (err error)

type BookCreated

type BookCreated struct {
	Title       string             `json:"title" eh:"optional"`
	Description string             `json:"description" eh:"optional"`
	Language    string             `json:"language" eh:"optional"`
	ReleaseDate *time.Time         `json:"releaseDate" eh:"optional"`
	Edition     string             `json:"edition" eh:"optional"`
	Category    string             `json:"category" eh:"optional"`
	Author      *person.PersonName `json:"author" eh:"optional"`
	Location    *Location          `json:"location" eh:"optional"`
	Id          uuid.UUID          `json:"id" eh:"optional"`
}

type BookDeleted

type BookDeleted struct {
	Id uuid.UUID `json:"id" eh:"optional"`
}

type BookEventHandler

type BookEventHandler struct {
	CreatedHandler func(*BookCreated, *Book) (err error) `json:"createdHandler" eh:"optional"`
	DeletedHandler func(*BookDeleted, *Book) (err error) `json:"deletedHandler" eh:"optional"`
	UpdatedHandler func(*BookUpdated, *Book) (err error) `json:"updatedHandler" eh:"optional"`
}

func (*BookEventHandler) Apply

func (o *BookEventHandler) Apply(event eventhorizon.Event, entity eventhorizon.Entity) (err error)

func (*BookEventHandler) SetupEventHandler

func (o *BookEventHandler) SetupEventHandler() (err error)

type BookEventType

type BookEventType struct {
	// contains filtered or unexported fields
}

func (BookEventType) GetBSON

func (o BookEventType) GetBSON() (ret interface{}, err error)

func (*BookEventType) IsBookCreated

func (o *BookEventType) IsBookCreated() bool

func (*BookEventType) IsBookDeleted

func (o *BookEventType) IsBookDeleted() bool

func (*BookEventType) IsBookUpdated

func (o *BookEventType) IsBookUpdated() bool

func (BookEventType) MarshalJSON

func (o BookEventType) MarshalJSON() (ret []byte, err error)

func (*BookEventType) Name

func (o *BookEventType) Name() string

func (*BookEventType) Ordinal

func (o *BookEventType) Ordinal() int

func (*BookEventType) SetBSON

func (o *BookEventType) SetBSON(raw bson.Raw) (err error)

func (*BookEventType) UnmarshalJSON

func (o *BookEventType) UnmarshalJSON(data []byte) (err error)

type BookExecutors

type BookExecutors struct {
	Initial *BookInitialExecutor `json:"initial" eh:"optional"`
}

func NewBookExecutors

func NewBookExecutors() (ret *BookExecutors)

type BookHandlers

type BookHandlers struct {
	Initial *BookInitialHandler `json:"initial" eh:"optional"`
}

func NewBookHandlers

func NewBookHandlers() (ret *BookHandlers)

type BookHttpCommandHandler

type BookHttpCommandHandler struct {
	*eh.HttpCommandHandler
}

func NewBookHttpCommandHandler

func NewBookHttpCommandHandler(context context.Context, commandBus eventhorizon.CommandHandler) (ret *BookHttpCommandHandler)

func (*BookHttpCommandHandler) Create

func (*BookHttpCommandHandler) Delete

func (*BookHttpCommandHandler) Update

type BookHttpQueryHandler

type BookHttpQueryHandler struct {
	*eh.HttpQueryHandler
	QueryRepository *BookQueryRepository `json:"queryRepository" eh:"optional"`
}

func NewBookHttpQueryHandler

func NewBookHttpQueryHandler(queryRepository *BookQueryRepository) (ret *BookHttpQueryHandler)

func (*BookHttpQueryHandler) CountAll

func (*BookHttpQueryHandler) CountById

func (o *BookHttpQueryHandler) CountById(w http.ResponseWriter, r *http.Request)

func (*BookHttpQueryHandler) ExistAll

func (*BookHttpQueryHandler) ExistById

func (o *BookHttpQueryHandler) ExistById(w http.ResponseWriter, r *http.Request)

func (*BookHttpQueryHandler) FindAll

func (*BookHttpQueryHandler) FindById

func (*BookHttpQueryHandler) FindByPattern

func (o *BookHttpQueryHandler) FindByPattern(w http.ResponseWriter, r *http.Request)

func (*BookHttpQueryHandler) FindByTitle

func (o *BookHttpQueryHandler) FindByTitle(w http.ResponseWriter, r *http.Request)

type BookInitialExecutor

type BookInitialExecutor struct {
}

func NewBookInitialExecutor

func NewBookInitialExecutor() (ret *BookInitialExecutor)

type BookInitialHandler

type BookInitialHandler struct {
}

func NewBookInitialHandler

func NewBookInitialHandler() (ret *BookInitialHandler)

func (*BookInitialHandler) Apply

func (o *BookInitialHandler) Apply(event eventhorizon.Event, entity eventhorizon.Entity) (err error)

func (*BookInitialHandler) SetupEventHandler

func (o *BookInitialHandler) SetupEventHandler() (err error)

type BookQueryRepository

type BookQueryRepository struct {
	// contains filtered or unexported fields
}

func NewBookQueryRepository

func NewBookQueryRepository(repo eventhorizon.ReadRepo, context context.Context) (ret *BookQueryRepository)

func (*BookQueryRepository) CountAll

func (o *BookQueryRepository) CountAll() (ret int, err error)

func (*BookQueryRepository) CountById

func (o *BookQueryRepository) CountById(id uuid.UUID) (ret int, err error)

func (*BookQueryRepository) ExistAll

func (o *BookQueryRepository) ExistAll() (ret bool, err error)

func (*BookQueryRepository) ExistById

func (o *BookQueryRepository) ExistById(id uuid.UUID) (ret bool, err error)

func (*BookQueryRepository) FindAll

func (o *BookQueryRepository) FindAll() (ret []*Book, err error)

func (*BookQueryRepository) FindById

func (o *BookQueryRepository) FindById(id uuid.UUID) (ret *Book, err error)

func (*BookQueryRepository) FindByPattern

func (o *BookQueryRepository) FindByPattern(pattern string) (ret *Book, err error)

func (*BookQueryRepository) FindByTitle

func (o *BookQueryRepository) FindByTitle(title string) (ret *Book, err error)

type BookRouter

type BookRouter struct {
	PathPrefix     string                  `json:"pathPrefix" eh:"optional"`
	QueryHandler   *BookHttpQueryHandler   `json:"queryHandler" eh:"optional"`
	CommandHandler *BookHttpCommandHandler `json:"commandHandler" eh:"optional"`
	Router         *mux.Router             `json:"router" eh:"optional"`
}

func NewBookRouter

func NewBookRouter(pathPrefix string, context context.Context, commandBus eventhorizon.CommandHandler,
	readRepos func(string, func() (ret eventhorizon.Entity)) (ret eventhorizon.ReadWriteRepo)) (ret *BookRouter)

func (*BookRouter) Setup

func (o *BookRouter) Setup(router *mux.Router) (err error)

type BookUpdated

type BookUpdated struct {
	Title       string             `json:"title" eh:"optional"`
	Description string             `json:"description" eh:"optional"`
	Language    string             `json:"language" eh:"optional"`
	ReleaseDate *time.Time         `json:"releaseDate" eh:"optional"`
	Edition     string             `json:"edition" eh:"optional"`
	Category    string             `json:"category" eh:"optional"`
	Author      *person.PersonName `json:"author" eh:"optional"`
	Location    *Location          `json:"location" eh:"optional"`
	Id          uuid.UUID          `json:"id" eh:"optional"`
}

type CreateBook

type CreateBook struct {
	Title       string             `json:"title" eh:"optional"`
	Description string             `json:"description" eh:"optional"`
	Language    string             `json:"language" eh:"optional"`
	ReleaseDate *time.Time         `json:"releaseDate" eh:"optional"`
	Edition     string             `json:"edition" eh:"optional"`
	Category    string             `json:"category" eh:"optional"`
	Author      *person.PersonName `json:"author" eh:"optional"`
	Location    *Location          `json:"location" eh:"optional"`
	Id          uuid.UUID          `json:"id" eh:"optional"`
}

func (*CreateBook) AggregateID

func (o *CreateBook) AggregateID() uuid.UUID

func (*CreateBook) AggregateType

func (o *CreateBook) AggregateType() eventhorizon.AggregateType

func (*CreateBook) CommandType

func (o *CreateBook) CommandType() eventhorizon.CommandType

type DeleteBook

type DeleteBook struct {
	Id uuid.UUID `json:"id" eh:"optional"`
}

func (*DeleteBook) AggregateID

func (o *DeleteBook) AggregateID() uuid.UUID

func (*DeleteBook) AggregateType

func (o *DeleteBook) AggregateType() eventhorizon.AggregateType

func (*DeleteBook) CommandType

func (o *DeleteBook) CommandType() eventhorizon.CommandType

type LibraryCli

type LibraryCli struct {
	BookCli *BookCli `json:"bookCli" eh:"optional"`
}

func NewLibraryCli

func NewLibraryCli() (ret *LibraryCli)

type LibraryClient

type LibraryClient struct {
	Url        string       `json:"url" eh:"optional"`
	Client     *http.Client `json:"client" eh:"optional"`
	BookClient *BookClient  `json:"bookClient" eh:"optional"`
}

func NewLibraryClient

func NewLibraryClient(url string, client *http.Client) (ret *LibraryClient)

type LibraryEventhorizonInitializer

type LibraryEventhorizonInitializer struct {
	BookAggregateInitializer *BookAggregateInitializer `json:"bookAggregateInitializer" eh:"optional"`
	// contains filtered or unexported fields
}

func NewLibraryEventhorizonInitializer

func NewLibraryEventhorizonInitializer(eventStore eventhorizon.EventStore, eventBus eventhorizon.EventBus, commandBus *bus.CommandHandler,
	readRepos func(string, func() (ret eventhorizon.Entity)) (ret eventhorizon.ReadWriteRepo)) (ret *LibraryEventhorizonInitializer)

func (*LibraryEventhorizonInitializer) Setup

func (o *LibraryEventhorizonInitializer) Setup() (err error)

type LibraryRouter

type LibraryRouter struct {
	PathPrefix string      `json:"pathPrefix" eh:"optional"`
	BookRouter *BookRouter `json:"bookRouter" eh:"optional"`
	Router     *mux.Router `json:"router" eh:"optional"`
}

func NewLibraryRouter

func NewLibraryRouter(pathPrefix string, context context.Context, commandBus *bus.CommandHandler,
	readRepos func(string, func() (ret eventhorizon.Entity)) (ret eventhorizon.ReadWriteRepo)) (ret *LibraryRouter)

func (*LibraryRouter) Setup

func (o *LibraryRouter) Setup(router *mux.Router) (err error)

type Location

type Location struct {
	Shelf string `json:"shelf" eh:"optional"`
	Fold  string `json:"fold" eh:"optional"`
}

func NewLocation

func NewLocation() (ret *Location)

func NewLocationByPropNames

func NewLocationByPropNames(intSalt int) (ret *Location)

func NewLocationsByPropNames

func NewLocationsByPropNames(count int) []*Location

type UpdateBook

type UpdateBook struct {
	Title       string             `json:"title" eh:"optional"`
	Description string             `json:"description" eh:"optional"`
	Language    string             `json:"language" eh:"optional"`
	ReleaseDate *time.Time         `json:"releaseDate" eh:"optional"`
	Edition     string             `json:"edition" eh:"optional"`
	Category    string             `json:"category" eh:"optional"`
	Author      *person.PersonName `json:"author" eh:"optional"`
	Location    *Location          `json:"location" eh:"optional"`
	Id          uuid.UUID          `json:"id" eh:"optional"`
}

func (*UpdateBook) AggregateID

func (o *UpdateBook) AggregateID() uuid.UUID

func (*UpdateBook) AggregateType

func (o *UpdateBook) AggregateType() eventhorizon.AggregateType

func (*UpdateBook) CommandType

func (o *UpdateBook) CommandType() eventhorizon.CommandType

Jump to

Keyboard shortcuts

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