Documentation
¶
Index ¶
- Constants
- Variables
- func GenerateULID() (string, error)
- type CloudEventPayload
- type Delivery
- type DeliveryAttempt
- type DeliveryAttemptRepository
- type DeliveryAttemptService
- type DeliveryRepository
- type DeliveryService
- type FindFilter
- type FindOptions
- type FindOrderBy
- type FindPagination
- type Message
- type MessageRepository
- type MessageService
- type MigrationRepository
- type MigrationService
- type Subscription
- type SubscriptionRepository
- type SubscriptionService
- type Topic
- type TopicRepository
- type TopicService
- type WorkerService
Constants ¶
View Source
const ( // DeliveryStatusPending represents the delivery pending status DeliveryStatusPending = "pending" // DeliveryStatusFailed represents the delivery failed status DeliveryStatusFailed = "failed" // DeliveryStatusCompleted represents the delivery completed status DeliveryStatusCompleted = "completed" )
Variables ¶
View Source
var ( // ErrTopicAlreadyExists is used when the topic already exists on repository. ErrTopicAlreadyExists = errors.New("topic_already_exists") // ErrTopicDoesNotExists is used when the topic does not exists on repository. ErrTopicDoesNotExists = errors.New("topic_does_not_exists") // ErrSubscriptionAlreadyExists is used when the subscription already exists on repository. ErrSubscriptionAlreadyExists = errors.New("subscription_already_exists") // ErrSubscriptionDoesNotExists is used when the subscription does not exists on repository. ErrSubscriptionDoesNotExists = errors.New("subscription_does_not_exists") // ErrMessageDoesNotExists is used when the message does not exists on repository. ErrMessageDoesNotExists = errors.New("message_does_not_exists") // ErrDeliveryDoesNotExists is used when the delivery does not exists on repository. ErrDeliveryDoesNotExists = errors.New("delivery_does_not_exists") // ErrDeliveryAttemptDoesNotExists is used when the delivery attempt does not exists on repository. ErrDeliveryAttemptDoesNotExists = errors.New("delivery_attempt_does_not_exists") // DefaultPaginationLimit represents a default pagination limit on resource list DefaultPaginationLimit = env.GetInt("HAMMER_DEFAULT_PAGINATION_LIMIT", 25) // MaxPaginationLimit represents the max value for pagination limit on resource list MaxPaginationLimit = env.GetInt("HAMMER_MAX_PAGINATION_LIMIT", 50) // DefaultSecretTokenLength represents a default length for a random string to secret token if it is not informed DefaultSecretTokenLength = env.GetInt("HAMMER_DEFAULT_SECRET_TOKEN_LENGTH", 40) // WorkerDatabaseDelay represents a delay for database access by workers WorkerDatabaseDelay = env.GetInt("HAMMER_WORKER_DATABASE_DELAY", 5) )
Functions ¶
func GenerateULID ¶ added in v0.6.0
GenerateULID returns a new ulid id
Types ¶
type CloudEventPayload ¶
type CloudEventPayload struct {
SpecVersion string `json:"specversion"`
Type string `json:"type"`
Source string `json:"source"`
ID string `json:"id"`
Time time.Time `json:"time"`
SecretToken string `json:"secrettoken"`
MessageID string `json:"messageid"`
SubscriptionID string `json:"subscriptionid"`
TopicID string `json:"topicid"`
DataContentType string `json:"datacontenttype"`
DataBase64 string `json:"data_base64"`
}
CloudEventPayload data
type Delivery ¶
type Delivery struct {
ID string `json:"id" db:"id"`
TopicID string `json:"topic_id" db:"topic_id"`
SubscriptionID string `json:"subscription_id" db:"subscription_id"`
MessageID string `json:"message_id" db:"message_id"`
ContentType string `json:"content_type" db:"content_type"`
Data string `json:"data" db:"data"`
URL string `json:"url" db:"url"`
SecretToken string `json:"secret_token" db:"secret_token"`
MaxDeliveryAttempts int `json:"max_delivery_attempts" db:"max_delivery_attempts"`
DeliveryAttemptDelay int `json:"delivery_attempt_delay" db:"delivery_attempt_delay"`
DeliveryAttemptTimeout int `json:"delivery_attempt_timeout" db:"delivery_attempt_timeout"`
ScheduledAt time.Time `json:"scheduled_at" db:"scheduled_at"`
DeliveryAttempts int `json:"delivery_attempts" db:"delivery_attempts"`
Status string `json:"status" db:"status"`
CreatedAt time.Time `json:"created_at" db:"created_at"`
UpdatedAt time.Time `json:"updated_at" db:"updated_at"`
}
Delivery data
type DeliveryAttempt ¶
type DeliveryAttempt struct {
ID string `json:"id" db:"id"`
DeliveryID string `json:"delivery_id" db:"delivery_id"`
Request string `json:"request" db:"request"`
Response string `json:"response" db:"response"`
ResponseStatusCode int `json:"response_status_code" db:"response_status_code"`
ExecutionDuration int `json:"execution_duration" db:"execution_duration"`
Success bool `json:"success" db:"success"`
Error string `json:"error" db:"error"`
CreatedAt time.Time `json:"created_at" db:"created_at"`
}
DeliveryAttempt data
func MakeTestDeliveryAttempt ¶
func MakeTestDeliveryAttempt() *DeliveryAttempt
MakeTestDeliveryAttempt returns a new DeliveryAttempt
type DeliveryAttemptRepository ¶
type DeliveryAttemptRepository interface {
Find(ctx context.Context, id string) (*DeliveryAttempt, error)
FindAll(ctx context.Context, findOptions FindOptions) ([]*DeliveryAttempt, error)
Store(ctx context.Context, deliveryAttempt *DeliveryAttempt) error
}
DeliveryAttemptRepository interface
type DeliveryAttemptService ¶
type DeliveryAttemptService interface {
Find(ctx context.Context, id string) (*DeliveryAttempt, error)
FindAll(ctx context.Context, findOptions FindOptions) ([]*DeliveryAttempt, error)
}
DeliveryAttemptService interface
type DeliveryRepository ¶
type DeliveryRepository interface {
Find(ctx context.Context, id string) (*Delivery, error)
FindAll(ctx context.Context, findOptions FindOptions) ([]*Delivery, error)
Store(ctx context.Context, delivery *Delivery) error
Dispatch(ctx context.Context) (*DeliveryAttempt, error)
}
DeliveryRepository interface
type DeliveryService ¶
type DeliveryService interface {
Find(ctx context.Context, id string) (*Delivery, error)
FindAll(ctx context.Context, findOptions FindOptions) ([]*Delivery, error)
}
DeliveryService interface
type FindFilter ¶
FindFilter data
type FindOptions ¶
type FindOptions struct {
FindFilters []FindFilter
FindPagination *FindPagination
FindOrderBy *FindOrderBy
}
FindOptions data
type Message ¶
type Message struct {
ID string `json:"id" db:"id"`
TopicID string `json:"topic_id" db:"topic_id"`
ContentType string `json:"content_type" db:"content_type"`
Data string `json:"data" db:"data"`
CreatedAt time.Time `json:"created_at" db:"created_at"`
}
Message data
type MessageRepository ¶
type MessageRepository interface {
Find(ctx context.Context, id string) (*Message, error)
FindAll(ctx context.Context, findOptions FindOptions) ([]*Message, error)
Store(ctx context.Context, message *Message) error
Delete(ctx context.Context, id string) error
}
MessageRepository interface
type MessageService ¶
type MessageService interface {
Find(ctx context.Context, id string) (*Message, error)
FindAll(ctx context.Context, findOptions FindOptions) ([]*Message, error)
Create(ctx context.Context, message *Message) error
Delete(ctx context.Context, id string) error
}
MessageService interface
type MigrationRepository ¶
MigrationRepository interface
type MigrationService ¶
MigrationService interface
type Subscription ¶
type Subscription struct {
ID string `json:"id" db:"id"`
TopicID string `json:"topic_id" db:"topic_id"`
Name string `json:"name" db:"name"`
URL string `json:"url" db:"url"`
SecretToken string `json:"secret_token" db:"secret_token"`
MaxDeliveryAttempts int `json:"max_delivery_attempts" db:"max_delivery_attempts"`
DeliveryAttemptDelay int `json:"delivery_attempt_delay" db:"delivery_attempt_delay"`
DeliveryAttemptTimeout int `json:"delivery_attempt_timeout" db:"delivery_attempt_timeout"`
CreatedAt time.Time `json:"created_at" db:"created_at"`
UpdatedAt time.Time `json:"updated_at" db:"updated_at"`
}
Subscription data
func MakeTestSubscription ¶
func MakeTestSubscription() *Subscription
MakeTestSubscription returns a new Subscription
type SubscriptionRepository ¶
type SubscriptionRepository interface {
Find(ctx context.Context, id string) (*Subscription, error)
FindAll(ctx context.Context, findOptions FindOptions) ([]*Subscription, error)
Store(ctx context.Context, subscription *Subscription) error
Delete(ctx context.Context, id string) error
}
SubscriptionRepository interface
type SubscriptionService ¶
type SubscriptionService interface {
Find(ctx context.Context, id string) (*Subscription, error)
FindAll(ctx context.Context, findOptions FindOptions) ([]*Subscription, error)
Create(ctx context.Context, subscription *Subscription) error
Update(ctx context.Context, subscription *Subscription) error
Delete(ctx context.Context, id string) error
}
SubscriptionService interface
type Topic ¶
type Topic struct {
ID string `json:"id" db:"id"`
Name string `json:"name" db:"name"`
CreatedAt time.Time `json:"created_at" db:"created_at"`
UpdatedAt time.Time `json:"updated_at" db:"updated_at"`
}
Topic data
type TopicRepository ¶
type TopicRepository interface {
Find(ctx context.Context, id string) (*Topic, error)
FindAll(ctx context.Context, findOptions FindOptions) ([]*Topic, error)
Store(ctx context.Context, topic *Topic) error
Delete(ctx context.Context, id string) error
}
TopicRepository interface
type TopicService ¶
type TopicService interface {
Find(ctx context.Context, id string) (*Topic, error)
FindAll(ctx context.Context, findOptions FindOptions) ([]*Topic, error)
Create(ctx context.Context, topic *Topic) error
Update(ctx context.Context, topic *Topic) error
Delete(ctx context.Context, id string) error
}
TopicService interface
Click to show internal directories.
Click to hide internal directories.