Documentation
¶
Overview ¶
Package supabase provides NeoFlow-specific database operations.
Package supabase provides NeoFlow-specific database operations.
Index ¶
- type Execution
- type Repository
- func (r *Repository) CreateExecution(ctx context.Context, exec *Execution) error
- func (r *Repository) CreateTrigger(ctx context.Context, trigger *Trigger) error
- func (r *Repository) DeleteTrigger(ctx context.Context, id, userID string) error
- func (r *Repository) GetExecutions(ctx context.Context, triggerID string, limit int) ([]Execution, error)
- func (r *Repository) GetPendingTriggers(ctx context.Context) ([]Trigger, error)
- func (r *Repository) GetTrigger(ctx context.Context, id, userID string) (*Trigger, error)
- func (r *Repository) GetTriggers(ctx context.Context, userID string) ([]Trigger, error)
- func (r *Repository) SetTriggerEnabled(ctx context.Context, id, userID string, enabled bool) error
- func (r *Repository) UpdateTrigger(ctx context.Context, trigger *Trigger) error
- type RepositoryInterface
- type Trigger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Execution ¶
type Execution struct {
ID string `json:"id"`
TriggerID string `json:"trigger_id"`
ExecutedAt time.Time `json:"executed_at"`
Success bool `json:"success"`
Error string `json:"error,omitempty"`
ActionType string `json:"action_type,omitempty"`
ActionPayload json.RawMessage `json:"action_payload,omitempty"`
}
Execution represents an execution log entry.
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
Repository provides NeoFlow-specific data access methods.
func NewRepository ¶
func NewRepository(base *database.Repository) *Repository
NewRepository creates a new NeoFlow repository.
func (*Repository) CreateExecution ¶
func (r *Repository) CreateExecution(ctx context.Context, exec *Execution) error
CreateExecution logs a trigger execution.
func (*Repository) CreateTrigger ¶
func (r *Repository) CreateTrigger(ctx context.Context, trigger *Trigger) error
CreateTrigger inserts a new neoflow trigger.
func (*Repository) DeleteTrigger ¶
func (r *Repository) DeleteTrigger(ctx context.Context, id, userID string) error
DeleteTrigger removes a trigger.
func (*Repository) GetExecutions ¶
func (r *Repository) GetExecutions(ctx context.Context, triggerID string, limit int) ([]Execution, error)
GetExecutions lists executions for a trigger.
func (*Repository) GetPendingTriggers ¶
func (r *Repository) GetPendingTriggers(ctx context.Context) ([]Trigger, error)
GetPendingTriggers retrieves triggers that need execution.
func (*Repository) GetTrigger ¶
GetTrigger returns a trigger by id scoped to a user.
func (*Repository) GetTriggers ¶
GetTriggers retrieves neoflow triggers for a user.
func (*Repository) SetTriggerEnabled ¶
SetTriggerEnabled sets enabled flag.
func (*Repository) UpdateTrigger ¶
func (r *Repository) UpdateTrigger(ctx context.Context, trigger *Trigger) error
UpdateTrigger updates a trigger by id.
type RepositoryInterface ¶
type RepositoryInterface interface {
// Trigger Operations
GetTriggers(ctx context.Context, userID string) ([]Trigger, error)
GetTrigger(ctx context.Context, id, userID string) (*Trigger, error)
CreateTrigger(ctx context.Context, trigger *Trigger) error
UpdateTrigger(ctx context.Context, trigger *Trigger) error
DeleteTrigger(ctx context.Context, id, userID string) error
SetTriggerEnabled(ctx context.Context, id, userID string, enabled bool) error
GetPendingTriggers(ctx context.Context) ([]Trigger, error)
// Execution Operations
CreateExecution(ctx context.Context, exec *Execution) error
GetExecutions(ctx context.Context, triggerID string, limit int) ([]Execution, error)
}
RepositoryInterface defines NeoFlow-specific data access methods. This interface allows for easy mocking in tests.
type Trigger ¶
type Trigger struct {
ID string `json:"id"`
UserID string `json:"user_id"`
Name string `json:"name"`
TriggerType string `json:"trigger_type"`
Schedule string `json:"schedule,omitempty"`
Condition json.RawMessage `json:"condition,omitempty"`
Action json.RawMessage `json:"action"`
Enabled bool `json:"enabled"`
LastExecution time.Time `json:"last_execution,omitempty"`
NextExecution time.Time `json:"next_execution,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
Trigger represents an neoflow trigger.