handlers

package
v0.0.42 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2025 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package handlers implements the API server interface with request handlers for the CBT API.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNodeNotExternal       = errors.New("node is not external model")
	ErrNodeNotTransformation = errors.New("node is not transformation model")
)

Define static errors for models package

View Source
var ErrInvalidModelID = fiber.NewError(fiber.StatusBadRequest, "invalid model ID format, expected database.table")

ErrInvalidModelID is returned when an invalid model ID format is provided

View Source
var ErrModelNotFound = fiber.NewError(fiber.StatusNotFound, "model not found")

ErrModelNotFound is returned when a model is not found

Functions

This section is empty.

Types

type IntervalTypeTransformation

type IntervalTypeTransformation struct {
	Name       string `json:"name"`                 // Display name (e.g., "timestamp", "epoch")
	Expression string `json:"expression,omitempty"` // Optional CEL expression (e.g., "math.floor(value / 12)")
	Format     string `json:"format,omitempty"`     // Optional display format hint (e.g., "datetime", "date", "time")
}

IntervalTypeTransformation represents a single transformation step for an interval type

type IntervalTypesConfig

type IntervalTypesConfig map[string][]IntervalTypeTransformation

IntervalTypesConfig maps interval type names to their transformation pipelines

type Server

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

Server implements the generated.ServerInterface

func NewServer

func NewServer(modelsService models.Service, adminService admin.Service, intervalTypes IntervalTypesConfig, log logrus.FieldLogger) *Server

NewServer creates a new API server instance

func (*Server) DebugCoverageAtPosition added in v0.0.36

func (s *Server) DebugCoverageAtPosition(c fiber.Ctx, id string, position int) error

DebugCoverageAtPosition handles GET /api/v1/models/transformations/{id}/coverage/{position} This is the comprehensive debugging endpoint that uses the same validation logic as backfill and dependency checking. It provides a single source of truth for debugging why a position cannot be processed by showing: - The model's own coverage and gaps - All dependencies' bounds and gaps (recursively) - Validation results using the same logic as the coordinator

func (*Server) GetExternalBounds

func (s *Server) GetExternalBounds(c fiber.Ctx, id string) error

GetExternalBounds handles GET /api/v1/models/external/{id}/bounds

func (*Server) GetExternalModel

func (s *Server) GetExternalModel(c fiber.Ctx, id string) error

GetExternalModel handles GET /api/v1/models/external/{id}

func (*Server) GetIntervalTypes

func (s *Server) GetIntervalTypes(c fiber.Ctx) error

GetIntervalTypes returns the configured interval type transformations GET /api/v1/interval/types

func (*Server) GetScheduledRun

func (s *Server) GetScheduledRun(c fiber.Ctx, id string) error

GetScheduledRun handles GET /api/v1/models/transformations/{id}/runs

func (*Server) GetTransformation

func (s *Server) GetTransformation(c fiber.Ctx, id string) error

GetTransformation handles GET /api/v1/models/transformations/{id}

func (*Server) GetTransformationCoverage

func (s *Server) GetTransformationCoverage(c fiber.Ctx, id string) error

GetTransformationCoverage handles GET /api/v1/models/transformations/{id}/coverage

func (*Server) ListAllModels

func (s *Server) ListAllModels(c fiber.Ctx, params generated.ListAllModelsParams) error

ListAllModels handles GET /api/v1/models

func (*Server) ListExternalBounds

func (s *Server) ListExternalBounds(c fiber.Ctx) error

ListExternalBounds handles GET /api/v1/models/external/bounds

func (*Server) ListExternalModels

func (s *Server) ListExternalModels(c fiber.Ctx, params generated.ListExternalModelsParams) error

ListExternalModels handles GET /api/v1/models/external

func (*Server) ListScheduledRuns

func (s *Server) ListScheduledRuns(c fiber.Ctx, params generated.ListScheduledRunsParams) error

ListScheduledRuns handles GET /api/v1/models/transformations/runs

func (*Server) ListTransformationCoverage

func (s *Server) ListTransformationCoverage(c fiber.Ctx, params generated.ListTransformationCoverageParams) error

ListTransformationCoverage handles GET /api/v1/models/transformations/coverage

func (*Server) ListTransformations

func (s *Server) ListTransformations(c fiber.Ctx, params generated.ListTransformationsParams) error

ListTransformations handles GET /api/v1/models/transformations

Jump to

Keyboard shortcuts

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