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

connector

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2026 License: Apache-2.0 Imports: 16 Imported by: 10

Documentation

Index

Constants

View Source
const (
	// DATABASE the database connector (mysql, pgsql, oracle, sqlite ... )
	DATABASE = iota + 1

	// REDIS the redis connector
	REDIS

	// MONGO the mongodb connector
	MONGO

	// ELASTICSEARCH the elasticsearch connector
	ELASTICSEARCH

	// KAFKA the kafka connector
	KAFKA

	// OPENAI the openai connector
	OPENAI

	// WEAVIATE the weaviate connector
	WEAVIATE

	// MOAPI the moapi connector
	MOAPI

	// FASTEMBED the fastembed connector
	FASTEMBED

	// SCRIPT ? the script connector ( difference with widget ?)
	SCRIPT

	// ANTHROPIC the anthropic connector (Claude API format)
	ANTHROPIC

	// TYPESAFE the TypeSafe AI (Jev decision) connector
	TYPESAFE
)

Variables

View Source
var AIConnectors = []Option{}

AIConnectors the AI connectors

View Source
var Connectors = map[string]Connector{}

Connectors the loaded connectors

Functions

func BuildAPIURL added in v1.0.0

func BuildAPIURL(host, endpoint string) string

BuildAPIURL builds the complete API URL from host and endpoint.

If host ends with "/" it is used as-is (the user has specified a full base path such as "https://my-proxy.example.com/v1/"). Otherwise a "/v1" prefix is prepended to the endpoint automatically, which is the standard convention for OpenAI-compatible APIs (e.g. host="https://api.openai.com", endpoint="/chat/completions"

→ "https://api.openai.com/v1/chat/completions").

This is the single source of truth so that every caller (agent LLM provider, sandbox proxy, graphrag utilities, …) builds URLs the same way.

func FilterRequestBodyParams added in v1.0.0

func FilterRequestBodyParams(settings map[string]interface{}, conn Connector) map[string]interface{}

FilterRequestBodyParams filters Setting() output to only keep parameters that belong in an API request body, applying value constraints when available.

Priority:

  1. conn implements llm.LLMConnector with non-nil GetSupportedParams() → strict whitelist + clamp
  2. conn type matches a known provider → provider-type default set
  3. neither → strip known metadata keys, pass through the rest

func Remove added in v1.0.0

func Remove(id string) error

Remove a connector

func Unregister added in v1.0.0

func Unregister(id string) error

Unregister closes and fully removes a connector from Connectors map and AIConnectors slice. Safe for concurrent use.

Types

type Connector

type Connector interface {
	Register(file string, id string, dsl []byte) error
	Query() (query.Query, error)
	Schema() (schema.Schema, error)
	Close() error
	ID() string
	Is(int) bool
	Setting() map[string]interface{}
	GetMetaInfo() gouTypes.MetaInfo
	GetMetadata() map[string]interface{}
}

Connector the connector interface

func Load

func Load(file string, id string) (Connector, error)

Load a connector from file

func LoadSource added in v1.0.0

func LoadSource(source []byte, id string, file string) (Connector, error)

LoadSource load a connector from source

func LoadSourceSync added in v1.0.0

func LoadSourceSync(source []byte, id string, file string) (Connector, error)

LoadSourceSync load connector sync

func LoadSync added in v1.0.0

func LoadSync(file string, id string) (Connector, error)

LoadSync load connector sync

func New added in v1.0.0

func New(typ string, id string, dsl []byte) (Connector, error)

New create a new connector

func Select

func Select(id string) (Connector, error)

Select a connector

type DSL

type DSL struct {
	gouTypes.MetaInfo
	gouTypes.ConnectorMetadata
	ID   string `json:"-"`
	Type string `json:"type"`
	Name string `json:"name,omitempty"`
	// Label   string                 `json:"label,omitempty"`
	Version string                 `json:"version,omitempty"`
	Options map[string]interface{} `json:"options,omitempty"`
}

DSL the connector DSL

type Option added in v1.0.0

type Option struct {
	Label string `json:"label,omitempty"`
	Value string `json:"value,omitempty"`
}

Option the option interface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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