debezium

package module
v0.0.0-...-c93dcb0 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

README

Debezium SMT Go PDK

This library can be used to write Debezium SMT in Go.

Install

Include the library with Go get:

go get github.com/andreaTP/debezium-smt-go-pdk

Reference Documentation

You can find the reference documentation for this library on pkg.go.dev.

Getting Started

A simple Debezium SMT written in Go should include a process function exported like:

package main

import (
	"github.com/andreaTP/debezium-smt-go-pdk"
)

//export process
func process(proxyPtr uint32) uint32 {
	return debezium.SetNull()
}

func main() {}

You can compile the program using TinyGo (version > 0.34.0):

tinygo build --no-debug -target=wasm-unknown -o smt.wasm main.go
Data In/Out

For efficiency reasons the full content of the record is not transferred to the Go function, but it can be lazyily accessed using PDK functionalities:

debezium.GetString(debezium.Get(proxyPtr, "value.op"))

where debezium.Get is used to access the required field with a familiar dot(.) syntax, and debezium.GetString (or debezium.IsNull, debezium.GetInt) materialize the value.

Similarly, returning a value to Debezium is performed using the PDK functionalities:

return debezium.SetString("foobar")

the value returned by the Set function (or SetNull, SetBool, SetInt ...) should be returned as the result of the process function.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(proxyPtr uint32, fieldName string) uint32

access a nested field in the record data structure provided by Debezium

func GetInt

func GetInt(proxyPtr uint32) uint32

materialize the Numeric content referenced

func GetString

func GetString(proxyPtr uint32) string

materialize the String content referenced

func IsNull

func IsNull(valuePtr uint32) bool

check whenever the referenced content is Null

func SetBool

func SetBool(value bool) uint32

set a Boolean content for the Debezium Host

func SetInt

func SetInt(value uint32) uint32

set a Numeric content for the Debezium Host

func SetNull

func SetNull() uint32

set a Null content for the Debezium Host

func SetString

func SetString(value string) uint32

set a String content for the Debezium Host

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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