entities

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attempt

type Attempt struct {
	ID            string        `json:"id" db:"id"`
	EventId       string        `json:"event_id" db:"event_id"`
	EndpointId    string        `json:"endpoint_id" db:"endpoint_id"`
	Status        AttemptStatus `json:"status" db:"status"`
	AttemptNumber int           `json:"attempt_number" db:"attempt_number"`
	ScheduledAt   types.Time    `json:"scheduled_at" db:"scheduled_at"`
	AttemptedAt   *types.Time   `json:"attempted_at" db:"attempted_at"`

	ErrorCode *AttemptErrorCode `json:"error_code" db:"error_code"`
	Request   *AttemptRequest   `json:"request" db:"request"`
	Response  *AttemptResponse  `json:"response" db:"response"`

	BaseModel
}

type AttemptErrorCode

type AttemptErrorCode = string
const (
	AttemptErrorCodeTimeout          AttemptErrorCode = "TIMEOUT"
	AttemptErrorCodeUnknown          AttemptErrorCode = "UNKNOWN"
	AttemptErrorCodeEndpointDisabled AttemptErrorCode = "ENDPOINT_DISABLED"
	AttemptErrorCodeEndpointNotFound AttemptErrorCode = "ENDPOINT_NOT_FOUND"
)

type AttemptRequest

type AttemptRequest struct {
	Method  string            `json:"method"`
	URL     string            `json:"url"`
	Headers map[string]string `json:"headers"`
	Body    *string           `json:"body"`
}

func (*AttemptRequest) Scan

func (m *AttemptRequest) Scan(src interface{}) error

func (AttemptRequest) Value

func (m AttemptRequest) Value() (driver.Value, error)

type AttemptResponse

type AttemptResponse struct {
	Status  int               `json:"status"`
	Headers map[string]string `json:"headers"`
	Body    *string           `json:"body"`
}

func (*AttemptResponse) Scan

func (m *AttemptResponse) Scan(src interface{}) error

func (AttemptResponse) Value

func (m AttemptResponse) Value() (driver.Value, error)

type AttemptStatus

type AttemptStatus = string
const (
	AttemptStatusInit     AttemptStatus = "INIT"
	AttemptStatusQueued   AttemptStatus = "QUEUED"
	AttemptStatusSuccess  AttemptStatus = "SUCCESSFUL"
	AttemptStatusFailure  AttemptStatus = "FAILED"
	AttemptStatusCanceled AttemptStatus = "CANCELED"
)

type BaseModel

type BaseModel struct {
	CreatedAt   types.Time `db:"created_at" json:"created_at"`
	UpdatedAt   types.Time `db:"updated_at" json:"updated_at"`
	WorkspaceId string     `db:"ws_id" json:"-"`
}

type CustomResponse

type CustomResponse struct {
	Code        int    `json:"code" validate:"required,gte=200,lte=599"`
	ContentType string `json:"content_type" validate:"required"`
	Body        string `json:"body"`
}

func (*CustomResponse) Scan

func (m *CustomResponse) Scan(src interface{}) error

func (CustomResponse) Value

func (m CustomResponse) Value() (driver.Value, error)

type Endpoint

type Endpoint struct {
	ID          string         `json:"id" db:"id"`
	Name        *string        `json:"name" db:"name"`
	Description *string        `json:"description" db:"description"`
	Enabled     bool           `json:"enabled" db:"enabled" default:"true"`
	Request     RequestConfig  `json:"request" db:"request"`
	Retry       Retry          `json:"retry" db:"retry"`
	Events      pq.StringArray `json:"events" db:"events"`

	BaseModel
}

func (*Endpoint) Init

func (m *Endpoint) Init()

func (*Endpoint) Validate

func (m *Endpoint) Validate() error

type Event

type Event struct {
	ID        string          `json:"id" validate:"required"`
	EventType string          `json:"event_type" db:"event_type" validate:"required"`
	Data      json.RawMessage `json:"data" validate:"required"`

	BaseModel
}

func (*Event) Validate

func (m *Event) Validate() error

type FixedStrategyConfig

type FixedStrategyConfig struct {
	Attempts []int64 `json:"attempts" default:"[0,60,3600]"`
}

type Metadata

type Metadata map[string]string

func (*Metadata) Scan

func (m *Metadata) Scan(src interface{}) error

func (*Metadata) Value

func (m *Metadata) Value() (driver.Value, error)

type RequestConfig

type RequestConfig struct {
	URL     string            `json:"url" validate:"required"`
	Method  string            `json:"method" validate:"required,oneof=GET POST PUT DELETE PATCH"`
	Headers map[string]string `json:"headers"`
	Timeout int64             `json:"timeout" default:"10000" validate:"gte=0"`
}

func (*RequestConfig) Scan

func (m *RequestConfig) Scan(src interface{}) error

func (RequestConfig) Value

func (m RequestConfig) Value() (driver.Value, error)

type Retry

type Retry struct {
	Strategy RetryStrategy       `json:"strategy" validate:"oneof=fixed" default:"fixed"`
	Config   FixedStrategyConfig `json:"config"`
}

func (*Retry) Scan

func (m *Retry) Scan(src interface{}) error

func (*Retry) Validate

func (m *Retry) Validate() error

func (Retry) Value

func (m Retry) Value() (driver.Value, error)

type RetryStrategy

type RetryStrategy string
const (
	RetryStrategyFixed RetryStrategy = "fixed"
)

func (RetryStrategy) String

func (m RetryStrategy) String() string

type Source

type Source struct {
	ID   string  `json:"id" db:"id"`
	Name *string `json:"name" db:"name"`

	Enabled bool           `json:"enabled" db:"enabled"`
	Path    string         `json:"path" db:"path"`
	Methods pq.StringArray `json:"methods" db:"methods"`

	Response *CustomResponse `json:"response" db:"response"`

	BaseModel
}

func (*Source) Init

func (m *Source) Init()

func (*Source) Validate

func (m *Source) Validate() error

type Workspace

type Workspace struct {
	ID          string  `json:"id" db:"id"`
	Name        *string `json:"name" db:"name"`
	Description *string `json:"description" db:"description"`

	CreatedAt types.Time `db:"created_at" json:"created_at"`
	UpdatedAt types.Time `db:"updated_at" json:"updated_at"`
}

func (*Workspace) Validate

func (m *Workspace) Validate() error

Jump to

Keyboard shortcuts

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