adapter

package
v0.0.0-...-3598dcf Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

type Adapter interface {
	// Initialize sets up the adapter
	Initialize() error

	// GetCapabilities returns the capabilities of the adapted system
	GetCapabilities() (map[string]interface{}, error)

	// ExecuteTask executes a task on the adapted system
	ExecuteTask(action string, params map[string]interface{}) (map[string]interface{}, error)

	// Close cleans up resources
	Close() error
}

Adapter defines the interface that all system adapters must implement

type AdapterType

type AdapterType string

AdapterType represents the type of system being adapted

const (
	REST  AdapterType = "rest"
	SOAP  AdapterType = "soap"
	DB    AdapterType = "db"
	File  AdapterType = "file"
	Other AdapterType = "other"
)

type BaseAdapter

type BaseAdapter struct {
	Name        string
	Type        AdapterType
	Description string
	Config      map[string]interface{}
}

BaseAdapter provides common functionality for adapters

func NewBaseAdapter

func NewBaseAdapter(name string, adapterType AdapterType, description string, config map[string]interface{}) *BaseAdapter

NewBaseAdapter creates a new base adapter

type DBAdapter

type DBAdapter struct {
	BaseAdapter
	DB          *sql.DB
	DriverName  string
	DataSource  string
	TablePrefix string
}

DBAdapter adapts a database

func NewDBAdapter

func NewDBAdapter(name, driverName, dataSource, tablePrefix string, config map[string]interface{}) *DBAdapter

NewDBAdapter creates a new database adapter

func (*DBAdapter) Close

func (a *DBAdapter) Close() error

Close cleans up resources

func (*DBAdapter) ExecuteTask

func (a *DBAdapter) ExecuteTask(action string, params map[string]interface{}) (map[string]interface{}, error)

ExecuteTask executes a database operation

func (*DBAdapter) GetCapabilities

func (a *DBAdapter) GetCapabilities() (map[string]interface{}, error)

GetCapabilities returns the capabilities of the database

func (*DBAdapter) Initialize

func (a *DBAdapter) Initialize() error

Initialize sets up the database adapter

type FileAdapter

type FileAdapter struct {
	BaseAdapter
	BasePath string
}

FileAdapter adapts a file system

func NewFileAdapter

func NewFileAdapter(name, basePath string, config map[string]interface{}) *FileAdapter

NewFileAdapter creates a new file system adapter

func (*FileAdapter) ExecuteTask

func (a *FileAdapter) ExecuteTask(action string, params map[string]interface{}) (map[string]interface{}, error)

ExecuteTask executes a file system operation

func (*FileAdapter) GetCapabilities

func (a *FileAdapter) GetCapabilities() (map[string]interface{}, error)

GetCapabilities returns the capabilities of the file system

func (*FileAdapter) Initialize

func (a *FileAdapter) Initialize() error

Initialize sets up the file adapter

type RESTAdapter

type RESTAdapter struct {
	BaseAdapter
	BaseURL    string
	HTTPClient *http.Client
	Headers    map[string]string
}

RESTAdapter adapts a REST API

func NewRESTAdapter

func NewRESTAdapter(name, baseURL string, headers map[string]string, config map[string]interface{}) *RESTAdapter

NewRESTAdapter creates a new REST adapter

func (*RESTAdapter) Close

func (a *RESTAdapter) Close() error

Close cleans up resources

func (*RESTAdapter) ExecuteTask

func (a *RESTAdapter) ExecuteTask(action string, params map[string]interface{}) (map[string]interface{}, error)

ExecuteTask executes a REST request

func (*RESTAdapter) GetCapabilities

func (a *RESTAdapter) GetCapabilities() (map[string]interface{}, error)

GetCapabilities returns the capabilities of the REST API

func (*RESTAdapter) Initialize

func (a *RESTAdapter) Initialize() error

Initialize sets up the REST adapter

type SOAPAdapter

type SOAPAdapter struct {
	BaseAdapter
	WSDLURL      string
	SOAPEndpoint string
	HTTPClient   *http.Client
	Namespace    string
}

SOAPAdapter adapts a SOAP service

func NewSOAPAdapter

func NewSOAPAdapter(name, wsdlURL, soapEndpoint, namespace string, config map[string]interface{}) *SOAPAdapter

NewSOAPAdapter creates a new SOAP adapter

func (*SOAPAdapter) Close

func (a *SOAPAdapter) Close() error

Close cleans up resources

func (*SOAPAdapter) ExecuteTask

func (a *SOAPAdapter) ExecuteTask(action string, params map[string]interface{}) (map[string]interface{}, error)

ExecuteTask executes a SOAP request

func (*SOAPAdapter) GetCapabilities

func (a *SOAPAdapter) GetCapabilities() (map[string]interface{}, error)

GetCapabilities returns the capabilities of the SOAP service

func (*SOAPAdapter) Initialize

func (a *SOAPAdapter) Initialize() error

Initialize sets up the SOAP adapter

Jump to

Keyboard shortcuts

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