rabbitmq

package
v0.3.19 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultUnlimitedWaitTime   = -1 // seconds
	DefaultUnlimitedRetryCount = -1
)
View Source
const (
	SQLTypeInsert = "INSERT"
	SQLTypeUpdate = "UPDATE"
	SQLTypeDelete = "DELETE"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Addr     string
	User     string
	Pass     string
	Vhost    string
	Tag      string
	Exchange string
	Queue    string
	Key      string
}

func NewConfig

func NewConfig(addr, user, pass, vhost, tag, exchange, queue, key string) *Config

NewConfig returns a new *Config

func NewConfigWithDefault

func NewConfigWithDefault(addr, user, pass, vhost string) *Config

NewConfigWithDefault returns a new *Config with default values

func (*Config) Clone added in v0.3.19

func (c *Config) Clone() *Config

Clone returns a new *Config

func (*Config) GetURL

func (c *Config) GetURL() string

GetURL returns the URL

type Message

type Message struct {
	SQLType   string                   `json:"type"`
	IsDDL     bool                     `json:"isDdl"`
	DBName    string                   `json:"database"`
	TableName string                   `json:"table"`
	PKNames   []string                 `json:"pkNames"`
	Columns   map[string]string        `json:"mysqlType"`
	Data      []map[string]interface{} `json:"data"`
	Old       []map[string]interface{} `json:"old"`
}

func NewEmptyMessage

func NewEmptyMessage() *Message

NewEmptyMessage returns a new empty *Message

func NewMessage

func NewMessage(sqlType string, isDDL bool, dbName string, tableName string, pkNames []string,
	columns map[string]string, data, old []map[string]interface{}) *Message

NewMessage returns a new *Message

func (*Message) ConvertToSQL

func (m *Message) ConvertToSQL(ignoreDDL bool, useReplace bool) ([]map[string][]interface{}, error)

ConvertToSQL returns a map of the sql statement and the values if ignoreDDL is true, and sql type is ddl, it will only return nil, nil, if ignoreDDL is false, and sql type is ddl, it will return nil, error if useReplace is true, message with insert or update type will be converted to statements like "replace into ... values ..." if useReplace is false, message with insert type will be converted to statements like "insert into ... values ... on duplicate key update ..." if useReplace is false, message with update type will be converted to statements like "update ... set ... where ..."

func (*Message) GetColumnNames

func (m *Message) GetColumnNames() []string

GetColumnNames gets the column names

func (*Message) GetColumns

func (m *Message) GetColumns() map[string]string

GetColumns returns the Columns

func (*Message) GetDBName

func (m *Message) GetDBName() string

GetDBName returns the DBName

func (*Message) GetData

func (m *Message) GetData() []map[string]interface{}

GetData returns the Data

func (*Message) GetIsDDL

func (m *Message) GetIsDDL() bool

GetIsDDL returns the IsDDL

func (*Message) GetOld

func (m *Message) GetOld() []map[string]interface{}

GetOld returns the Old

func (*Message) GetPKNames

func (m *Message) GetPKNames() []string

GetPKNames returns the PKNames

func (*Message) GetSQLType

func (m *Message) GetSQLType() string

GetSQLType returns the SQLType

func (*Message) GetTableName

func (m *Message) GetTableName() string

GetTableName returns the TableName

func (*Message) Split added in v0.3.17

func (m *Message) Split() []*Message

Split splits the message if the message contains multiple data

type PoolConfig added in v0.3.19

type PoolConfig struct {
	*Config
	MaxConnections     int
	InitConnections    int
	MaxIdleConnections int
	MaxIdleTime        int
	MaxWaitTime        int
	MaxRetryCount      int
	KeepAliveInterval  int
}

func NewPoolConfig added in v0.3.19

func NewPoolConfig(addr, user, host, vhost, tag, exchange, queue, key string,
	maxConnections, initConnections, maxIdleConnections, maxIdleTime, maxWaitTime, maxRetryCount, keepAliveInterval int) *PoolConfig

NewPoolConfig returns a new PoolConfig

func NewPoolConfigWithConfig added in v0.3.19

func NewPoolConfigWithConfig(config *Config, maxConnections, initConnections, maxIdleConnections,
	maxIdleTime, maxWaitTime, maxRetryCount, keepAliveInterval int) *PoolConfig

NewPoolConfigWithConfig returns a new PoolConfig

func (*PoolConfig) Clone added in v0.3.19

func (pc *PoolConfig) Clone() *PoolConfig

Clone returns a new PoolConfig with same values

func (*PoolConfig) Validate added in v0.3.19

func (pc *PoolConfig) Validate() error

Validate validates pool config

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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