Documentation
¶
Index ¶
- type Event
- type EventRow
- type Repo
- type TrackService
- func (s *TrackService) CountByType(ctx context.Context, eventType string, since time.Time) (int, error)
- func (s *TrackService) CountByTypeInWorkspace(ctx context.Context, workspaceID, eventType string, since time.Time) (int, error)
- func (s *TrackService) Recent(ctx context.Context, limit int) ([]EventRow, error)
- func (s *TrackService) RecentByType(ctx context.Context, eventType string, limit int) ([]EventRow, error)
- func (s *TrackService) Track(ctx context.Context, e Event) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EventRow ¶
type EventRow struct {
ID int64 `json:"id"`
WorkspaceID string `json:"workspace_id,omitempty"`
UserID string `json:"user_id,omitempty"`
Type string `json:"event_type"`
EntityType string `json:"entity_type,omitempty"`
EntityID string `json:"entity_id,omitempty"`
Payload map[string]any `json:"payload"`
CreatedAt time.Time `json:"created_at"`
}
type Repo ¶
type Repo interface {
Track(ctx context.Context, e Event, now time.Time)
RecentByType(ctx context.Context, eventType string, limit int) ([]EventRow, error)
Recent(ctx context.Context, since time.Time, limit int) ([]EventRow, error)
CountByType(ctx context.Context, eventType string, since time.Time) (int, error)
CountByTypeInWorkspace(ctx context.Context, workspaceID, eventType string, since time.Time) (int, error)
}
type TrackService ¶
type TrackService struct {
// contains filtered or unexported fields
}
func NewTrackService ¶
func NewTrackService(repo Repo, log *slog.Logger) *TrackService
func (*TrackService) CountByType ¶
func (*TrackService) CountByTypeInWorkspace ¶
func (*TrackService) RecentByType ¶
Click to show internal directories.
Click to hide internal directories.