connections

package
v0.1.30 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2026 License: Apache-2.0 Imports: 50 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddConnectionsOpenAPI added in v0.1.29

func AddConnectionsOpenAPI(spec *rpc.OpenAPISpec)

AddConnectionsOpenAPI documents the inventory read and its opt-in health trigger without publishing either as an explorer surface.

func MaskValue

func MaskValue(value string) string

func Parse

func Parse(body map[string]any) (*models.Connection, error)

Types

type BodyDecoder

type BodyDecoder func(context.Context, map[string]any) (map[string]any, error)

type ConnectionInspection added in v0.1.30

type ConnectionInspection struct {
	Targets []ConnectionInspectionTarget `json:"targets,omitempty"`
	Result  *query.InspectionResult      `json:"result,omitempty"`
}

func (*ConnectionInspection) Pretty added in v0.1.30

func (result *ConnectionInspection) Pretty() api.Text

func (*ConnectionInspection) PrettyFull added in v0.1.30

func (result *ConnectionInspection) PrettyFull() api.Textable

type ConnectionInspectionTarget added in v0.1.30

type ConnectionInspectionTarget struct {
	Name       string          `json:"name"`
	Target     string          `json:"target"`
	Kind       string          `json:"kind"`
	Schema     string          `json:"schema,omitempty"`
	FieldCount int             `json:"fieldCount,omitempty"`
	Inspect    api.LinkCommand `json:"inspect"`
}

func (ConnectionInspectionTarget) Columns added in v0.1.30

func (ConnectionInspectionTarget) Row added in v0.1.30

func (target ConnectionInspectionTarget) Row() map[string]any

type ContextProvider

type ContextProvider func() dbcontext.Context

type DatabaseProvider

type DatabaseProvider func() (*gorm.DB, error)

type InspectFlags added in v0.1.30

type InspectFlags struct {
	Database   string `flag:"database" help:"Database to inspect"`
	Schema     string `flag:"schema" hidden:"true" help:"SQL schema containing the target"`
	Target     string `flag:"target" help:"Table, view, index, alias, data stream, or pattern to inspect"`
	TargetKind string `flag:"target-kind" hidden:"true" help:"OpenSearch target kind"`
	Sample     bool   `flag:"sample" help:"Sample the selected target to resolve cardinality and auto-filters"`
	Refresh    bool   `flag:"refresh" help:"Refresh cached inspection metadata"`
	// contains filtered or unexported fields
}

func (InspectFlags) ClickyActionFlags added in v0.1.30

func (InspectFlags) ClickyActionFlags()

func (InspectFlags) Filters added in v0.1.30

func (options InspectFlags) Filters() []entity.Filter[InspectFlags]

func (*InspectFlags) SetClickyActionContext added in v0.1.30

func (options *InspectFlags) SetClickyActionContext(ctx context.Context, id string)

type ListOptions

type ListOptions struct {
	Type  string `flag:"type" help:"Filter by connection type"`
	Types string `flag:"types" help:"Filter by connection types (comma-separated)"`
}

ListOptions are the list/filter options for the connection entity. Types is the comma-separated form used by the connection lookup to scope a picker to the connection types valid for a profile's provider (e.g. sql → postgres,mysql,...).

type Options

type Options struct {
	Database   DatabaseProvider
	Context    ContextProvider
	DecodeBody BodyDecoder
	Profiles   ProfileProvider
	Virtual    VirtualConnectionProvider
}

type ProfileProvider added in v0.1.29

type ProfileProvider func(context.Context) ([]query.Profile, error)

type Service

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

func New

func New(options Options) (*Service, error)

func (*Service) Create

func (s *Service) Create(ctx context.Context, body map[string]any) (*models.Connection, error)

func (*Service) Delete

func (s *Service) Delete(id string) error

func (*Service) Get

func (s *Service) Get(id string) (*models.Connection, error)

func (*Service) Handler

func (s *Service) Handler(prefix string, next http.Handler) http.Handler

func (*Service) Inspect added in v0.1.30

func (s *Service) Inspect(ctx context.Context, id string, options InspectFlags) (*ConnectionInspection, error)

func (*Service) List

func (s *Service) List(options ListOptions) ([]*models.Connection, error)

func (*Service) RegisterClicky

func (s *Service) RegisterClicky()

registerConnectionEntity registers the DB-backed connection entity with full CRUD on both the CLI and over HTTP. Create/Update use the context-aware handlers so they can read the raw nested JSON body (e.g. connection `properties`) clicky stashes on the context via rpc.RequestFromContext, which the executor would otherwise flatten to string flags. The database provider resolves lazily because entities register before the database exists.

func (*Service) SetVirtual added in v0.1.29

func (s *Service) SetVirtual(provider VirtualConnectionProvider)

func (*Service) Update

func (s *Service) Update(ctx context.Context, id string, body map[string]any) (*models.Connection, error)

type VirtualConnectionProvider added in v0.1.29

type VirtualConnectionProvider interface {
	ListConnections() []*models.Connection
	ResolveConnection(string) (*models.Connection, error)
}

Jump to

Keyboard shortcuts

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