plugins

package
v0.9.10 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Body

type Body struct {
	Host     string  `json:"host,omitempty" mapstructure:"host,omitempty"`
	Port     FlexInt `json:"port,omitempty" mapstructure:"port,omitempty"`
	User     string  `json:"user,omitempty" mapstructure:"user,omitempty"`
	Password string  `json:"password,omitempty" mapstructure:"password,omitempty"`
	Database string  `json:"database,omitempty" mapstructure:"database,omitempty"`
	SQL      string  `json:"sql,omitempty" mapstructure:"sql,omitempty"`
	// 以下字段 Oracle DB 专用
	ServiceName string `json:"service_name,omitempty" mapstructure:"service_name,omitempty"`
	SID         string `json:"sid,omitempty" mapstructure:"sid,omitempty"`
	// 以下字段用于本地网关配置
	Address    string `json:"address,omitempty" mapstructure:"address,omitempty"`
	ConfigKey  string `json:"config_key,omitempty" mapstructure:"config_key,omitempty"`
	ConnString string `json:"connection_str,omitempty" mapstructure:"connection_str,omitempty"`
}

Body 结构体定义数据库连接参数

type CallbackResponse

type CallbackResponse v1.CallbackResponse

回调消息的响应 github.com/open-dingtalk/dingtalk-stream-sdk-go@v0.9.0/plugin/plugin_handler.go

type FlexInt

type FlexInt int

func (*FlexInt) UnmarshalJSON

func (fi *FlexInt) UnmarshalJSON(data []byte) error

type HTTPPlugin

type HTTPPlugin struct {
	Name string
	// contains filtered or unexported fields
}

func NewHTTPPlugin

func NewHTTPPlugin() *HTTPPlugin

func (*HTTPPlugin) Close

func (p *HTTPPlugin) Close() error

func (*HTTPPlugin) HandleMessage

func (p *HTTPPlugin) HandleMessage(ctx context.Context, df *v1.DFWrap) (*payload.DataFrameResponse, error)

func (*HTTPPlugin) Init

func (p *HTTPPlugin) Init() error

type MSSQLPlugin

type MSSQLPlugin struct {
	Name                 string
	AllowRemote          bool
	LessCommonParameters string // 不常用参数 (如: encrypt=disable;trustServerCertificate=true)
	Configs              []Body
}

MYSQLPlugin 结构体定义 MySQL 插件

func NewMSSQLPlugin

func NewMSSQLPlugin() *MSSQLPlugin

func (*MSSQLPlugin) Close

func (p *MSSQLPlugin) Close() error

func (*MSSQLPlugin) DoSQLExecute

func (p *MSSQLPlugin) DoSQLExecute(body *Body) (qr *QueryResult)

doSQLExecute 执行SQL查询

func (*MSSQLPlugin) GetConnection

func (p *MSSQLPlugin) GetConnection(body *Body) (*sql.DB, error)

getConnection 创建数据库连接

func (*MSSQLPlugin) HandleMessage

func (p *MSSQLPlugin) HandleMessage(ctx context.Context, df *v1.DFWrap) (*payload.DataFrameResponse, error)

func (*MSSQLPlugin) Init

func (p *MSSQLPlugin) Init() error

type MySQLPlugin

type MySQLPlugin struct {
	Name         string
	AllowRemote  bool
	ValueAsBytes bool
	Configs      []Body
}

MYSQLPlugin 结构体定义 MySQL 插件

func NewMySQLPlugin

func NewMySQLPlugin() *MySQLPlugin

func (*MySQLPlugin) Close

func (p *MySQLPlugin) Close() error

func (*MySQLPlugin) DoSQLExecute

func (p *MySQLPlugin) DoSQLExecute(body *Body) (qr *QueryResult)

doMySQLExecute 执行MySQL查询

func (*MySQLPlugin) GetConnection

func (p *MySQLPlugin) GetConnection(body *Body) (*sql.DB, error)

getConnection 创建数据库连接

func (*MySQLPlugin) HandleMessage

func (p *MySQLPlugin) HandleMessage(ctx context.Context, df *v1.DFWrap) (*payload.DataFrameResponse, error)

func (*MySQLPlugin) Init

func (p *MySQLPlugin) Init() error

type OracleDBPlugin

type OracleDBPlugin struct {
	Name        string
	AllowRemote bool
	Configs     []Body
}

func NewOracleDBPlugin

