Documentation
¶
Index ¶
- Constants
- func ConnectPool(ctx context.Context, dsn string) (*pgxpool.Pool, error)
- func RunMigrations(pool *pgxpool.Pool) error
- func SeedLocalWorkspace(ctx context.Context, s *Store, dailyCap int) error
- type Store
- func (s *Store) BumpSessionCallIndex(ctx context.Context, sessionID string) (int, error)
- func (s *Store) CountRequestsSince(ctx context.Context, workspaceID string, since time.Time) (int, error)
- func (s *Store) CreateFeedback(ctx context.Context, f *store.Feedback) error
- func (s *Store) CreateRequestLog(ctx context.Context, l *store.RequestLog) error
- func (s *Store) CreateScenario(ctx context.Context, sc *store.Scenario) error
- func (s *Store) CreateScenarioRun(ctx context.Context, r *store.ScenarioRun) error
- func (s *Store) CreateSession(ctx context.Context, sess *store.Session) error
- func (s *Store) CreateUser(ctx context.Context, u *store.User, passwordHash string) error
- func (s *Store) CreateWebhookLog(ctx context.Context, l *store.WebhookLog) error
- func (s *Store) CreateWorkspace(ctx context.Context, w *store.Workspace) error
- func (s *Store) DeleteScenario(ctx context.Context, id string) error
- func (s *Store) DeleteSession(ctx context.Context, id string) error
- func (s *Store) GetActiveSession(ctx context.Context, workspaceID string) (*store.Session, error)
- func (s *Store) GetDefaultScenario(ctx context.Context, workspaceID string) (*store.Scenario, error)
- func (s *Store) GetRequestLog(ctx context.Context, id string) (*store.RequestLog, error)
- func (s *Store) GetScenario(ctx context.Context, id string) (*store.Scenario, error)
- func (s *Store) GetUserByEmail(ctx context.Context, email string) (*store.User, string, error)
- func (s *Store) GetUserByID(ctx context.Context, id string) (*store.User, error)
- func (s *Store) GetWebhookLog(ctx context.Context, id string) (*store.WebhookLog, error)
- func (s *Store) GetWebhookLogByRequestID(ctx context.Context, requestLogID string) (*store.WebhookLog, error)
- func (s *Store) GetWorkspaceByAPIKey(ctx context.Context, apiKey string) (*store.Workspace, error)
- func (s *Store) GetWorkspaceByID(ctx context.Context, id string) (*store.Workspace, error)
- func (s *Store) GetWorkspaceBySlug(ctx context.Context, slug string) (*store.Workspace, error)
- func (s *Store) ListRequestLogs(ctx context.Context, workspaceID string, limit, offset int) ([]*store.RequestLog, error)
- func (s *Store) ListScenarios(ctx context.Context, workspaceID string) ([]*store.Scenario, error)
- func (s *Store) ListWebhookLogs(ctx context.Context, workspaceID string, limit, offset int) ([]*store.WebhookLog, error)
- func (s *Store) TrimOldLogs(ctx context.Context, cutoff time.Time) (int64, error)
- func (s *Store) UpdateScenario(ctx context.Context, sc *store.Scenario) error
- func (s *Store) UpdateScenarioRun(ctx context.Context, r *store.ScenarioRun) error
- func (s *Store) UpdateUserLastLogin(ctx context.Context, id string, at time.Time) error
- func (s *Store) UpdateWebhookLog(ctx context.Context, l *store.WebhookLog) error
- func (s *Store) UpdateWorkspace(ctx context.Context, w *store.Workspace) error
Constants ¶
const LocalWorkspaceID = store.LocalWorkspaceID
LocalWorkspaceID is retained for backward compatibility; the canonical constant now lives in the store package.
Variables ¶
This section is empty.
Functions ¶
func ConnectPool ¶
ConnectPool opens a pgxpool connection and pings it.
func RunMigrations ¶
func SeedLocalWorkspace ¶
SeedLocalWorkspace creates the default local workspace if it doesn't exist. dailyCap is the per-24h request limit (0 = unlimited). Migrations already set this to 200 on existing databases, but fresh boots need the seed to carry the cap in the INSERT payload.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) BumpSessionCallIndex ¶
BumpSessionCallIndex increments call_index by 1 atomically and returns the PRE-bump value so callers can use it as the step index for the current request without a round-trip + race.
func (*Store) CountRequestsSince ¶ added in v1.2.0
func (*Store) CreateFeedback ¶ added in v1.2.0
func (*Store) CreateRequestLog ¶
func (*Store) CreateScenario ¶
func (*Store) CreateScenarioRun ¶
func (*Store) CreateSession ¶
func (*Store) CreateUser ¶
func (*Store) CreateWebhookLog ¶
func (*Store) CreateWorkspace ¶
func (*Store) GetActiveSession ¶
func (*Store) GetDefaultScenario ¶
func (*Store) GetRequestLog ¶
func (*Store) GetScenario ¶
func (*Store) GetUserByEmail ¶
func (*Store) GetUserByID ¶
func (*Store) GetWebhookLog ¶
func (*Store) GetWebhookLogByRequestID ¶
func (*Store) GetWorkspaceByAPIKey ¶
func (*Store) GetWorkspaceByID ¶
func (*Store) GetWorkspaceBySlug ¶
func (*Store) ListRequestLogs ¶
func (*Store) ListScenarios ¶
func (*Store) ListWebhookLogs ¶
func (s *Store) ListWebhookLogs(ctx context.Context, workspaceID string, limit, offset int) ([]*store.WebhookLog, error)
ListWebhookLogs returns webhook logs whose parent request_log belongs to the given workspace. Newest first.
func (*Store) TrimOldLogs ¶ added in v1.2.0
TrimOldLogs deletes request_logs older than cutoff. Webhook rows cascade via request_log_id FK. Returns rows deleted.