Skip to content

Commit c78b3a5

Browse files
committed
rename
1 parent 881ae0c commit c78b3a5

File tree

6 files changed

+15
-15
lines changed

6 files changed

+15
-15
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
* Added binding `ydb.WithWideTypes()` which interprets `time.Time` and `time.Duration` as `Timestamp64` and `Interval64` YDB types
1+
* Added binding `ydb.WithWideTimeTypes()` which interprets `time.Time` and `time.Duration` as `Timestamp64` and `Interval64` YDB types
22

33
## v3.103.0
44
* Supported wide `Interval64` type

internal/bind/wide_types.go renamed to internal/bind/wide_time_types.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import (
66
"github.com/ydb-platform/ydb-go-sdk/v3/internal/value"
77
)
88

9-
type WideTypes struct{}
9+
type WideTimeTypes struct{}
1010

11-
func (m WideTypes) ToYdb(sql string, args ...any) (yql string, newArgs []any, _ error) {
11+
func (m WideTimeTypes) ToYdb(sql string, args ...any) (yql string, newArgs []any, _ error) {
1212
newArgs = make([]any, 0, len(args))
1313
for _, arg := range args {
1414
switch t := arg.(type) {
@@ -24,6 +24,6 @@ func (m WideTypes) ToYdb(sql string, args ...any) (yql string, newArgs []any, _
2424
return sql, newArgs, nil
2525
}
2626

27-
func (m WideTypes) blockID() blockID {
27+
func (m WideTimeTypes) blockID() blockID {
2828
return blockCastArgs
2929
}

internal/bind/wide_types_test.go renamed to internal/bind/wide_time_types_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"github.com/ydb-platform/ydb-go-sdk/v3/internal/value"
1010
)
1111

12-
func TestWideTypesBindRewriteQuery(t *testing.T) {
12+
func TestWideTimeTypesBind(t *testing.T) {
1313
for _, tt := range []struct {
1414
bind Bind
1515
sql string
@@ -58,7 +58,7 @@ func TestWideTypesBindRewriteQuery(t *testing.T) {
5858
},
5959
},
6060
{
61-
bind: WideTypes{},
61+
bind: WideTimeTypes{},
6262
sql: `SELECT ?, ?`,
6363
args: []any{
6464
100,
@@ -71,7 +71,7 @@ func TestWideTypesBindRewriteQuery(t *testing.T) {
7171
},
7272
},
7373
{
74-
bind: WideTypes{},
74+
bind: WideTimeTypes{},
7575
sql: `SELECT ?, ?`,
7676
args: []any{
7777
time.Unix(123, 456),
@@ -84,7 +84,7 @@ func TestWideTypesBindRewriteQuery(t *testing.T) {
8484
},
8585
},
8686
{
87-
bind: WideTypes{},
87+
bind: WideTimeTypes{},
8888
sql: `SELECT ?, ?`,
8989
args: []any{
9090
time.Duration(123) * time.Millisecond,

internal/value/value.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ func (v date32Value) toYDB(a *allocator.Allocator) *Ydb.Value {
486486
return vvv
487487
}
488488

489-
// Date32Value returns ydb date value by given days since Epoch
489+
// Date32Value returns ydb date value from days around epoch time
490490
func Date32Value(v int32) date32Value {
491491
return date32Value(v)
492492
}
@@ -596,7 +596,7 @@ func (v datetime64Value) toYDB(a *allocator.Allocator) *Ydb.Value {
596596
return vvv
597597
}
598598

599-
// Datetime64Value makes ydb datetime value from seconds since Epoch
599+
// Datetime64Value makes ydb datetime value from seconds around epoch time
600600
func Datetime64Value(v int64) datetime64Value {
601601
return datetime64Value(v)
602602
}
@@ -1385,7 +1385,7 @@ func (v interval64Value) toYDB(a *allocator.Allocator) *Ydb.Value {
13851385
return vvv
13861386
}
13871387

1388-
// Interval64Value makes Value from given microseconds value
1388+
// Interval64Value makes Value from given nanoseconds around epoch time
13891389
func Interval64Value(v int64) interval64Value {
13901390
return interval64Value(v)
13911391
}
@@ -2011,7 +2011,7 @@ func (v timestamp64Value) toYDB(a *allocator.Allocator) *Ydb.Value {
20112011
return vvv
20122012
}
20132013

2014-
// Timestamp64Value makes ydb timestamp value by given microseconds since Epoch
2014+
// Timestamp64Value makes ydb timestamp value by given signed microseconds around Epoch
20152015
func Timestamp64Value(v int64) timestamp64Value {
20162016
return timestamp64Value(v)
20172017
}

query_bind_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ SELECT $p0;`,
583583
b: testutil.QueryBind(
584584
ydb.WithAutoDeclare(),
585585
ydb.WithPositionalArgs(),
586-
ydb.WithWideTypes(),
586+
ydb.WithWideTimeTypes(),
587587
),
588588
sql: `SELECT ?;`,
589589
args: []interface{}{time.Unix(123, 456)},

sql.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@ func WithPositionalArgs() QueryBindConnectorOption {
189189
return xsql.WithQueryBind(bind.PositionalArgs{})
190190
}
191191

192-
func WithWideTypes() QueryBindConnectorOption {
193-
return xsql.WithQueryBind(bind.WideTypes{})
192+
func WithWideTimeTypes() QueryBindConnectorOption {
193+
return xsql.WithQueryBind(bind.WideTimeTypes{})
194194
}
195195

196196
func WithNumericArgs() QueryBindConnectorOption {

0 commit comments

Comments
 (0)