File tree Expand file tree Collapse file tree 3 files changed +43
-8
lines changed Expand file tree Collapse file tree 3 files changed +43
-8
lines changed Original file line number Diff line number Diff line change 1+ * Added virtualtimestamps field to cdc description
2+
13## v3.99.10
24* Returned legacy behaviour for interpret as ` time.Time ` YDB types ` Date ` , ` Datetime ` and ` Timestamp `
35
Original file line number Diff line number Diff line change @@ -562,18 +562,20 @@ func (unit *TimeToLiveUnit) ToYDB() Ydb_Table.ValueSinceUnixEpochModeSettings_Un
562562}
563563
564564type ChangefeedDescription struct {
565- Name string
566- Mode ChangefeedMode
567- Format ChangefeedFormat
568- State ChangefeedState
565+ Name string
566+ Mode ChangefeedMode
567+ Format ChangefeedFormat
568+ State ChangefeedState
569+ VirtualTimestamp bool
569570}
570571
571572func NewChangefeedDescription (proto * Ydb_Table.ChangefeedDescription ) ChangefeedDescription {
572573 return ChangefeedDescription {
573- Name : proto .GetName (),
574- Mode : ChangefeedMode (proto .GetMode ()),
575- Format : ChangefeedFormat (proto .GetFormat ()),
576- State : ChangefeedState (proto .GetState ()),
574+ Name : proto .GetName (),
575+ Mode : ChangefeedMode (proto .GetMode ()),
576+ Format : ChangefeedFormat (proto .GetFormat ()),
577+ State : ChangefeedState (proto .GetState ()),
578+ VirtualTimestamp : proto .GetVirtualTimestamps (),
577579 }
578580}
579581
Original file line number Diff line number Diff line change @@ -167,3 +167,34 @@ func TestCreateTableDescription(sourceTest *testing.T) {
167167 })
168168 }
169169}
170+
171+ func TestTableDescriptionWithCDC (t * testing.T ) {
172+ scope := newScope (t )
173+ escapedTablePath := "`" + scope .TablePath () + "`"
174+ err := scope .Driver ().Query ().Exec (scope .Ctx , "ALTER TABLE " + escapedTablePath + `
175+ ADD CHANGEFEED test WITH (
176+ MODE='NEW_AND_OLD_IMAGES',
177+ FORMAT='JSON',
178+ VIRTUAL_TIMESTAMPS = TRUE
179+ )` )
180+ scope .Require .NoError (err )
181+
182+ var description options.Description
183+ err = scope .Driver ().Table ().Do (scope .Ctx , func (ctx context.Context , s table.Session ) error {
184+ desc , err := s .DescribeTable (ctx , scope .TablePath ())
185+ if err == nil {
186+ description = desc
187+ }
188+ return err
189+ })
190+
191+ scope .Require .NoError (err )
192+ expectedCDC := options.ChangefeedDescription {
193+ Name : "test" ,
194+ Mode : options .ChangefeedModeNewAndOldImages ,
195+ Format : options .ChangefeedFormatJSON ,
196+ State : options .ChangefeedStateEnabled ,
197+ VirtualTimestamp : true ,
198+ }
199+ scope .Require .Equal ([]options.ChangefeedDescription {expectedCDC }, description .Changefeeds )
200+ }
You can’t perform that action at this time.
0 commit comments