extensions

package
v0.0.0-...-04478d6 Latest Latest
Warning

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

Go to latest
Published: May 10, 2026 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CategoryDisplayNames = map[string]string{
	"core":         "Core",
	"geospatial":   "Geospatial",
	"ai_ml":        "AI & Machine Learning",
	"monitoring":   "Monitoring",
	"scheduling":   "Scheduling",
	"data_types":   "Data Types",
	"text_search":  "Text Search",
	"indexing":     "Indexing",
	"networking":   "Networking",
	"testing":      "Testing",
	"maintenance":  "Maintenance",
	"performance":  "Performance",
	"foreign_data": "Foreign Data",
	"triggers":     "Triggers",
	"sampling":     "Sampling",
	"utilities":    "Utilities",
}

CategoryDisplayNames maps category IDs to display names

Functions

This section is empty.

Types

type AvailableExtension

type AvailableExtension struct {
	ID               string    `json:"id"`
	Name             string    `json:"name"`
	DisplayName      string    `json:"display_name"`
	Description      string    `json:"description,omitempty"`
	Category         string    `json:"category"`
	IsCore           bool      `json:"is_core"`
	RequiresRestart  bool      `json:"requires_restart"`
	DocumentationURL string    `json:"documentation_url,omitempty"`
	CreatedAt        time.Time `json:"created_at"`
	UpdatedAt        time.Time `json:"updated_at"`
}

AvailableExtension represents an extension in the catalog

type Category

type Category struct {
	ID    string `json:"id"`
	Name  string `json:"name"`
	Count int    `json:"count"`
}

Category represents an extension category with count

type DisableExtensionResponse

type DisableExtensionResponse struct {
	Name    string `json:"name"`
	Success bool   `json:"success"`
	Message string `json:"message"`
}

DisableExtensionResponse is the response for disabling an extension

type EnableExtensionRequest

type EnableExtensionRequest struct {
	Schema string `json:"schema,omitempty"` // Optional schema to install into (defaults to public)
}

EnableExtensionRequest is the request body for enabling an extension

type EnableExtensionResponse

type EnableExtensionResponse struct {
	Name    string `json:"name"`
	Success bool   `json:"success"`
	Message string `json:"message"`
	Version string `json:"version,omitempty"`
}

EnableExtensionResponse is the response for enabling an extension

type EnabledExtension

type EnabledExtension struct {
	ID            string     `json:"id"`
	ExtensionName string     `json:"extension_name"`
	TenantID      *string    `json:"tenant_id,omitempty"`
	EnabledAt     time.Time  `json:"enabled_at"`
	EnabledBy     *string    `json:"enabled_by,omitempty"`
	DisabledAt    *time.Time `json:"disabled_at,omitempty"`
	DisabledBy    *string    `json:"disabled_by,omitempty"`
	IsActive      bool       `json:"is_active"`
	ErrorMessage  *string    `json:"error_message,omitempty"`
	CreatedAt     time.Time  `json:"created_at"`
	UpdatedAt     time.Time  `json:"updated_at"`
}

EnabledExtension represents a record of an enabled extension

type Extension

type Extension struct {
	ID               string     `json:"id"`
	Name             string     `json:"name"`
	DisplayName      string     `json:"display_name"`
	Description      string     `json:"description,omitempty"`
	Category         string     `json:"category"`
	IsCore           bool       `json:"is_core"`
	RequiresRestart  bool       `json:"requires_restart"`
	DocumentationURL string     `json:"documentation_url,omitempty"`
	IsEnabled        bool       `json:"is_enabled"`
	IsInstalled      bool       `json:"is_installed"`
	InstalledVersion string     `json:"installed_version,omitempty"`
	EnabledAt        *time.Time `json:"enabled_at,omitempty"`
	EnabledBy        *string    `json:"enabled_by,omitempty"`
	CreatedAt        time.Time  `json:"created_at"`
	UpdatedAt        time.Time  `json:"updated_at"`
}

Extension represents a PostgreSQL extension with its current status

type ExtensionStatusResponse

type ExtensionStatusResponse struct {
	Name             string `json:"name"`
	IsEnabled        bool   `json:"is_enabled"`
	IsInstalled      bool   `json:"is_installed"`
	InstalledVersion string `json:"installed_version,omitempty"`
	Error            string `json:"error,omitempty"`
}

ExtensionStatusResponse is the response for getting extension status

type Handler

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

Handler handles extension management HTTP endpoints

func NewHandler

func NewHandler(service *Service) *Handler

NewHandler creates a new extension handler

func (*Handler) DisableExtension

func (h *Handler) DisableExtension(c fiber.Ctx) error

DisableExtension disables a PostgreSQL extension POST /api/v1/admin/extensions/:name/disable

func (*Handler) DisableExtensionForTenant

func (h *Handler) DisableExtensionForTenant(c fiber.Ctx) error

DisableExtensionForTenant disables an extension for the current tenant

