Help us shape the future of Go! Take the 2026 Go Developer Survey

schema

package
v0.1.61 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: Apache-2.0 Imports: 12 Imported by: 2

Documentation

Overview

Package schema generates JSON Schema (Draft 2020-12) documents that drive the clicky-ui forms and tables of the query app:

  • Connection: a polymorphic if/then schema keyed on the connection `type`, so the connection form shows the right fields per backend.
  • Profile: the profile-setup schema for creating/editing a Profile.
  • ProfileInstance: a per-profile schema whose `properties` drive the FilterBar and whose `x-clicky-columns` drive the DataTable.

Schemas are assembled as plain maps (the same approach as the legacy schema emit) so the conditional envelopes stay explicit and dependency-free.

Index

Constants

View Source
const Draft = "https://json-schema.org/draft/2020-12/schema"

Draft is the JSON Schema dialect emitted by this package.

Variables

This section is empty.

Functions

func ConnectionComponents added in v0.1.15

func ConnectionComponents() map[string]Schema

ConnectionComponents returns a standalone form schema for every known connection type. Types without tailored fields still receive the base form.

func JSON

func JSON(s Schema) ([]byte, error)

JSON renders a schema as indented JSON.

func ProfileComponents added in v0.1.15

func ProfileComponents() map[string]Schema

ProfileComponents returns one standalone provider-form component per registered built-in profile provider.

func ProviderTypeIcon added in v0.1.29

func ProviderTypeIcon(providerType string) string

ProviderTypeIcon returns the runtime icon name for a provider type, or "" for an unknown one. It is the single source of the provider→glyph mapping: the profile form reads it as x-enum-icons and the sidebar surface reads it through profiles.providerIcon, so a profile wears the same mark in both places.

func SchemaRefs added in v0.1.15

func SchemaRefs(dir string, components map[string]Schema) map[string]Schema

SchemaRefs keys component schemas by their relative external-ref path.

func TailoredProviderTypes

func TailoredProviderTypes() map[string]struct{}

TailoredProviderTypes returns the set of connection types that get a tailored if/then branch. Exposed for the drift guard test.

Types

type AWSProvider added in v0.1.29

type AWSProvider struct {
	URL         types.EnvVar `` /* 127-byte string literal not displayed */
	InsecureTLS bool         `json:"insecure_tls" clicky:"title=Insecure TLS,order=3"`
	AccessKey   types.EnvVar `json:"username"     clicky:"type=k8s-secret-selector,title=Access Key ID,source=value,order=4"`
	SecretKey   types.EnvVar `json:"password"     clicky:"type=k8s-secret-selector,title=Secret Access Key,format=password,source=secret,order=5"`
	Region      string       `json:"region"       clicky:"property=region,title=Region,order=7"`
	AssumeRole  string       `json:"assumeRole"   clicky:"property=assumeRole,title=Assume Role ARN,order=8"`
}

AWSProvider models an AWS connection: static credentials plus the region and optional role the SDK needs. Leaving the keys empty falls back to the ambient credential chain.

type AzureDevopsProvider added in v0.1.57

type AzureDevopsProvider struct {
	URL      types.EnvVar `json:"url" clicky:"title=Organization URL,required,order=2"`
	Password types.EnvVar `json:"password" clicky:"title=Personal Access Token,format=password,required,order=5"`
}

AzureDevopsProvider uses a personal access token against an organization.

type AzureProvider added in v0.1.29

type AzureProvider struct {
	ClientID     types.EnvVar `json:"username" clicky:"type=k8s-secret-selector,title=Client ID,source=value,required,order=4"`
	ClientSecret types.EnvVar `json:"password" clicky:"type=k8s-secret-selector,title=Client Secret,format=password,source=secret,required,order=5"`
	TenantID     string       `json:"tenant"   clicky:"property=tenant,title=Tenant ID,required,order=7"`
}

AzureProvider models an Azure service-principal connection.

type ClickHouseProvider

