File tree Expand file tree Collapse file tree 3 files changed +33
-8
lines changed Expand file tree Collapse file tree 3 files changed +33
-8
lines changed Original file line number Diff line number Diff line change 1+ * Refactor Struct value creation
2+
13## v3.25.2
24* Fixed repeater initial force timeout from 500 to 0.5 second
35
1416* Enabled by default keep-in-cache policy for data queries
1517* Removed from ` ydb.Connection ` embedding of ` grpc.ClientConnInterface `
1618* Fixed stopping of repeater
17- * Added log backoff between force repeater wake up's (from 500ms to 32s)
19+ * Added log backoff between force repeater wake up's (from 500ms to 32s)
1820* Renamed ` trace.DriverRepeaterTick{Start,Done}Info ` to ` trace.DriverRepeaterWakeUp{Start,Done}Info `
1921* Fixed unexpected ` NullFlag ` while parse nil ` JSONDocument ` value
2022* Removed ` internal/conn/conn.streamUsages ` and ` internal/conn/conn.usages ` (` internal/conn.conn ` always touching last usage timestamp on API calls)
3537* Fixed re-opening case after close lazy-initialized clients
3638* Removed dependency of call context for initializing lazy table client
3739* Added ` config.AutoRetry() ` flag with ` true ` value by default. ` config.AutoRetry() ` affects how to errors handle in sub-clients calls.
38- * Added ` config.WithNoAutoRetry ` for disabling auto-retry on errors in sub-clients calls
40+ * Added ` config.WithNoAutoRetry ` for disabling auto-retry on errors in sub-clients calls
3941* Refactored ` internal/lazy ` package (supported check ` config.AutoRetry() ` , removed all error wrappings with stacktrace)
4042
4143## v3.23.0
4244* Added ` WithTLSConfig ` option for redefine TLS config
4345* Added ` sugar.LoadCertificatesFromFile ` and ` sugar.LoadCertificatesFromPem ` helpers
4446
4547## v3.22.0
46- * Supported ` json.Unmarshaler ` type for scanning row to values
48+ * Supported ` json.Unmarshaler ` type for scanning row to values
4749* Reimplemented ` sugar.DSN ` with ` net/url `
4850
4951## v3.21.0
Original file line number Diff line number Diff line change @@ -502,6 +502,19 @@ type StructValueProto struct {
502502 Values []* Ydb.Value
503503}
504504
505+ func (s * StructValueProto ) Grow (size int ) {
506+ if cap (s .Fields ) < size {
507+ newFields := make ([]StructField , 0 , size )
508+ newFields = append (newFields , s .Fields ... )
509+ s .Fields = newFields
510+ }
511+ if cap (s .Values ) < size {
512+ newValues := make ([]* Ydb.Value , 0 , size )
513+ newValues = append (newValues , s .Values ... )
514+ s .Values = newValues
515+ }
516+ }
517+
505518func (s * StructValueProto ) Add (name string , value V ) {
506519 s .Fields = append (s .Fields , StructField {
507520 Name : name ,
Original file line number Diff line number Diff line change @@ -147,18 +147,28 @@ func ListValue(vs ...Value) Value {
147147
148148type tStructValueProto value.StructValueProto
149149
150- type StructValueOption func (* tStructValueProto )
150+ type StructValueOption interface {
151+ apply (* tStructValueProto )
152+ }
153+
154+ type structField struct {
155+ name string
156+ value Value
157+ }
158+
159+ func (f structField ) apply (p * tStructValueProto ) {
160+ (* value .StructValueProto )(p ).Add (f .name , f .value )
161+ }
151162
152163func StructFieldValue (name string , v Value ) StructValueOption {
153- return func (p * tStructValueProto ) {
154- (* value .StructValueProto )(p ).Add (name , v )
155- }
164+ return structField {name : name , value : v }
156165}
157166
158167func StructValue (opts ... StructValueOption ) Value {
159168 var p tStructValueProto
169+ (* value .StructValueProto )(& p ).Grow (len (opts ))
160170 for _ , opt := range opts {
161- opt (& p )
171+ opt . apply (& p )
162172 }
163173 return value .StructValue ((* value .StructValueProto )(& p ))
164174}
You can’t perform that action at this time.
0 commit comments