func (*Handler) EnableExtension

func (h *Handler) EnableExtension(c fiber.Ctx) error

EnableExtension enables a PostgreSQL extension POST /api/v1/admin/extensions/:name/enable

func (*Handler) EnableExtensionForTenant

func (h *Handler) EnableExtensionForTenant(c fiber.Ctx) error

EnableExtensionForTenant enables an extension for the current tenant

func (*Handler) GetExtensionStatus

func (h *Handler) GetExtensionStatus(c fiber.Ctx) error

GetExtensionStatus returns the status of a specific extension GET /api/v1/admin/extensions/:name/status

func (*Handler) GetExtensionStatusForTenant

func (h *Handler) GetExtensionStatusForTenant(c fiber.Ctx) error

GetExtensionStatusForTenant returns extension status for the current tenant

func (*Handler) ListExtensions

func (h *Handler) ListExtensions(c fiber.Ctx) error

ListExtensions returns all available extensions with their status GET /api/v1/admin/extensions

func (*Handler) ListExtensionsForTenant

func (h *Handler) ListExtensionsForTenant(c fiber.Ctx) error

ListExtensionsForTenant returns extensions for the current tenant GET /api/v1/tenants/:tenantId/extensions (or tenant context route)

func (*Handler) SyncExtensions

func (h *Handler) SyncExtensions(c fiber.Ctx) error

SyncExtensions syncs the extension catalog with PostgreSQL POST /api/v1/admin/extensions/sync

type ListExtensionsResponse

type ListExtensionsResponse struct {
	Extensions []Extension `json:"extensions"`
	Categories []Category  `json:"categories"`
}

ListExtensionsResponse is the response for listing extensions

type PostgresExtension

type PostgresExtension struct {
	Name             string  `json:"name"`
	DefaultVersion   string  `json:"default_version"`
	InstalledVersion *string `json:"installed_version,omitempty"`
	Comment          string  `json:"comment,omitempty"`
}

PostgresExtension represents an extension as reported by pg_available_extensions

type Service

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

Service handles extension management operations

func NewService

func NewService(db *database.Connection) *Service

NewService creates a new extension management service

func (*Service) DisableExtension

func (s *Service) DisableExtension(ctx context.Context, name string, userID *string) (*DisableExtensionResponse, error)

DisableExtension disables a PostgreSQL extension (default tenant).

func (*Service) DisableExtensionForTenant

func (s *Service) DisableExtensionForTenant(ctx context.Context, name string, userID *string, tenantID *string, tenantDBName string) (*DisableExtensionResponse, error)

DisableExtensionForTenant disables a PostgreSQL extension for a specific tenant.

func (*Service) EnableExtension

func (s *Service) EnableExtension(ctx context.Context, name string, userID *string, schema string) (*EnableExtensionResponse, error)

EnableExtension enables a PostgreSQL extension (default tenant).

func (*Service) EnableExtensionForTenant

func (s *Service) EnableExtensionForTenant(ctx context.Context, name string, userID *string, schema string, tenantID *string, tenantDBName string) (*EnableExtensionResponse, error)

EnableExtensionForTenant enables a PostgreSQL extension for a specific tenant. tenantDBName is the database name for separate-DB tenants (empty for default tenant).

func (*Service) GetExtensionStatus

func (s *Service) GetExtensionStatus(ctx context.Context, name string) (*ExtensionStatusResponse, error)

GetExtensionStatus returns the status of a specific extension (default tenant).

func (*Service) GetExtensionStatusForTenant

func (s *Service) GetExtensionStatusForTenant(ctx context.Context, name string, tenantID *string, tenantPool *pgxpool.Pool) (*ExtensionStatusResponse, error)

GetExtensionStatusForTenant returns the status of a specific extension for a tenant.

func (*Service) InitializeCoreExtensions

func (s *Service) InitializeCoreExtensions(ctx context.Context) error

InitializeCoreExtensions ensures core extensions are enabled on startup (default tenant)

func (*Service) InitializeCoreExtensionsForTenant

func (s *Service) InitializeCoreExtensionsForTenant(ctx context.Context, tenantID *string, tenantDBName string) error

InitializeCoreExtensionsForTenant ensures core extensions are enabled for a tenant's database. tenantDBName is the database name for separate-DB tenants (empty for default tenant).

func (*Service) ListExtensions

func (s *Service) ListExtensions(ctx context.Context) (*ListExtensionsResponse, error)

ListExtensions returns all available extensions with their current status (default tenant).

func (*Service) ListExtensionsForTenant

func (s *Service) ListExtensionsForTenant(ctx context.Context, tenantID *string, tenantPool *pgxpool.Pool) (*ListExtensionsResponse, error)

ListExtensionsForTenant returns extensions available in the tenant's database. tenantPool is used to query pg_available_extensions on the tenant's database. When nil, the main database pool is used.

Jump to

Keyboard shortcuts

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