type ClickHouseProvider struct {
	URL types.EnvVar `json:"url" clicky:"type=k8s-url-selector,title=URL,source=value,required,order=2,desc=clickhouse://user:pass@host:9000/db"`

	MaxExecutionTime    string `` /* 152-byte string literal not displayed */
	MaxRowsToRead       string `` /* 141-byte string literal not displayed */
	MaxBytesToRead      string `` /* 157-byte string literal not displayed */
	MaxMemoryUsage      string `` /* 141-byte string literal not displayed */
	MaxThreads          string `` /* 139-byte string literal not displayed */
	ReadOverflowMode    string `` /* 147-byte string literal not displayed */
	TimeoutOverflowMode string `` /* 153-byte string literal not displayed */
	// contains filtered or unexported fields
}

ClickHouseProvider models a ClickHouse DSN connection.

type GCPKMSProvider

type GCPKMSProvider struct {
	URL         types.EnvVar `json:"url"         clicky:"type=k8s-url-selector,title=Endpoint,source=value,order=2"`
	Certificate types.EnvVar `json:"certificate" clicky:"type=k8s-secret-selector,title=Service Account JSON,source=secret,required,order=6"`
}

GCPKMSProvider models a Google Cloud KMS connection.

type GCPProvider

type GCPProvider struct {
	URL         types.EnvVar `json:"url"         clicky:"type=k8s-url-selector,title=Endpoint,source=value,order=2"`
	Certificate types.EnvVar `json:"certificate" clicky:"type=k8s-secret-selector,title=Service Account JSON,source=secret,required,order=6"`
	Project     string       `json:"project"     clicky:"property=project,title=Project,order=7,desc=Default project for queries on this connection"`
}

GCPProvider models a Google Cloud connection: optional endpoint + the required service account JSON. Every GCP client is scoped to a project, so the connection carries one rather than making each query repeat it.

type GCSProvider

type GCSProvider struct {
	URL         types.EnvVar `json:"url"         clicky:"type=k8s-url-selector,title=Endpoint,source=value,order=2"`
	Certificate types.EnvVar `json:"certificate" clicky:"type=k8s-secret-selector,title=Service Account JSON,source=secret,required,order=6"`
}

GCSProvider models a Google Cloud Storage connection.

type GitProvider

type GitProvider struct {
	URL types.EnvVar `json:"url" clicky:"type=k8s-url-selector,title=URL,source=value,required,order=2"`

	Certificate types.EnvVar `json:"certificate" clicky:"type=k8s-secret-selector,title=SSH Private Key,source=secret,order=6"`
	// contains filtered or unexported fields
}

GitProvider models a Git repository connection: URL + basic-auth, or an SSH private key.

type GithubProvider added in v0.1.57

type GithubProvider struct {
	URL      types.EnvVar `json:"url" clicky:"title=API URL,order=2,desc=Defaults to https://api.github.com"`
	Password types.EnvVar `json:"password" clicky:"title=Access Token,format=password,required,order=5"`
}

GithubProvider uses a token against the GitHub API. The endpoint is optional for github.com and can be set for an enterprise installation.

type GitlabProvider added in v0.1.57

type GitlabProvider struct {
	URL      types.EnvVar `json:"url" clicky:"title=Instance URL,required,order=2"`
	Password types.EnvVar `json:"password" clicky:"title=Access Token,format=password,required,order=5"`
}

GitlabProvider uses a token against a GitLab instance.

type HTTPProvider

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

HTTPProvider models a generic HTTP endpoint.

type JaegerProvider

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

JaegerProvider extends the HTTP form for a Jaeger query endpoint.

type KubernetesProvider

type KubernetesProvider struct {
	Certificate  types.EnvVar `` /* 183-byte string literal not displayed */
	MaxResources int          `` /* 147-byte string literal not displayed */
}

KubernetesProvider models a Kubernetes cluster connection: an optional kubeconfig (in-cluster config is used when empty).

