cloudquery

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: May 25, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package cloudquery is the orchestration layer for SafeDep Cloud's SQL query service. It owns the gRPC client wiring, the proto-to-Go boundary translation, and the value types that command code consumes.

Command packages depend on the small interfaces declared here, not on the gRPC types or proto messages. Tests substitute fakes for the interfaces; production wiring uses Service.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExecInput

type ExecInput struct {
	SQL       string
	PageSize  int
	PageToken string
}

ExecInput is the user-facing payload for a SQL execution. Validation is the caller's responsibility: orchestration trusts what it receives. PageToken empty means "first page"; non-empty resumes a prior response.

type ExecResult

type ExecResult struct {
	Columns     []string
	Rows        []Row
	NextPage    string
	GeneratedAt time.Time
}

ExecResult is the materialised query response in a presentation-friendly shape. Columns is the ordered union of field names across all rows.

type ExecRunner

type ExecRunner interface {
	Exec(ctx context.Context, in ExecInput) (*ExecResult, error)
}

ExecRunner is the contract a query executor satisfies.

type Row

type Row map[string]any

Row is one decoded row. Values are typed natives (string, float64, bool, nil). Unknown structpb kinds are rendered as their string form so callers do not have to handle proto types directly.

type Schema

type Schema struct {
	Tables []SchemaTable
}

Schema is the full SQL schema served by the control plane.

type SchemaColumn

type SchemaColumn struct {
	Name         string
	Description  string
	Selectable   bool
	Filterable   bool
	Required     bool
	ReferenceURL string
}

SchemaColumn describes one column inside a table.

type SchemaFetcher

type SchemaFetcher interface {
	Schema(ctx context.Context) (*Schema, error)
}

SchemaFetcher is the contract a schema reader satisfies.

type SchemaTable

type SchemaTable struct {
	Name    string
	Columns []SchemaColumn
}

SchemaTable describes one queryable table.

type Service

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

Service is the production implementation backed by a control-plane gRPC connection. Command code accepts the small interfaces in this file (ExecRunner, SchemaFetcher) so unit tests can pass stubs.

func NewService

func NewService(conn *grpc.ClientConn) *Service

NewService wraps a control-plane gRPC connection in a Service.

func (*Service) Exec

func (s *Service) Exec(ctx context.Context, in ExecInput) (*ExecResult, error)

Exec runs a single SQL statement against the control plane and returns the decoded rows. PageSize <= 0 leaves it unset so the server applies its default. PageToken empty means "first page".

func (*Service) Schema

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

Schema fetches the SQL schema metadata served by the control plane.

Jump to

Keyboard shortcuts

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