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

connections

package
v0.1.29 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: Apache-2.0 Imports: 48 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 ContextProvider

type ContextProvider func() dbcontext.Context

type DatabaseProvider

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

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) 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