type LokiProvider

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

LokiProvider extends the HTTP form for a Loki endpoint.

type MySQLProvider

type MySQLProvider struct {
	URL types.EnvVar `json:"url" clicky:"type=k8s-url-selector,title=URL,source=value,required,order=2,desc=user:pass@tcp(host:3306)/db"`
	// contains filtered or unexported fields
}

MySQLProvider models a MySQL DSN connection.

type OpenSearchProvider

type OpenSearchProvider struct {
	PagingMode string `json:"paging_mode" clicky:"property=paging_mode,title=Paging mode,order=5"`
	// contains filtered or unexported fields
}

OpenSearchProvider extends the HTTP form for an OpenSearch endpoint.

type OpenTelemetryProvider added in v0.1.23

type OpenTelemetryProvider struct {
	Connection string `json:"connection" clicky:"property=connection,title=OpenSearch Connection,required,order=2"`
}

OpenTelemetryProvider delegates trace storage to a nested OpenSearch connection while retaining its own first-class connection identity.

type PostgresProvider

type PostgresProvider struct {
	URL types.EnvVar `` /* 136-byte string literal not displayed */
	// contains filtered or unexported fields
}

PostgresProvider models a postgres SQL DSN connection.

type PrometheusProvider

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

PrometheusProvider extends the HTTP form for a Prometheus endpoint.

type RedisProvider added in v0.1.15

type RedisProvider struct {
	URL types.EnvVar `json:"url" clicky:"type=k8s-url-selector,title=URL,source=value,required,order=2,desc=redis://host:6379/0"`
	// contains filtered or unexported fields
}

RedisProvider models a Redis/Valkey endpoint. A URL may carry the database number and credentials; explicit username/password fields override URI auth after hydration when the browser creates its client.

type S3Provider added in v0.1.57

type S3Provider struct {
	AWSProvider
	Bucket       string `json:"bucket" clicky:"property=bucket,title=Bucket,order=7,desc=Optional bucket for scoped access"`
	UsePathStyle string `` /* 133-byte string literal not displayed */
}

S3Provider uses AWS credentials and region, optionally scoped to a bucket.

type SQLServerProvider

type SQLServerProvider struct {
	URL types.EnvVar `` /* 130-byte string literal not displayed */
	// contains filtered or unexported fields
}

SQLServerProvider models a SQL Server DSN connection.

type SQLiteProvider added in v0.1.40

type SQLiteProvider struct {
	URL types.EnvVar `` /* 126-byte string literal not displayed */
}

type Schema

type Schema = map[string]any

Schema is a JSON Schema document or subschema.

func BrowserOptions added in v0.1.15

func BrowserOptions(typ string) Schema

BrowserOptions returns the provider-specific options form used when querying a saved connection. Endpoint and driver overrides are intentionally removed: a connection browser must remain scoped to the selected stored connection.

func Bundle added in v0.1.15

func Bundle(source Schema, refs map[string]Schema) (Schema, error)

Bundle rewrites the external refs in source to local #/$defs refs and embeds the referenced component documents. refs is keyed by the relative ref used in source (for example "connections/postgres.json").

func Connection

func Connection() Schema

Connection returns the bundled schema consumed by clicky-ui.

func ConnectionSource added in v0.1.15

func ConnectionSource() Schema

ConnectionSource returns the externally referenced connection schema graph. Bundle converts it to the self-contained document returned by Connection.

func Profile

func Profile() Schema

Profile returns the bundled profile schema consumed by clicky-ui.

func ProfileInstance

func ProfileInstance(p query.Profile) (Schema, error)

ProfileInstance returns a per-profile schema: the top-level properties describe FilterBar inputs and x-clicky-columns describes the DataTable.

func ProfileSource added in v0.1.15

func ProfileSource() Schema

ProfileSource returns the externally referenced profile form schema. Each provider branch points at its standalone component under profiles/.

Jump to

Keyboard shortcuts

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