Documentation ¶
Index ¶
- func BytesIterator(ctx context.Context, r TopicMessageReader) xiter.Seq2[*TypedTopicMessage[[]byte], error]
- func IteratorFunc[T any](ctx context.Context, r TopicMessageReader, f TypedUnmarshalFunc[*T]) xiter.Seq2[*TypedTopicMessage[T], error]
- func JSONIterator[T any](ctx context.Context, r TopicMessageReader) xiter.Seq2[*TypedTopicMessage[T], error]
- func JSONUnmarshal(msg *topicreader.Message, dst interface{}) error
- func ProtoUnmarshal(msg *topicreader.Message, dst proto.Message) error
- func ProtobufIterator[T proto.Message](ctx context.Context, r TopicMessageReader) xiter.Seq2[*TypedTopicMessage[T], error]
- func ReadMessageDataWithCallback(msg *topicreader.Message, f func(data []byte) error) error
- func StringIterator(ctx context.Context, r TopicMessageReader) xiter.Seq2[*TypedTopicMessage[string], error]
- func TopicMessageIterator(ctx context.Context, r TopicMessageReader) xiter.Seq2[*topicreader.Message, error]
- func UnmarshalCDCStream[T YDBCDCItem[K], K any](ctx context.Context, reader TopicMessageReader) xiter.Seq2[*TypedTopicMessage[YDBCDCMessage[T, K]], error]
- func UnmarshalMessageWith(msg *topicreader.Message, unmarshaler UnmarshalFunc, v interface{}) error
- type TopicMessageReader
- type TypedTopicMessage
- type TypedUnmarshalFunc
- type UnmarshalFunc
- type YDBCDCItem
- type YDBCDCMessage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BytesIterator ¶
func BytesIterator( ctx context.Context, r TopicMessageReader, ) xiter.Seq2[*TypedTopicMessage[[]byte], error]
BytesIterator produce iterator over topic messages with Data as []byte, []byte is content of the message
func IteratorFunc ¶
func IteratorFunc[T any]( ctx context.Context, r TopicMessageReader, f TypedUnmarshalFunc[*T], ) xiter.Seq2[*TypedTopicMessage[T], error]
IteratorFunc produce iterator over topic messages with Data is T, created unmarshalled from message by custom function
Experimental: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#experimental
func JSONIterator ¶
func JSONIterator[T any]( ctx context.Context, r TopicMessageReader, ) xiter.Seq2[*TypedTopicMessage[T], error]
JSONIterator produce iterator over topic messages with Data is T, created unmarshalled from message
Experimental: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#experimental
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 ProtobufIterator ¶
func ProtobufIterator[T proto.Message]( ctx context.Context, r TopicMessageReader, ) xiter.Seq2[*TypedTopicMessage[T], error]
ProtobufIterator produce iterator over topic messages with Data is T, created unmarshalled from message
Experimental: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#experimental
func ReadMessageDataWithCallback ¶
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 StringIterator ¶
func StringIterator( ctx context.Context, r TopicMessageReader, ) xiter.Seq2[*TypedTopicMessage[string], error]
StringIterator produce iterator over topic messages with Data is string, created from message content
func TopicMessageIterator ¶
func TopicMessageIterator(ctx context.Context, r TopicMessageReader) xiter.Seq2[*topicreader.Message, error]
TopicMessageIterator iterator wrapper over topic reader
Experimental: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#experimental
func UnmarshalCDCStream ¶
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 ¶
type TopicMessageReader interface {
ReadMessage(ctx context.Context) (*topicreader.Message, error)
}
TopicMessageReader is interface for topicreader.Message
Experimental: https://github.com/ydb-platform/ydb-go-sdk/blob/master/VERSIONING.md#experimental
type TypedTopicMessage ¶
type TypedTopicMessage[T any] struct { *topicreader.Message Data T }
type TypedUnmarshalFunc ¶
type UnmarshalFunc ¶
UnmarshalFunc is func to unmarshal data to interface, for example json.Unmarshal from standard library
type YDBCDCItem ¶
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 ¶
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 ¶
func (c *YDBCDCMessage[T, Key]) IsErase() bool
IsErase returns true if the event about erase record
func (*YDBCDCMessage[T, Key]) UnmarshalJSON ¶
func (c *YDBCDCMessage[T, Key]) UnmarshalJSON(bytes []byte) error