metadata

package
v0.37.0 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

README

Metadata Interface Module

Shared direct-connection helpers for metadata-aware interface adapters.

Files

File Responsibility
connection.go Validates direct connection inputs, resolves passwords, and expands ~ paths for transport adapters
connection_test.go Verifies shared validation and password-resolution behavior

Exports

  • ConnectionInput
  • ErrorKind
  • ConnectionInputError
  • ResolveConnectionOptions
  • IsConnectionInputError(err)
  • ValidateConnectionInput(input)
  • ResolvePassword(input, options)
  • ExpandHome(path)

Notes

  • This package owns direct-connection validation and secret resolution shared by transport adapters.
  • It does not load transport-specific connection references or assemble adapter-specific connection state.
  • MCP and future metadata-aware adapters should depend on this package instead of duplicating host, socket, and password handling.

Dependencies

  • Upstream: transport adapters under internal/interfaces
  • Downstream: MCP direct-connection resolution and future metadata-aware adapters

Update Rule

  • If exports, behavior, or dependencies change, update this file in the same change.

Documentation

Overview

Package metadata exposes shared direct-connection helpers for metadata-aware interface adapters. input: transport-layer connection inputs and secret lookup sources output: normalized validation and password resolution helpers for interface adapters pos: shared connection helper boundary used by MCP and future metadata-aware transports note: if this file changes, update this header and module README.md.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExpandHome

func ExpandHome(path string) (string, error)

ExpandHome expands a leading ~ in path values.

func IsConnectionInputError

func IsConnectionInputError(err error) bool

IsConnectionInputError reports whether err is a shared direct-connection input failure.

func ResolvePassword

func ResolvePassword(input ConnectionInput, options ResolveConnectionOptions) (string, error)

ResolvePassword resolves a password from direct, env, or file sources.

func ValidateConnectionInput

func ValidateConnectionInput(input ConnectionInput) error

ValidateConnectionInput validates direct connection input shape and transport constraints.

Types

type ConnectionInput

type ConnectionInput struct {
	Host         string `json:"host,omitempty" yaml:"host"`
	Port         int    `json:"port,omitempty"`
	Socket       string `json:"socket,omitempty" yaml:"socket"`
	User         string `json:"user,omitempty" yaml:"user"`
	Schema       string `json:"schema,omitempty" yaml:"schema"`
	Dialect      string `json:"dialect,omitempty" yaml:"dialect"`
	Password     string `json:"password,omitempty" yaml:"password"`
	PasswordEnv  string `json:"password_env,omitempty" yaml:"password_env"`
	PasswordFile string `json:"password_file,omitempty" yaml:"password_file"`
}

ConnectionInput describes one direct metadata-aware connection input.

type ConnectionInputError

type ConnectionInputError struct {
	Kind    ErrorKind
	Message string
	Err     error
}

ConnectionInputError preserves the user-facing message while exposing adapter-safe classification.

func (*ConnectionInputError) Error

func (e *ConnectionInputError) Error() string

func (*ConnectionInputError) Unwrap

func (e *ConnectionInputError) Unwrap() error

type ErrorKind

type ErrorKind string

ErrorKind classifies shared direct-connection input failures.

const (
	ErrorKindValidation     ErrorKind = "validation"
	ErrorKindPasswordSource ErrorKind = "password_source"
	ErrorKindPasswordLookup ErrorKind = "password_lookup"
)

type ResolveConnectionOptions

type ResolveConnectionOptions struct {
	LookupEnv func(string) (string, bool)
	ReadFile  func(string) ([]byte, error)
}

ResolveConnectionOptions configures shared connection helper dependencies.

Jump to

Keyboard shortcuts

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