core

package
v0.11.2 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2021 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInternalServerError = errors.New("internal Server Error")
	ErrNotFound            = errors.New("your requested Item is not found")
	ErrConflict            = errors.New("your Item already exist")
	ErrBadRequest          = errors.New("given Param is not valid")
	ErrForbiddenAcccess    = errors.New("your access is forbidden")
)

Functions

func GetEventBus

func GetEventBus() *eventBus

func GetMediator

func GetMediator() *mediator

func GetRepositoryService

func GetRepositoryService(model Entitier) *repositoryService

func GetStateService

func GetStateService() *stateService

func NewEventBusBuilder

func NewEventBusBuilder() *eventBusBuilder

Constructor for EventBusBuilder

func NewMediatorBuilder

func NewMediatorBuilder() *mediatorBuilder

Constructor for MediatorBuilder

func NewRepositoryServiceBuilder

func NewRepositoryServiceBuilder(model Entitier, tableName string) *repositoryServiceBuilder

Constructor for RepositoryServiceBuilder

func NewStateServiceBuilder

func NewStateServiceBuilder() *stateServiceBuilder

Constructor for StateServiceBuilder

Types

type CacheSettings added in v0.9.0

type CacheSettings struct {
	ItemExpiration       time.Duration `model:",omitempty"`
	CacheCleanupInterval time.Duration `model:",omitempty"`
	BatchBufferInterval  time.Duration `model:",omitempty"`
	BatchTimeout         time.Duration `model:",omitempty"`
	UseBatch             bool
}

type CircuitBreakerSettings

type CircuitBreakerSettings struct {
	Name                     string
	AllowedRequestInHalfOpen int           `model:",omitempty"`
	DurationOfBreak          time.Duration `model:",omitempty"`
	SamplingDuration         time.Duration `model:",omitempty"`
	SamplingFailureCount     int           `model:",omitempty"`
	SamplingFailureRatio     float64
	OnStateChange            func(name string, from string, to string)
}

func (*CircuitBreakerSettings) ToCircuitBreaker added in v0.9.3

func (s *CircuitBreakerSettings) ToCircuitBreaker(defaultName string, onCircuitOpen func()) *gobreaker.CircuitBreaker

type DomainEvent

type DomainEvent struct {
	ID                         uuid.UUID
	EventID                    uuid.UUID
	Topic                      string
	CanNotPublishToEventsource bool
	IsPublished                bool
	CanBuffered                bool
	CreatedAt                  time.Time
	PublishedAt                time.Time
}

func (*DomainEvent) GetCanBuffered

func (e *DomainEvent) GetCanBuffered() bool

func (*DomainEvent) GetCanNotPublishToEventsource

func (e *DomainEvent) GetCanNotPublishToEventsource() bool

func (*DomainEvent) GetEventID

func (e *DomainEvent) GetEventID() uuid.UUID

func (*DomainEvent) GetID

func (e *DomainEvent) GetID() uuid.UUID

func (*DomainEvent) GetTopic

func (e *DomainEvent) GetTopic() string

func (*DomainEvent) SetAddingEvent

func (e *DomainEvent) SetAddingEvent()

func (*DomainEvent) SetPublishingEvent

func (e *DomainEvent) SetPublishingEvent(ctx context.Context, publishedAt time.Time)

type DomainEventer

type DomainEventer interface {
	GetID() uuid.UUID
	GetEventID() uuid.UUID
	GetTopic() string
	GetCanNotPublishToEventsource() bool
	GetCanBuffered() bool
	SetAddingEvent()
	SetPublishingEvent(ctx context.Context, publishedAt time.Time)
}

type Entitier

type Entitier interface {
	GetID() uuid.UUID
	SetID(uuid.UUID)
	SetCreatedAt(user string, timestamp time.Time)
	SetUpdatedAt(user string, timestamp time.Time)
}

type Entity

type Entity struct {
	ID         uuid.UUID `gorm:"primaryKey" bson:"_id,omitempty"`
	CreateUser string
	UpdateUser string
	CreatedAt  time.Time
	UpdatedAt  time.Time
}

func (*Entity) GetID

func (e *Entity) GetID() uuid.UUID

func (*Entity) SetCreatedAt

func (e *Entity) SetCreatedAt(user string, timestamp time.Time)

func (*Entity) SetID

func (e *Entity) SetID(id uuid.UUID)

func (*Entity) SetUpdatedAt

func (e *Entity) SetUpdatedAt(user string, timestamp time.Time)

type EventBusSettings

type EventBusSettings struct {
	BufferedEventBufferCount int           `model:",omitempty"`
	BufferedEventBufferTime  time.Duration `model:",omitempty"`
	BufferedEventTimeout     time.Duration `model:",omitempty"`
	ConnectionTimeout        time.Duration `model:",omitempty"`
}

type KV added in v0.9.1

type KV struct {
	K string
	V interface{}
}

type Middleware

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

func (*Middleware) AddNext

func (m *Middleware) AddNext(next behavior) behavior

func (*Middleware) Next

func (m *Middleware) Next() Result

type Notification

type Notification interface{}

type NotificationHandler

type NotificationHandler func(
	ctx context.Context,
	notification interface{}) error

type ReplyHandler

type ReplyHandler func(receivedData interface{})

type RepositoryServiceSettings added in v0.11.0

type RepositoryServiceSettings struct {
	ConnectionTimeout time.Duration `model:",omitempty"`
}

type Request

type Request interface{}

type RequestHandler

type RequestHandler func(
	ctx context.Context,
	request interface{}) Result

type Result

type Result struct {
	V interface{}
	E error
}

func (*Result) ToHttpStatus

func (r *Result) ToHttpStatus() int

type StateServiceSettings added in v0.11.0

type StateServiceSettings struct {
	ConnectionTimeout time.Duration `model:",omitempty"`
}

type TracingSettings

type TracingSettings struct {
	ServiceName string
	Endpoint    string
}

Jump to

Keyboard shortcuts

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