topicsugar

package
v3.80.9 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2024 License: Apache-2.0 Imports: 6 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JSONUnmarshal

func JSONUnmarshal(msg *topicreader.Message, dst interface{}) error

JSONUnmarshal unmarshal json message content to dst must by pointer to struct

func ProtoUnmarshal

func ProtoUnmarshal(msg *topicreader.Message, dst proto.Message) error

ProtoUnmarshal unmarshal message content to protobuf struct

func ReadMessageDataWithCallback added in v3.32.0

func ReadMessageDataWithCallback(msg *topicreader.Message, f func(data []byte) error) error

ReadMessageDataWithCallback receive full content of message as data slice MUST not be used after return from f. if you need content after return from function - copy it with copy(dst, data) to another byte slice

func TopicMessageIterator added in v3.80.8

func TopicMessageIterator(ctx context.Context, r TopicMessageReader) xiter.Seq2[*topicreader.Message, error]

TopicMessagesIterator is typed representation of cdc event

Experimental: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#experimental

func TopicUnmarshalJSONFunc added in v3.80.8

func TopicUnmarshalJSONFunc[T any](
	ctx context.Context,
	r TopicMessageReader,
	f TypedUnmarshalFunc[*T],
) xiter.Seq2[*TypedTopicMessage[T], error]

TopicUnmarshalJSONIterator is typed representation of cdc event

Experimental: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#experimental

func TopicUnmarshalJSONIterator added in v3.80.8

func TopicUnmarshalJSONIterator[T any](
	ctx context.Context,
	r TopicMessageReader,
) xiter.Seq2[*TypedTopicMessage[T], error]

TopicUnmarshalJSONIterator is typed representation of cdc event

Experimental: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#experimental

func UnmarshalCDCStream added in v3.80.8

func UnmarshalCDCStream[T YDBCDCItem[K], K any](
	ctx context.Context,
	reader TopicMessageReader,
) xiter.Seq2[*TypedTopicMessage[YDBCDCMessage[T, K]], error]

func UnmarshalMessageWith

func UnmarshalMessageWith(msg *topicreader.Message, unmarshaler UnmarshalFunc, v interface{}) error

UnmarshalMessageWith call unmarshaller func with message content unmarshaller func must not use received byte slice after return.

Types

type TopicMessageReader added in v3.80.8

type TopicMessageReader interface {
	ReadMessage(ctx context.Context) (*topicreader.Message, error)
}

MessageReader is interface for topicreader.Message

Experimental: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#experimental

type TypedTopicMessage added in v3.80.8

type TypedTopicMessage[T any] struct {
	*topicreader.Message
	Data T
}

type TypedUnmarshalFunc added in v3.80.8

type TypedUnmarshalFunc[T any] func(data []byte, dst T) error

type UnmarshalFunc

type UnmarshalFunc func(data []byte, dst interface{}) error

UnmarshalFunc is func to unmarshal data to interface, for example json.Unmarshal from standard library

type YDBCDCItem added in v3.80.8

type YDBCDCItem[K any] interface {
	comparable
	ParseCDCKey(keyFields []json.RawMessage) (K, error)
	SetPrimaryKey(key K)
}

YDBCDCItem interface for represent record from table (and cdc event) The interface will be removed in the future (or may be set as optional) and replaced by field annotations

Experimental: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#experimental

type YDBCDCMessage added in v3.80.8

type YDBCDCMessage[T YDBCDCItem[Key], Key any] struct {
	Update   T
	NewImage T
	OldImage T
	Key      Key
	Erase    *struct{}
	TS       []uint64
}

YDBCDCMessage is typed representation of cdc event

Experimental: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#experimental

func (*YDBCDCMessage[T, Key]) IsErase added in v3.80.8

func (c *YDBCDCMessage[T, Key]) IsErase() bool

IsErase returns true if the event about erase record

func (*YDBCDCMessage[T, Key]) UnmarshalJSON added in v3.80.8

func (c *YDBCDCMessage[T, Key]) UnmarshalJSON(bytes []byte) error

Jump to

Keyboard shortcuts

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