func NewOracleDBPlugin() *OracleDBPlugin

func (*OracleDBPlugin) Close

func (p *OracleDBPlugin) Close() error

func (*OracleDBPlugin) DoSQLExecute

func (p *OracleDBPlugin) DoSQLExecute(body *Body) (qr *QueryResult)

doSQLExecute 执行SQL查询

func (*OracleDBPlugin) GetConnection

func (p *OracleDBPlugin) GetConnection(body *Body) (*sql.DB, error)

func (*OracleDBPlugin) HandleMessage

func (p *OracleDBPlugin) HandleMessage(ctx context.Context, df *v1.DFWrap) (*payload.DataFrameResponse, error)

func (*OracleDBPlugin) Init

func (p *OracleDBPlugin) Init() error

type PGSQLPlugin

type PGSQLPlugin struct {
	Name        string
	AllowRemote bool
	Configs     []Body
}

func NewPGSQLPlugin

func NewPGSQLPlugin() *PGSQLPlugin

func (*PGSQLPlugin) Close

func (p *PGSQLPlugin) Close() error

func (*PGSQLPlugin) DoSQLExecute

func (p *PGSQLPlugin) DoSQLExecute(body *Body) (qr *QueryResult)

doSQLExecute 执行SQL查询

func (*PGSQLPlugin) GetConnection

func (p *PGSQLPlugin) GetConnection(body *Body) (*sql.DB, error)

func (*PGSQLPlugin) HandleMessage

func (p *PGSQLPlugin) HandleMessage(ctx context.Context, df *v1.DFWrap) (*payload.DataFrameResponse, error)

func (*PGSQLPlugin) Init

func (p *PGSQLPlugin) Init() error

type Plugin

type Plugin interface {
	Init() error
	// HandleMessage(ctx context.Context, df *payload.DataFrame) (*payload.DataFrameResponse, error)
	HandleMessage(ctx context.Context, df *v1.DFWrap) (*payload.DataFrameResponse, error)
	Close() error
}

type PluginManager

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

func NewPluginManager

func NewPluginManager() *PluginManager

func (*PluginManager) CloseAll

func (pm *PluginManager) CloseAll()

func (*PluginManager) HandleMessage

func (pm *PluginManager) HandleMessage(ctx context.Context, df *payload.DataFrame) (*payload.DataFrameResponse, error)

func (*PluginManager) LoadPlugins

func (pm *PluginManager) LoadPlugins() error

func (*PluginManager) RegisterPlugin

func (pm *PluginManager) RegisterPlugin(name string, plugin Plugin)

func (*PluginManager) ReloadConfig

func (pm *PluginManager) ReloadConfig() error

type ProxyMySQLPlugin

type ProxyMySQLPlugin struct {
	// 可以有插件自己的配置
	Name string
}

func NewProxyMySQLPlugin

func NewProxyMySQLPlugin() *ProxyMySQLPlugin

func (*ProxyMySQLPlugin) Close

func (p *ProxyMySQLPlugin) Close() error

func (*ProxyMySQLPlugin) HandleMessage

func (p *ProxyMySQLPlugin) HandleMessage(ctx context.Context, df *v1.DFWrap) (*payload.DataFrameResponse, error)

func (*ProxyMySQLPlugin) Init

func (p *ProxyMySQLPlugin) Init() error

type QueryResult

type QueryResult struct {
	Result  []map[string]interface{} `json:"result" mapstructure:"result,omitempty"`
	Columns []string                 `json:"columns" mapstructure:"columns,omitempty"`
	Message string                   `json:"message" mapstructure:"message,omitempty"`
}

QueryResult 结构体定义查询结果

type SQLExecutor

type SQLExecutor interface {
	GetConnection(body *Body) (*sql.DB, error)
	DoSQLExecute(body *Body) *QueryResult
}

type VersionPlugin

type VersionPlugin struct {
	Name            string `json:"name"`
	ProtocolVersion string `json:"protocol_version"`
}

func NewVersionPlugin

func NewVersionPlugin() *VersionPlugin

func (*VersionPlugin) Close

func (p *VersionPlugin) Close() error

func (*VersionPlugin) HandleMessage

func (p *VersionPlugin) HandleMessage(ctx context.Context, df *v1.DFWrap) (*payload.DataFrameResponse, error)

func (*VersionPlugin) Init

func (p *VersionPlugin) Init() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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