Documentation
¶
Index ¶
- Constants
- func CreateTlsConfig(minVersion uint16, rootCAs *string, host string, tlsHost string, ...) (*tls.Config, error)
- func CreateTlsConfigFromRootCAString(minVersion uint16, rootCAs string, host string, tlsHost string, ...) (*tls.Config, error)
- func HeartbeatRoutine(ctx context.Context, message func() string) func()
- func Interval(ctx context.Context, freq time.Duration, fn func()) func()
- func QuoteIdentifier(name string) string
- func QuoteMySQLIdentifier(name string) string
- type QualifiedTable
- type SourceTablesMissingError
- type TablesNotInPublicationError
Constants ¶
View Source
const ( ErrorInfoDomain = "peerdb.io" ErrorInfoReasonMirror = "MIRROR" ErrorInfoReasonSourceTableMissing = "SOURCE_TABLE_MISSING" ErrorInfoReasonTablesNotInPublication = "TABLES_NOT_IN_PUBLICATION" ErrorMetadataOffendingField = "offendingField" ErrorMetadataPublication = "publication" )
gRPC ErrorInfo constants
View Source
const OrgIdTag = "org_id"
View Source
const PipeIdTag = "pipe_id"
View Source
const PipeNameTag = "pipe_name"
View Source
const ServiceIdTag = "service_id"
Variables ¶
This section is empty.
Functions ¶
func CreateTlsConfig ¶
func CreateTlsConfigFromRootCAString ¶
func CreateTlsConfigFromRootCAString(minVersion uint16, rootCAs string, host string, tlsHost string, skipCertVerification bool) (*tls.Config, error)
CreateTlsConfigFromRootCAString adapts CreateTlsConfig for callers that pass rootCAs as a string rather than *string (e.g. mongo ClientConfig). Empty string is treated as no custom CA.
func HeartbeatRoutine ¶
func QuoteIdentifier ¶
QuoteIdentifier quotes an "identifier" (e.g. a table or a column name) to be used as part of an SQL statement. For example:
tblname := "my_table"
data := "my_data"
quoted := common.QuoteIdentifier(tblname)
err := db.Exec(fmt.Sprintf("INSERT INTO %s VALUES ($1)", quoted), data)
Any double quotes in name will be escaped. The quoted identifier will be case-sensitive when used in a query. If the input string contains a zero byte, the result will be truncated immediately before it.
func QuoteMySQLIdentifier ¶
Types ¶
type QualifiedTable ¶
type QualifiedTable struct {
Namespace string // schema in PG, database in MySQL/Mongo
Table string // table or collection
}
func ParseTableIdentifier ¶
func ParseTableIdentifier(tableIdentifier string) (*QualifiedTable, error)
ParseTableIdentifier parses a table name into namespace and table name.
func (QualifiedTable) MySQL ¶
func (t QualifiedTable) MySQL() string
func (QualifiedTable) String ¶
func (t QualifiedTable) String() string
type SourceTablesMissingError ¶
type SourceTablesMissingError struct {
Tables []QualifiedTable
}
func NewSourceTablesMissingError ¶
func NewSourceTablesMissingError(tables []QualifiedTable) *SourceTablesMissingError
func (*SourceTablesMissingError) Error ¶
func (e *SourceTablesMissingError) Error() string
type TablesNotInPublicationError ¶
type TablesNotInPublicationError struct {
Tables []QualifiedTable
Publication string
}
func NewTablesNotInPublicationError ¶
func NewTablesNotInPublicationError(publication string, tables []QualifiedTable) *TablesNotInPublicationError
func (*TablesNotInPublicationError) Error ¶
func (e *TablesNotInPublicationError) Error() string
Click to show internal directories.
Click to hide internal directories.