Documentation ¶
Index ¶
- Variables
- func MakeConnection() error
- type ElasticRepository
- type ElasticRepositoryImpl
- func (r *ElasticRepositoryImpl) CreateIndexIfNotExists(indexName string) error
- func (r *ElasticRepositoryImpl) GetReadmodel(aggregateID string) (db.Article, error)
- func (r *ElasticRepositoryImpl) IsClientReady(clientURL string) error
- func (r *ElasticRepositoryImpl) LoadEvents(aggregateArticleID string) ([]db.Event, error)
- func (r *ElasticRepositoryImpl) SetUpIndexes() error
- func (r *ElasticRepositoryImpl) StoreEvent(event db.Event) error
- func (r *ElasticRepositoryImpl) StoreReadmodel(article database.Article) error
- func (r *ElasticRepositoryImpl) UpdateReadmodel(aggregateArticleID string, article database.Article) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ArticleNotFoundError = "Article Not Found on elastic"
ArticleNotFoundError When query doesn't match to find article
View Source
var ElasticClient *elastic.Client
Functions ¶
func MakeConnection ¶
func MakeConnection() error
MakeConnection Establish a connection with elastic client
Types ¶
type ElasticRepository ¶
type ElasticRepository interface { SetUpIndexes() error IsClientReady(string) error CreateIndexIfNotExists(string) error StoreEvent(event db.Event) error LoadEvents(string) ([]db.Event, error) StoreReadmodel(db.Article) error UpdateReadmodel(string, db.Article) error GetReadmodel(string) (db.Article, error) }
ElasticRepository Makes process on any database
type ElasticRepositoryImpl ¶
func NewElasticRepository ¶
func NewElasticRepository(elasticClient *elastic.Client) *ElasticRepositoryImpl
func (*ElasticRepositoryImpl) CreateIndexIfNotExists ¶
func (r *ElasticRepositoryImpl) CreateIndexIfNotExists(indexName string) error
createIndexIfNotExists on elasticsearch database
func (*ElasticRepositoryImpl) GetReadmodel ¶
func (r *ElasticRepositoryImpl) GetReadmodel(aggregateID string) (db.Article, error)
GetReadmodel returns an article from elastic pass aggregateID as param to get an article
func (*ElasticRepositoryImpl) IsClientReady ¶
func (r *ElasticRepositoryImpl) IsClientReady(clientURL string) error
isClientReady Checks if client is ready by send packet using ping
func (*ElasticRepositoryImpl) LoadEvents ¶
func (r *ElasticRepositoryImpl) LoadEvents(aggregateArticleID string) ([]db.Event, error)
LoadEvents returns all events from elastic
func (*ElasticRepositoryImpl) SetUpIndexes ¶
func (r *ElasticRepositoryImpl) SetUpIndexes() error
SetUpIndexes Creates needed indexes to make POST request @see mapping.go
func (*ElasticRepositoryImpl) StoreEvent ¶
func (r *ElasticRepositoryImpl) StoreEvent(event db.Event) error
StoreEvent stores an event for an aggregate article
func (*ElasticRepositoryImpl) StoreReadmodel ¶
func (r *ElasticRepositoryImpl) StoreReadmodel(article database.Article) error
StoreReadmodel stores a readmodel for an aggregate article
func (*ElasticRepositoryImpl) UpdateReadmodel ¶
func (r *ElasticRepositoryImpl) UpdateReadmodel(aggregateArticleID string, article database.Article) error
UpdateReadmodel stores an updated readmodel for an aggregate article
Click to show internal directories.
Click to hide internal directories.