models

package
v1.0.10 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AsyncRequest

type AsyncRequest struct {
	// DynamORM composite key pattern
	PK string `dynamorm:"pk"`
	SK string `dynamorm:"sk"`

	// Request data with proper attribute mapping
	RequestID    string                 `dynamorm:"request_id" json:"requestId"`
	ConnectionID string                 `dynamorm:"connection_id" json:"connectionId" dynamorm-index:"connection-index,pk"`
	Status       RequestStatus          `dynamorm:"status" json:"status" dynamorm-index:"status-index,sk"`
	Action       string                 `dynamorm:"action" json:"action"`
	Payload      map[string]interface{} `dynamorm:"payload,omitempty" json:"payload,omitempty"`

	// Processing information
	ProcessingStarted *time.Time `dynamorm:"processing_started,omitempty" json:"processingStarted,omitempty"`
	ProcessingEnded   *time.Time `dynamorm:"processing_ended,omitempty" json:"processingEnded,omitempty"`

	// Result or error
	Result map[string]interface{} `dynamorm:"result,omitempty" json:"result,omitempty"`
	Error  string                 `dynamorm:"error,omitempty" json:"error,omitempty"`

	// Progress tracking
	Progress        float64                `dynamorm:"progress" json:"progress"`
	ProgressMessage string                 `dynamorm:"progress_message,omitempty" json:"progressMessage,omitempty"`
	ProgressDetails map[string]interface{} `dynamorm:"progress_details,omitempty" json:"progressDetails,omitempty"`

	// Retry information
	RetryCount int       `dynamorm:"retry_count" json:"retryCount"`
	MaxRetries int       `dynamorm:"max_retries" json:"maxRetries"`
	RetryAfter time.Time `dynamorm:"retry_after,omitempty" json:"retryAfter,omitempty"`

	// User and tenant for querying
	UserID   string `dynamorm:"user_id" json:"userId" dynamorm-index:"user-index,sk"`
	TenantID string `dynamorm:"tenant_id" json:"tenantId" dynamorm-index:"tenant-index,sk"`

	// DynamORM managed fields
	CreatedAt time.Time `dynamorm:"created_at" json:"createdAt"`
	UpdatedAt time.Time `dynamorm:"updated_at" json:"updatedAt"`
	Version   int       `dynamorm:"version" json:"version"`

	// TTL for automatic cleanup
	TTL int64 `dynamorm:"ttl,omitempty" json:"ttl,omitempty"`
}

AsyncRequest represents a queued async request - single model serving both business and database needs

func (*AsyncRequest) FromStoreModel

func (r *AsyncRequest) FromStoreModel(req *store.AsyncRequest)

FromStoreModel converts store.AsyncRequest to DynamORM AsyncRequest

func (*AsyncRequest) SetKeys

func (r *AsyncRequest) SetKeys()

SetKeys sets the composite keys for the request

func (*AsyncRequest) TableName

func (r *AsyncRequest) TableName() string

TableName returns the DynamoDB table name

func (*AsyncRequest) ToStoreModel

func (r *AsyncRequest) ToStoreModel() *store.AsyncRequest

ToStoreModel converts DynamORM AsyncRequest to store.AsyncRequest

type Connection

type Connection struct {
	// DynamORM composite key pattern
	PK string `dynamorm:"pk"`
	SK string `dynamorm:"sk"`

	// Connection data with proper attribute mapping
	ConnectionID string    `dynamorm:"connection_id" json:"connectionId"`
	UserID       string    `dynamorm:"user_id" json:"userId" dynamorm-index:"user-index,pk"`
	TenantID     string    `dynamorm:"tenant_id" json:"tenantId" dynamorm-index:"tenant-index,pk"`
	Endpoint     string    `dynamorm:"endpoint" json:"endpoint"`
	ConnectedAt  time.Time `dynamorm:"connected_at" json:"connectedAt"`
	LastPing     time.Time `dynamorm:"last_ping" json:"lastPing"`

	// Metadata for storing additional information
	Metadata map[string]string `dynamorm:"metadata,omitempty" json:"metadata,omitempty"`

	// DynamORM managed fields
	CreatedAt time.Time `dynamorm:"created_at" json:"createdAt"`
	UpdatedAt time.Time `dynamorm:"updated_at" json:"updatedAt"`
	Version   int       `dynamorm:"version" json:"version"`

	// TTL for automatic cleanup
	TTL int64 `dynamorm:"ttl,omitempty" json:"ttl,omitempty"`
}

Connection represents a WebSocket connection - single model serving both business and database needs

func (*Connection) FromStoreModel

func (c *Connection) FromStoreModel(conn *store.Connection)

FromStoreModel converts store.Connection to DynamORM Connection

func (*Connection) SetKeys

func (c *Connection) SetKeys()

SetKeys sets the composite keys for the connection

func (*Connection) TableName

func (c *Connection) TableName() string

TableName returns the DynamoDB table name

func (*Connection) ToStoreModel

func (c *Connection) ToStoreModel() *store.Connection

ToStoreModel converts DynamORM Connection to store.Connection

type RequestStatus

type RequestStatus string

RequestStatus represents the status of an async request

const (
	StatusPending    RequestStatus = "PENDING"
	StatusProcessing RequestStatus = "PROCESSING"
	StatusCompleted  RequestStatus = "COMPLETED"
	StatusFailed     RequestStatus = "FAILED"
	StatusCancelled  RequestStatus = "CANCELLED"
	StatusRetrying   RequestStatus = "RETRYING"
)

type Subscription

type Subscription struct {
	// DynamORM composite key pattern
	PK string `dynamorm:"pk"`
	SK string `dynamorm:"sk"`

	// Subscription data with proper attribute mapping
	SubscriptionID string   `dynamorm:"subscription_id" json:"subscriptionId"`
	ConnectionID   string   `dynamorm:"connection_id" json:"connectionId" dynamorm-index:"connection-index,pk"`
	RequestID      string   `dynamorm:"request_id" json:"requestId" dynamorm-index:"request-index,pk"`
	EventTypes     []string `dynamorm:"event_types,stringset" json:"eventTypes"`

	// DynamORM managed fields
	CreatedAt time.Time `dynamorm:"created_at" json:"createdAt"`
	UpdatedAt time.Time `dynamorm:"updated_at" json:"updatedAt"`
	Version   int       `dynamorm:"version" json:"version"`

	// TTL for automatic cleanup
	TTL int64 `dynamorm:"ttl,omitempty" json:"ttl,omitempty"`
}

Subscription represents a real-time update subscription - single model serving both business and database needs

func (*Subscription) FromStoreModel

func (s *Subscription) FromStoreModel(sub *store.Subscription)

FromStoreModel converts store.Subscription to DynamORM Subscription

func (*Subscription) SetKeys

func (s *Subscription) SetKeys()

SetKeys sets the composite keys for the subscription

func (*Subscription) TableName

func (s *Subscription) TableName() string

TableName returns the DynamoDB table name

func (*Subscription) ToStoreModel

func (s *Subscription) ToStoreModel() *store.Subscription

ToStoreModel converts DynamORM Subscription to store.Subscription

Jump to

Keyboard shortcuts

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