execution

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package execution provides MiniApp execution tracking via Supabase.

Package execution provides MiniApp execution tracking via Supabase.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateRequest

type CreateRequest struct {
	RequestID   string                 `json:"request_id"`
	AppID       string                 `json:"app_id"`
	UserAddress string                 `json:"user_address,omitempty"`
	SessionID   string                 `json:"session_id,omitempty"`
	Method      string                 `json:"method"`
	Params      map[string]interface{} `json:"params,omitempty"`
	Metadata    map[string]interface{} `json:"metadata,omitempty"`
}

CreateRequest is the request to create a new execution.

type Execution

type Execution struct {
	ID           int64                  `json:"id,omitempty"`
	RequestID    string                 `json:"request_id"`
	AppID        string                 `json:"app_id"`
	UserAddress  string                 `json:"user_address,omitempty"`
	SessionID    string                 `json:"session_id,omitempty"`
	Status       Status                 `json:"status"`
	Method       string                 `json:"method"`
	Params       map[string]interface{} `json:"params,omitempty"`
	Result       map[string]interface{} `json:"result,omitempty"`
	ErrorMessage string                 `json:"error_message,omitempty"`
	ErrorCode    string                 `json:"error_code,omitempty"`
	TxHash       string                 `json:"tx_hash,omitempty"`
	TxStatus     string                 `json:"tx_status,omitempty"`
	CreatedAt    *time.Time             `json:"created_at,omitempty"`
	StartedAt    *time.Time             `json:"started_at,omitempty"`
	CompletedAt  *time.Time             `json:"completed_at,omitempty"`
	Metadata     map[string]interface{} `json:"metadata,omitempty"`
}

Execution represents a MiniApp execution record.

type Service

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

Service handles execution tracking operations.

func NewService

func NewService(db *database.Client) *Service

NewService creates a new execution service.

func (*Service) Create

func (s *Service) Create(ctx context.Context, req CreateRequest) (*Execution, error)

Create creates a new execution record with pending status.

func (*Service) MarkFailed

func (s *Service) MarkFailed(ctx context.Context, requestID, errMsg, errCode string) error

MarkFailed marks an execution as failed with error info.

func (*Service) MarkProcessing

func (s *Service) MarkProcessing(ctx context.Context, requestID string) error

MarkProcessing marks an execution as processing.

func (*Service) MarkSuccess

func (s *Service) MarkSuccess(ctx context.Context, requestID string, result map[string]interface{}) error

MarkSuccess marks an execution as successful with result.

func (*Service) UpdateTxStatus

func (s *Service) UpdateTxStatus(ctx context.Context, requestID, txHash, txStatus string) error

UpdateTxStatus updates the transaction status.

type Status

type Status string

Status represents the execution status.

const (
	StatusPending    Status = "pending"
	StatusProcessing Status = "processing"
	StatusSuccess    Status = "success"
	StatusFailed     Status = "failed"
	StatusTimeout    Status = "timeout"
)

type UpdateRequest

type UpdateRequest struct {
	Status       *Status                `json:"status,omitempty"`
	Result       map[string]interface{} `json:"result,omitempty"`
	ErrorMessage *string                `json:"error_message,omitempty"`
	ErrorCode    *string                `json:"error_code,omitempty"`
	TxHash       *string                `json:"tx_hash,omitempty"`
	TxStatus     *string                `json:"tx_status,omitempty"`
	StartedAt    *time.Time             `json:"started_at,omitempty"`
	CompletedAt  *time.Time             `json:"completed_at,omitempty"`
}

UpdateRequest is the request to update an execution.

Jump to

Keyboard shortcuts

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