From 3a52540407e34433867ffbc58f5697d63d7312ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=91=D0=B5=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2?= Date: Mon, 11 Mar 2024 21:37:32 +0300 Subject: [PATCH 1/2] enable godot --- .golangci.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index b373a0322..feb3dcc69 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -26,7 +26,6 @@ run: # - ".*\\.my\\.go$" # - lib/bad.go - # output configuration options output: # colored-line-number|line-number|json|tab|checkstyle, default is "colored-line-number" @@ -38,7 +37,6 @@ output: # print linter name in the end of issue text, default is true print-linter-name: true - # all available settings of specific linters linters-settings: errcheck: @@ -179,7 +177,7 @@ linters-settings: # # The flag is passed to the ruleguard 'debug-group' argument. # Default: "" - debug: 'emptyDecl' + debug: "emptyDecl" # Deprecated, use 'failOn' param. # If set to true, identical to failOn='all', otherwise failOn='' failOnError: false @@ -231,7 +229,6 @@ linters: - funlen - gochecknoglobals - gocognit - - godot - goerr113 - golint - gomnd @@ -308,4 +305,4 @@ issues: # Examples: Type_PRIMITIVE_TYPE_ID_UNSPECIFIED, Ydb_Discovery_V1, _voidValue - linters: - nosnakecase - text : "(?:_[a-z]+(?:[A-Z](?:[a-z\\d]+|[A-Z\\d]+))+|(?:[A-Z][a-z\\d]+|[A-Z][A-Z\\d]+)+_(?:(?:[A-Z][a-z\\d]+|[A-Z\\d][A-Z\\d]+)_?)+)" \ No newline at end of file + text: "(?:_[a-z]+(?:[A-Z](?:[a-z\\d]+|[A-Z\\d]+))+|(?:[A-Z][a-z\\d]+|[A-Z][A-Z\\d]+)+_(?:(?:[A-Z][a-z\\d]+|[A-Z\\d][A-Z\\d]+)_?)+)" From cbed98d01d9b5ead27bb7c7fa6ee42f2b038cef8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=91=D0=B5=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2?= Date: Mon, 11 Mar 2024 21:42:37 +0300 Subject: [PATCH 2/2] fix godot issues --- balancers/balancers.go | 14 ++-- config/config.go | 28 ++++---- config/defaults.go | 2 +- credentials/credentials.go | 8 +-- credentials/options.go | 4 +- driver.go | 24 +++---- driver_string.go | 2 +- errors.go | 16 ++--- examples/serverless/healthcheck/main.go | 6 +- .../topic/topicreader/topicreader_advanced.go | 12 ++-- .../topic/topicreader/topicreader_show.go | 4 +- .../topic/topicreader/topicreader_simple.go | 8 +-- .../topic/topicreader/topicreader_trace.go | 6 +- internal/background/worker.go | 2 +- internal/backoff/type.go | 4 +- internal/balancer/local_dc_test.go | 2 +- internal/certificates/certificates.go | 6 +- internal/config/config.go | 8 +-- internal/conn/conn.go | 8 +-- internal/coordination/client.go | 2 +- internal/coordination/config/config.go | 8 +-- internal/credentials/anonymous.go | 2 +- internal/credentials/credentials.go | 2 +- internal/credentials/source_info.go | 2 +- internal/discovery/config/config.go | 10 +-- internal/discovery/discovery.go | 2 +- .../rawtopic/rawtopiccommon/codec.go | 2 +- .../rawtopic/rawtopicreader/messages.go | 8 +-- .../rawtopic/rawtopicwriter/messages.go | 4 +- internal/meta/context.go | 8 +-- internal/meta/headers.go | 8 +-- internal/query/config/config.go | 6 +- internal/query/config/options.go | 6 +- internal/query/tx/control.go | 16 ++--- internal/query/tx/settings.go | 4 +- internal/ratelimiter/config/config.go | 8 +-- internal/scanner/scanner.go | 4 +- internal/scheme/config/config.go | 12 ++-- internal/scripting/config/config.go | 6 +- internal/table/client.go | 2 +- internal/table/config/config.go | 38 +++++----- internal/table/errors.go | 4 +- internal/table/retry_test.go | 2 +- internal/table/scanner/result.go | 2 +- internal/table/scanner/scan_raw.go | 2 +- internal/table/scanner/scanner.go | 8 +-- internal/topic/topicclientinternal/client.go | 14 ++-- internal/topic/topicreaderinternal/batch.go | 8 +-- .../topic/topicreaderinternal/commit_range.go | 4 +- internal/topic/topicreaderinternal/message.go | 36 +++++----- .../message_content_pool.go | 2 +- .../message_content_pool_test.go | 2 +- .../topicreaderinternal/public_callbacks.go | 8 +-- internal/topic/topicreaderinternal/reader.go | 12 ++-- .../topic/topicwriterinternal/encoders.go | 2 +- internal/topic/topicwriterinternal/queue.go | 4 +- .../topicwriterinternal/writer_options.go | 2 +- internal/value/time.go | 4 +- internal/value/value.go | 8 +-- internal/version/parse.go | 4 +- internal/xcontext/without_deadline.go | 2 +- internal/xerrors/issues.go | 4 +- internal/xerrors/operation.go | 8 +-- internal/xerrors/retryable.go | 2 +- internal/xerrors/stacktrace.go | 2 +- internal/xerrors/transport.go | 4 +- internal/xerrors/type.go | 2 +- internal/xerrors/xerrors.go | 6 +- internal/xerrors/ydb.go | 2 +- internal/xsql/connector.go | 4 +- internal/xsql/context.go | 4 +- internal/xstring/convert_bench_test.go | 8 +-- internal/xsync/event_broadcast.go | 4 +- internal/xtest/test_condition.go | 2 +- internal/xtest/waiters.go | 6 +- log/coordination.go | 2 +- log/discovery.go | 2 +- log/driver.go | 2 +- log/field.go | 42 +++++------ log/query.go | 2 +- log/ratelimiter.go | 2 +- log/retry.go | 2 +- log/scheme.go | 2 +- log/scripting.go | 2 +- log/sql.go | 2 +- log/table.go | 2 +- log/topic.go | 2 +- meta.go | 4 +- meta/context.go | 10 +-- metrics/config.go | 2 +- metrics/counter.go | 4 +- metrics/driver.go | 2 +- metrics/gauge.go | 2 +- metrics/histogram.go | 2 +- metrics/registry.go | 2 +- metrics/sql.go | 2 +- metrics/timer.go | 2 +- options.go | 70 +++++++++---------- query/client.go | 4 +- query/transaction.go | 18 ++--- retry/backoff.go | 2 +- retry/context.go | 6 +- retry/retry.go | 18 ++--- retry/retryable_error.go | 6 +- retry/sql.go | 14 ++-- sugar/certificates.go | 4 +- sugar/dsn.go | 2 +- sugar/params.go | 4 +- sugar/path.go | 4 +- table/options/options.go | 36 +++++----- table/result/named/named.go | 6 +- table/table.go | 28 ++++---- table/types/cast.go | 16 ++--- table/types/types.go | 4 +- table/types/value.go | 46 ++++++------ .../database_sql_containers_test.go | 2 +- tests/integration/helpers_test.go | 6 +- tests/integration/metrics_registry_test.go | 10 +-- tests/integration/table_containers_test.go | 2 +- ...hile_parse_nil_json_document_value_test.go | 2 +- .../topic_grpc_stopper_helper_test.go | 2 +- testutil/topic.go | 2 +- topic/topicoptions/topicoptions_alter.go | 30 ++++---- topic/topicoptions/topicoptions_create.go | 16 ++--- topic/topicoptions/topicoptions_reader.go | 38 +++++----- topic/topicoptions/topicoptions_writer.go | 42 +++++------ topic/topicreader/batch_options.go | 8 +-- topic/topicreader/errors.go | 6 +- topic/topicreader/reader.go | 22 +++--- topic/topicsugar/topicreader.go | 14 ++-- topic/topictypes/topictypes.go | 10 +-- topic/topicwriter/topicwriter.go | 10 +-- trace/coordination_gtrace.go | 6 +- trace/details.go | 2 +- trace/discovery_gtrace.go | 6 +- trace/driver.go | 2 +- trace/driver_gtrace.go | 6 +- trace/query_gtrace.go | 6 +- trace/ratelimiter_gtrace.go | 6 +- trace/retry_gtrace.go | 6 +- trace/scheme_gtrace.go | 6 +- trace/scripting_gtrace.go | 6 +- trace/sql_gtrace.go | 6 +- trace/table.go | 2 +- trace/table_gtrace.go | 6 +- trace/topic.go | 4 +- trace/topic_gtrace.go | 6 +- version.go | 2 +- with.go | 2 +- 149 files changed, 598 insertions(+), 600 deletions(-) diff --git a/balancers/balancers.go b/balancers/balancers.go index c73c8f503..e72edf1fa 100644 --- a/balancers/balancers.go +++ b/balancers/balancers.go @@ -9,7 +9,7 @@ import ( "github.com/ydb-platform/ydb-go-sdk/v3/internal/xstring" ) -// Deprecated: RoundRobin is RandomChoice now +// Deprecated: RoundRobin is RandomChoice now. func RoundRobin() *balancerConfig.Config { return &balancerConfig.Config{} } @@ -46,7 +46,7 @@ func PreferLocalDC(balancer *balancerConfig.Config) *balancerConfig.Config { // PreferLocalDCWithFallBack creates balancer which use endpoints only in location such as initial endpoint location // Balancer "balancer" defines balancing algorithm between endpoints selected with filter by location -// If filter returned zero endpoints from all discovery endpoints list - used all endpoint instead +// If filter returned zero endpoints from all discovery endpoints list - used all endpoint instead. func PreferLocalDCWithFallBack(balancer *balancerConfig.Config) *balancerConfig.Config { balancer = PreferLocalDC(balancer) balancer.AllowFallback = true @@ -84,7 +84,7 @@ func (locations filterLocations) String() string { } // PreferLocations creates balancer which use endpoints only in selected locations (such as "ABC", "DEF", etc.) -// Balancer "balancer" defines balancing algorithm between endpoints selected with filter by location +// Balancer "balancer" defines balancing algorithm between endpoints selected with filter by location. func PreferLocations(balancer *balancerConfig.Config, locations ...string) *balancerConfig.Config { if len(locations) == 0 { panic("empty list of locations") @@ -100,7 +100,7 @@ func PreferLocations(balancer *balancerConfig.Config, locations ...string) *bala // PreferLocationsWithFallback creates balancer which use endpoints only in selected locations // Balancer "balancer" defines balancing algorithm between endpoints selected with filter by location -// If filter returned zero endpoints from all discovery endpoints list - used all endpoint instead +// If filter returned zero endpoints from all discovery endpoints list - used all endpoint instead. func PreferLocationsWithFallback(balancer *balancerConfig.Config, locations ...string) *balancerConfig.Config { balancer = PreferLocations(balancer, locations...) balancer.AllowFallback = true @@ -129,7 +129,7 @@ func (p filterFunc) String() string { } // Prefer creates balancer which use endpoints by filter -// Balancer "balancer" defines balancing algorithm between endpoints selected with filter +// Balancer "balancer" defines balancing algorithm between endpoints selected with filter. func Prefer(balancer *balancerConfig.Config, filter func(endpoint Endpoint) bool) *balancerConfig.Config { balancer.Filter = filterFunc(func(_ balancerConfig.Info, c conn.Conn) bool { return filter(c.Endpoint()) @@ -140,7 +140,7 @@ func Prefer(balancer *balancerConfig.Config, filter func(endpoint Endpoint) bool // PreferWithFallback creates balancer which use endpoints by filter // Balancer "balancer" defines balancing algorithm between endpoints selected with filter -// If filter returned zero endpoints from all discovery endpoints list - used all endpoint instead +// If filter returned zero endpoints from all discovery endpoints list - used all endpoint instead. func PreferWithFallback(balancer *balancerConfig.Config, filter func(endpoint Endpoint) bool) *balancerConfig.Config { balancer = Prefer(balancer, filter) balancer.AllowFallback = true @@ -148,7 +148,7 @@ func PreferWithFallback(balancer *balancerConfig.Config, filter func(endpoint En return balancer } -// Default balancer used by default +// Default balancer used by default. func Default() *balancerConfig.Config { return RandomChoice() } diff --git a/config/config.go b/config/config.go index e3578ee58..37ed4fbbc 100644 --- a/config/config.go +++ b/config/config.go @@ -39,12 +39,12 @@ func (c *Config) Credentials() credentials.Credentials { return c.credentials } -// ExcludeGRPCCodesForPessimization defines grpc codes for exclude its from pessimization trigger +// ExcludeGRPCCodesForPessimization defines grpc codes for exclude its from pessimization trigger. func (c *Config) ExcludeGRPCCodesForPessimization() []grpcCodes.Code { return c.excludeGRPCCodesForPessimization } -// GrpcDialOptions reports about used grpc dialing options +// GrpcDialOptions reports about used grpc dialing options. func (c *Config) GrpcDialOptions() []grpc.DialOption { return append( defaultGrpcOptions(c.trace, c.secure, c.tlsConfig), @@ -52,7 +52,7 @@ func (c *Config) GrpcDialOptions() []grpc.DialOption { ) } -// Meta reports meta information about database connection +// Meta reports meta information about database connection. func (c *Config) Meta() *meta.Meta { return c.meta } @@ -64,17 +64,17 @@ func (c *Config) ConnectionTTL() time.Duration { return c.connectionTTL } -// Secure is a flag for secure connection +// Secure is a flag for secure connection. func (c *Config) Secure() bool { return c.secure } -// Endpoint is a required starting endpoint for connect +// Endpoint is a required starting endpoint for connect. func (c *Config) Endpoint() string { return c.endpoint } -// TLSConfig reports about TLS configuration +// TLSConfig reports about TLS configuration. func (c *Config) TLSConfig() *tls.Config { return c.tlsConfig } @@ -107,7 +107,7 @@ type Option func(c *Config) // WithInternalDNSResolver // -// Deprecated: always used internal dns-resolver +// Deprecated: always used internal dns-resolver. func WithInternalDNSResolver() Option { return func(c *Config) {} } @@ -133,7 +133,7 @@ func WithDatabase(database string) Option { } } -// WithCertificate appends certificate to TLS config root certificates +// WithCertificate appends certificate to TLS config root certificates. func WithCertificate(certificate *x509.Certificate) Option { return func(c *Config) { c.tlsConfig.RootCAs.AddCert(certificate) @@ -142,7 +142,7 @@ func WithCertificate(certificate *x509.Certificate) Option { // WithTLSConfig replaces older TLS config // -// Warning: all early changes of TLS config will be lost +// Warning: all early changes of TLS config will be lost. func WithTLSConfig(tlsConfig *tls.Config) Option { return func(c *Config) { c.tlsConfig = tlsConfig @@ -203,14 +203,14 @@ func WithOperationCancelAfter(operationCancelAfter time.Duration) Option { } } -// WithNoAutoRetry disable auto-retry calls from YDB sub-clients +// WithNoAutoRetry disable auto-retry calls from YDB sub-clients. func WithNoAutoRetry() Option { return func(c *Config) { config.SetAutoRetry(&c.Common, false) } } -// WithPanicCallback applies panic callback to config +// WithPanicCallback applies panic callback to config. func WithPanicCallback(panicCallback func(e interface{})) Option { return func(c *Config) { config.SetPanicCallback(&c.Common, panicCallback) @@ -242,14 +242,14 @@ func WithMinTLSVersion(minVersion uint16) Option { } } -// WithTLSSInsecureSkipVerify applies InsecureSkipVerify flag to TLS config +// WithTLSSInsecureSkipVerify applies InsecureSkipVerify flag to TLS config. func WithTLSSInsecureSkipVerify() Option { return func(c *Config) { c.tlsConfig.InsecureSkipVerify = true } } -// WithGrpcOptions appends custom grpc dial options to defaults +// WithGrpcOptions appends custom grpc dial options to defaults. func WithGrpcOptions(option ...grpc.DialOption) Option { return func(c *Config) { c.grpcOptions = append(c.grpcOptions, option...) @@ -279,7 +279,7 @@ func New(opts ...Option) *Config { return c } -// With makes copy of current Config with specified options +// With makes copy of current Config with specified options. func (c *Config) With(opts ...Option) *Config { for _, o := range opts { if o != nil { diff --git a/config/defaults.go b/config/defaults.go index e63867808..4f879bacc 100644 --- a/config/defaults.go +++ b/config/defaults.go @@ -18,7 +18,7 @@ import ( ) var ( - // DefaultKeepaliveInterval contains default duration between grpc keepalive + // DefaultKeepaliveInterval contains default duration between grpc keepalive. DefaultKeepaliveInterval = 10 * time.Second MinKeepaliveInterval = 10 * time.Second DefaultDialTimeout = 5 * time.Second diff --git a/credentials/credentials.go b/credentials/credentials.go index 8829eb973..d78bc576d 100644 --- a/credentials/credentials.go +++ b/credentials/credentials.go @@ -6,14 +6,14 @@ import ( "github.com/ydb-platform/ydb-go-sdk/v3/internal/credentials" ) -// Credentials is an interface of YDB credentials required for connect with YDB +// Credentials is an interface of YDB credentials required for connect with YDB. type Credentials interface { // Token must return actual token or error Token(ctx context.Context) (string, error) } // NewAccessTokenCredentials makes access token credentials object -// Passed options redefines default values of credentials object internal fields +// Passed options redefines default values of credentials object internal fields. func NewAccessTokenCredentials( accessToken string, opts ...credentials.AccessTokenCredentialsOption, ) *credentials.AccessToken { @@ -21,14 +21,14 @@ func NewAccessTokenCredentials( } // NewAnonymousCredentials makes anonymous credentials object -// Passed options redefines default values of credentials object internal fields +// Passed options redefines default values of credentials object internal fields. func NewAnonymousCredentials( opts ...credentials.AnonymousCredentialsOption, ) *credentials.Anonymous { return credentials.NewAnonymousCredentials(opts...) } -// NewStaticCredentials makes static credentials object +// NewStaticCredentials makes static credentials object. func NewStaticCredentials( user, password, authEndpoint string, opts ...credentials.StaticCredentialsOption, ) *credentials.Static { diff --git a/credentials/options.go b/credentials/options.go index 9da142092..7474940bc 100644 --- a/credentials/options.go +++ b/credentials/options.go @@ -6,12 +6,12 @@ import ( "github.com/ydb-platform/ydb-go-sdk/v3/internal/credentials" ) -// WithSourceInfo option append to credentials object the source info for reporting source info details on error case +// WithSourceInfo option append to credentials object the source info for reporting source info details on error case. func WithSourceInfo(sourceInfo string) credentials.SourceInfoOption { return credentials.WithSourceInfo(sourceInfo) } -// WithGrpcDialOptions option append to static credentials object GRPC dial options +// WithGrpcDialOptions option append to static credentials object GRPC dial options. func WithGrpcDialOptions(opts ...grpc.DialOption) credentials.StaticCredentialsOption { return credentials.WithGrpcDialOptions(opts...) } diff --git a/driver.go b/driver.go index 503a56463..445df587a 100644 --- a/driver.go +++ b/driver.go @@ -49,7 +49,7 @@ import ( var _ Connection = (*Driver)(nil) -// Driver type provide access to YDB service clients +// Driver type provide access to YDB service clients. type Driver struct { ctx context.Context // cancel while Driver.Close called. ctxCancel context.CancelFunc @@ -167,22 +167,22 @@ func (d *Driver) Close(ctx context.Context) (finalErr error) { return nil } -// Endpoint returns initial endpoint +// Endpoint returns initial endpoint. func (d *Driver) Endpoint() string { return d.config.Endpoint() } -// Name returns database name +// Name returns database name. func (d *Driver) Name() string { return d.config.Database() } -// Secure returns true if database Driver is secure +// Secure returns true if database Driver is secure. func (d *Driver) Secure() bool { return d.config.Secure() } -// Table returns table client +// Table returns table client. func (d *Driver) Table() table.Client { return d.table } @@ -196,32 +196,32 @@ func (d *Driver) Query() query.Client { return d.query } -// Scheme returns scheme client +// Scheme returns scheme client. func (d *Driver) Scheme() scheme.Client { return d.scheme } -// Coordination returns coordination client +// Coordination returns coordination client. func (d *Driver) Coordination() coordination.Client { return d.coordination } -// Ratelimiter returns ratelimiter client +// Ratelimiter returns ratelimiter client. func (d *Driver) Ratelimiter() ratelimiter.Client { return d.ratelimiter } -// Discovery returns discovery client +// Discovery returns discovery client. func (d *Driver) Discovery() discovery.Client { return d.discovery } -// Scripting returns scripting client +// Scripting returns scripting client. func (d *Driver) Scripting() scripting.Client { return d.scripting } -// Topic returns topic client +// Topic returns topic client. func (d *Driver) Topic() topic.Client { return d.topic } @@ -538,7 +538,7 @@ func (d *Driver) connect(ctx context.Context) (err error) { // GRPCConn casts *ydb.Driver to grpc.ClientConnInterface for executing // unary and streaming RPC over internal driver balancer. // -// Warning: for connect to driver-unsupported YDB services +// Warning: for connect to driver-unsupported YDB services. func GRPCConn(cc *Driver) grpc.ClientConnInterface { return conn.WithContextModifier(cc.balancer, conn.WithoutWrapping) } diff --git a/driver_string.go b/driver_string.go index 32b52fbc8..8ebfb2c1a 100644 --- a/driver_string.go +++ b/driver_string.go @@ -6,7 +6,7 @@ import ( "github.com/ydb-platform/ydb-go-sdk/v3/internal/xstring" ) -// String returns string representation of Driver +// String returns string representation of Driver. func (d *Driver) String() string { buffer := xstring.Buffer() defer buffer.Free() diff --git a/errors.go b/errors.go index 55027bef0..20e51d560 100644 --- a/errors.go +++ b/errors.go @@ -40,7 +40,7 @@ func TransportError(err error) Error { return xerrors.TransportError(err) } -// IsYdbError reports when given error is and ydb error (transport, operation or internal driver error) +// IsYdbError reports when given error is and ydb error (transport, operation or internal driver error). func IsYdbError(err error) bool { return xerrors.IsYdb(err) } @@ -57,27 +57,27 @@ func OperationError(err error) Error { return xerrors.OperationError(err) } -// IsOperationErrorOverloaded checks whether given err is an operation error with code Overloaded +// IsOperationErrorOverloaded checks whether given err is an operation error with code Overloaded. func IsOperationErrorOverloaded(err error) bool { return IsOperationError(err, Ydb.StatusIds_OVERLOADED) } -// IsOperationErrorUnavailable checks whether given err is an operation error with code Unavailable +// IsOperationErrorUnavailable checks whether given err is an operation error with code Unavailable. func IsOperationErrorUnavailable(err error) bool { return IsOperationError(err, Ydb.StatusIds_UNAVAILABLE) } -// IsOperationErrorAlreadyExistsError checks whether given err is an operation error with code AlreadyExistsError +// IsOperationErrorAlreadyExistsError checks whether given err is an operation error with code AlreadyExistsError. func IsOperationErrorAlreadyExistsError(err error) bool { return IsOperationError(err, Ydb.StatusIds_ALREADY_EXISTS) } -// IsOperationErrorNotFoundError checks whether given err is an operation error with code NotFoundError +// IsOperationErrorNotFoundError checks whether given err is an operation error with code NotFoundError. func IsOperationErrorNotFoundError(err error) bool { return IsOperationError(err, Ydb.StatusIds_NOT_FOUND) } -// IsOperationErrorSchemeError checks whether given err is an operation error with code SchemeError +// IsOperationErrorSchemeError checks whether given err is an operation error with code SchemeError. func IsOperationErrorSchemeError(err error) bool { return IsOperationError(err, Ydb.StatusIds_SCHEME_ERROR) } @@ -89,13 +89,13 @@ func IsOperationErrorTransactionLocksInvalidated(err error) (isTLI bool) { return xerrors.IsOperationErrorTransactionLocksInvalidated(err) } -// IsRatelimiterAcquireError checks whether given err is an ratelimiter acquire error +// IsRatelimiterAcquireError checks whether given err is an ratelimiter acquire error. func IsRatelimiterAcquireError(err error) bool { return ratelimiterErrors.IsAcquireError(err) } // ToRatelimiterAcquireError casts given err to ratelimiter.AcquireError. -// If given err is not ratelimiter acquire error - returns nil +// If given err is not ratelimiter acquire error - returns nil. func ToRatelimiterAcquireError(err error) ratelimiter.AcquireError { return ratelimiterErrors.ToAcquireError(err) } diff --git a/examples/serverless/healthcheck/main.go b/examples/serverless/healthcheck/main.go index 5e828aa31..47485c4db 100644 --- a/examples/serverless/healthcheck/main.go +++ b/examples/serverless/healthcheck/main.go @@ -19,17 +19,17 @@ var ( urls = URLs{} ) -// URLs is a flag.Value implementation which holds URL's as string slice +// URLs is a flag.Value implementation which holds URL's as string slice. type URLs struct { urls []string } -// String returns string representation of URLs +// String returns string representation of URLs. func (u *URLs) String() string { return fmt.Sprintf("%v", u.urls) } -// Set appends new value to URLs holder +// Set appends new value to URLs holder. func (u *URLs) Set(s string) error { u.urls = append(u.urls, s) diff --git a/examples/topic/topicreader/topicreader_advanced.go b/examples/topic/topicreader/topicreader_advanced.go index 962f4700b..50b70261b 100644 --- a/examples/topic/topicreader/topicreader_advanced.go +++ b/examples/topic/topicreader/topicreader_advanced.go @@ -10,7 +10,7 @@ import ( "github.com/ydb-platform/ydb-go-sdk/v3/topic/topicreader" ) -// ReadMessagesWithCustomBatching example of custom of readed message batch +// ReadMessagesWithCustomBatching example of custom of readed message batch. func ReadMessagesWithCustomBatching(ctx context.Context, db *ydb.Driver) { reader, _ := db.Topic().StartReader("consumer", nil) @@ -21,14 +21,14 @@ func ReadMessagesWithCustomBatching(ctx context.Context, db *ydb.Driver) { } } -// MyMessage example type with own serialization +// MyMessage example type with own serialization. type MyMessage struct { ID byte ChangeType byte Delta uint32 } -// UnmarshalYDBTopicMessage implements topicreader.MessageContentUnmarshaler interface +// UnmarshalYDBTopicMessage implements topicreader.MessageContentUnmarshaler interface. func (m *MyMessage) UnmarshalYDBTopicMessage(data []byte) error { if len(data) != 6 { return errors.New("bad data len") @@ -40,14 +40,14 @@ func (m *MyMessage) UnmarshalYDBTopicMessage(data []byte) error { return nil } -// UnmarshalMessageContentToOwnType is example about effective unmarshal own format from message content +// UnmarshalMessageContentToOwnType is example about effective unmarshal own format from message content. func UnmarshalMessageContentToOwnType(ctx context.Context, reader *topicreader.Reader) { var v MyMessage mess, _ := reader.ReadMessage(ctx) _ = mess.UnmarshalTo(&v) } -// ProcessMessagesWithSyncCommit example about guarantee wait for commit accepted by server +// ProcessMessagesWithSyncCommit example about guarantee wait for commit accepted by server. func ProcessMessagesWithSyncCommit(ctx context.Context, db *ydb.Driver) { reader, _ := db.Topic().StartReader("consumer", nil, topicoptions.WithCommitMode(topicoptions.CommitModeSync), @@ -64,7 +64,7 @@ func ProcessMessagesWithSyncCommit(ctx context.Context, db *ydb.Driver) { } // OwnReadProgressStorage example about store reading progress in external system and don't use -// commit messages to YDB +// commit messages to YDB. func OwnReadProgressStorage(ctx context.Context, db *ydb.Driver) { reader, _ := db.Topic().StartReader("consumer", topicoptions.ReadTopic("asd"), topicoptions.WithGetPartitionStartOffset( diff --git a/examples/topic/topicreader/topicreader_show.go b/examples/topic/topicreader/topicreader_show.go index 7938ae431..555333a66 100644 --- a/examples/topic/topicreader/topicreader_show.go +++ b/examples/topic/topicreader/topicreader_show.go @@ -7,7 +7,7 @@ import ( "github.com/ydb-platform/ydb-go-sdk/v3/topic/topicreader" ) -// PartitionStopHandled is example of sdk handle server signal about stop partition +// PartitionStopHandled is example of sdk handle server signal about stop partition. func PartitionStopHandled(ctx context.Context, reader *topicreader.Reader) { batch, _ := reader.ReadMessagesBatch(ctx) if len(batch.Messages) == 0 { @@ -18,7 +18,7 @@ func PartitionStopHandled(ctx context.Context, reader *topicreader.Reader) { processBatch(batchContext, batch) } -// PartitionGracefulStopHandled is example of sdk handle server signal about graceful stop partition +// PartitionGracefulStopHandled is example of sdk handle server signal about graceful stop partition. func PartitionGracefulStopHandled(ctx context.Context, db *ydb.Driver) { reader, _ := db.Topic().StartReader("consumer", nil) diff --git a/examples/topic/topicreader/topicreader_simple.go b/examples/topic/topicreader/topicreader_simple.go index 6fb568037..a1ede1c56 100644 --- a/examples/topic/topicreader/topicreader_simple.go +++ b/examples/topic/topicreader/topicreader_simple.go @@ -11,7 +11,7 @@ import ( ) // PrintMessageContent is simple example for easy start read messages -// it is not recommend way for heavy-load processing, batch processing usually will faster +// it is not recommend way for heavy-load processing, batch processing usually will faster. func PrintMessageContent(ctx context.Context, reader *topicreader.Reader) { for { msg, _ := reader.ReadMessage(ctx) @@ -21,7 +21,7 @@ func PrintMessageContent(ctx context.Context, reader *topicreader.Reader) { } } -// ReadMessagesByBatch it is recommended way for process messages +// ReadMessagesByBatch it is recommended way for process messages. func ReadMessagesByBatch(ctx context.Context, reader *topicreader.Reader) { for { batch, _ := reader.ReadMessageBatch(ctx) @@ -30,7 +30,7 @@ func ReadMessagesByBatch(ctx context.Context, reader *topicreader.Reader) { } } -// UnmarshalMessageContentToJSONStruct is example for effective way for unmarshal json message content to value +// UnmarshalMessageContentToJSONStruct is example for effective way for unmarshal json message content to value. func UnmarshalMessageContentToJSONStruct(msg *topicreader.Message) { //nolint:tagliatelle type S struct { @@ -42,7 +42,7 @@ func UnmarshalMessageContentToJSONStruct(msg *topicreader.Message) { _ = topicsugar.JSONUnmarshal(msg, &v) } -// UnmarshalMessageContentToProtobufStruct is example for effective way for unmarshal protobuf message content to value +// UnmarshalMessageContentToProtobufStruct is example for effective way for unmarshal protobuf message content to value. func UnmarshalMessageContentToProtobufStruct(msg *topicreader.Message) { v := &firestore.BundledDocumentMetadata{} // protobuf type diff --git a/examples/topic/topicreader/topicreader_trace.go b/examples/topic/topicreader/topicreader_trace.go index 28ab11427..d76fb7920 100644 --- a/examples/topic/topicreader/topicreader_trace.go +++ b/examples/topic/topicreader/topicreader_trace.go @@ -9,7 +9,7 @@ import ( "github.com/ydb-platform/ydb-go-sdk/v3/trace" ) -// CommitNotify is example for receive commit notifications with async commit mode +// CommitNotify is example for receive commit notifications with async commit mode. func CommitNotify(ctx context.Context, db *ydb.Driver) { reader, _ := db.Topic().StartReader("consumer", topicoptions.ReadTopic("asd"), topicoptions.WithReaderTrace(trace.Topic{ @@ -27,7 +27,7 @@ func CommitNotify(ctx context.Context, db *ydb.Driver) { } } -// ExplicitPartitionStartStopHandler is example for create own handler for stop partition event from server +// ExplicitPartitionStartStopHandler is example for create own handler for stop partition event from server. func ExplicitPartitionStartStopHandler(ctx context.Context, db *ydb.Driver) { readContext, stopReader := context.WithCancel(context.Background()) defer stopReader() @@ -84,7 +84,7 @@ func ExplicitPartitionStartStopHandler(ctx context.Context, db *ydb.Driver) { } // PartitionStartStopHandlerAndOwnReadProgressStorage example of complex use explicit start/stop partition handler -// and own progress storage in external system +// and own progress storage in external system. func PartitionStartStopHandlerAndOwnReadProgressStorage(ctx context.Context, db *ydb.Driver) { readContext, stopReader := context.WithCancel(context.Background()) defer stopReader() diff --git a/internal/background/worker.go b/internal/background/worker.go index 91c0d1686..1dbff4cd1 100644 --- a/internal/background/worker.go +++ b/internal/background/worker.go @@ -17,7 +17,7 @@ var ( errClosedWithNilReason = xerrors.Wrap(errors.New("ydb: background worker closed with nil reason")) ) -// A Worker must not be copied after first use +// A Worker must not be copied after first use. type Worker struct { ctx context.Context workers sync.WaitGroup diff --git a/internal/backoff/type.go b/internal/backoff/type.go index 7555cd44f..845e8d763 100644 --- a/internal/backoff/type.go +++ b/internal/backoff/type.go @@ -2,10 +2,10 @@ package backoff import "fmt" -// Type reports how to Backoff operation +// Type reports how to Backoff operation. type Type uint8 -// Binary flags that used as Type +// Binary flags that used as Type. const ( TypeNoBackoff Type = 1 << iota >> 1 diff --git a/internal/balancer/local_dc_test.go b/internal/balancer/local_dc_test.go index 2eab1e9a8..24891b310 100644 --- a/internal/balancer/local_dc_test.go +++ b/internal/balancer/local_dc_test.go @@ -21,7 +21,7 @@ type discoveryMock struct { endpoints []endpoint.Endpoint } -// implement discovery.Client +// implement discovery.Client. func (d discoveryMock) Close(ctx context.Context) error { return nil } diff --git a/internal/certificates/certificates.go b/internal/certificates/certificates.go index 8282dce79..cc392ce0d 100644 --- a/internal/certificates/certificates.go +++ b/internal/certificates/certificates.go @@ -11,9 +11,9 @@ import ( ) var ( - // fileCache stores certificates by file name + // fileCache stores certificates by file name. fileCache sync.Map - // pemCache stores certificates by pem cache + // pemCache stores certificates by pem cache. pemCache sync.Map ) @@ -106,7 +106,7 @@ func loadFromPemCache(key string) (_ *x509.Certificate, exists bool) { return cert, true } -// parseCertificate is a cached version of x509.ParseCertificate. Cache key is string(der) +// parseCertificate is a cached version of x509.ParseCertificate. Cache key is string(der). func parseCertificate(der []byte, opts ...FromPemOption) (*x509.Certificate, error) { options := fromPemOptions{} for _, opt := range opts { diff --git a/internal/config/config.go b/internal/config/config.go index dcf89c4b7..07afad808 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -15,13 +15,13 @@ type Common struct { panicCallback func(e interface{}) } -// AutoRetry defines auto-retry flag +// AutoRetry defines auto-retry flag. func (c *Common) AutoRetry() bool { return !c.disableAutoRetry } // PanicCallback returns user-defined panic callback -// If nil - panic callback not defined +// If nil - panic callback not defined. func (c *Common) PanicCallback() func(e interface{}) { return c.panicCallback } @@ -68,12 +68,12 @@ func SetOperationCancelAfter(c *Common, operationCancelAfter time.Duration) { c.operationCancelAfter = operationCancelAfter } -// SetPanicCallback applies panic callback to config +// SetPanicCallback applies panic callback to config. func SetPanicCallback(c *Common, panicCallback func(e interface{})) { c.panicCallback = panicCallback } -// SetAutoRetry affects on AutoRetry() flag +// SetAutoRetry affects on AutoRetry() flag. func SetAutoRetry(c *Common, autoRetry bool) { c.disableAutoRetry = !autoRetry } diff --git a/internal/conn/conn.go b/internal/conn/conn.go index cec97c202..a0c136858 100644 --- a/internal/conn/conn.go +++ b/internal/conn/conn.go @@ -23,13 +23,13 @@ import ( ) var ( - // errOperationNotReady specified error when operation is not ready + // errOperationNotReady specified error when operation is not ready. errOperationNotReady = xerrors.Wrap(fmt.Errorf("operation is not ready yet")) - // errClosedConnection specified error when connection are closed early + // errClosedConnection specified error when connection are closed early. errClosedConnection = xerrors.Wrap(fmt.Errorf("connection closed early")) - // errUnavailableConnection specified error when connection are closed early + // errUnavailableConnection specified error when connection are closed early. errUnavailableConnection = xerrors.Wrap(fmt.Errorf("connection unavailable")) ) @@ -250,7 +250,7 @@ func isAvailable(raw *grpc.ClientConn) bool { return raw != nil && raw.GetState() == connectivity.Ready } -// conn must be locked +// conn must be locked. func (c *conn) close(ctx context.Context) (err error) { if c.cc == nil { return nil diff --git a/internal/coordination/client.go b/internal/coordination/client.go index c6ceede63..56830838a 100644 --- a/internal/coordination/client.go +++ b/internal/coordination/client.go @@ -186,7 +186,7 @@ func (c *Client) DescribeNode( return entry, config, xerrors.WithStackTrace(err) } -// DescribeNode describes a coordination node +// DescribeNode describes a coordination node. func (c *Client) describeNode( ctx context.Context, path string, diff --git a/internal/coordination/config/config.go b/internal/coordination/config/config.go index ea23c4b6b..7a67d022f 100644 --- a/internal/coordination/config/config.go +++ b/internal/coordination/config/config.go @@ -5,28 +5,28 @@ import ( "github.com/ydb-platform/ydb-go-sdk/v3/trace" ) -// Config is an configuration of coordination client +// Config is an configuration of coordination client. type Config struct { config.Common trace *trace.Coordination } -// Trace returns trace over coordination client calls +// Trace returns trace over coordination client calls. func (c Config) Trace() *trace.Coordination { return c.trace } type Option func(c *Config) -// WithTrace appends coordination trace to early defined traces +// WithTrace appends coordination trace to early defined traces. func WithTrace(trace trace.Coordination, opts ...trace.CoordinationComposeOption) Option { return func(c *Config) { c.trace = c.trace.Compose(&trace, opts...) } } -// With applies common configuration params +// With applies common configuration params. func With(config config.Common) Option { return func(c *Config) { c.Common = config diff --git a/internal/credentials/anonymous.go b/internal/credentials/anonymous.go index 7bd75f4c3..79553b13c 100644 --- a/internal/credentials/anonymous.go +++ b/internal/credentials/anonymous.go @@ -18,7 +18,7 @@ type AnonymousCredentialsOption interface { ApplyAnonymousCredentialsOption(c *Anonymous) } -// Anonymous implements Credentials interface with Anonymous access +// Anonymous implements Credentials interface with Anonymous access. type Anonymous struct { sourceInfo string } diff --git a/internal/credentials/credentials.go b/internal/credentials/credentials.go index 276597fd1..661ecedff 100644 --- a/internal/credentials/credentials.go +++ b/internal/credentials/credentials.go @@ -4,7 +4,7 @@ import ( "context" ) -// Credentials is an interface of YDB credentials required for connect with YDB +// Credentials is an interface of YDB credentials required for connect with YDB. type Credentials interface { // Token must return actual token or error Token(ctx context.Context) (string, error) diff --git a/internal/credentials/source_info.go b/internal/credentials/source_info.go index 017a49a2e..a495952eb 100644 --- a/internal/credentials/source_info.go +++ b/internal/credentials/source_info.go @@ -14,7 +14,7 @@ func (sourceInfo SourceInfoOption) ApplyAccessTokenCredentialsOption(h *AccessTo h.sourceInfo = string(sourceInfo) } -// WithSourceInfo option append to credentials object the source info for reporting source info details on error case +// WithSourceInfo option append to credentials object the source info for reporting source info details on error case. func WithSourceInfo(sourceInfo string) SourceInfoOption { return SourceInfoOption(sourceInfo) } diff --git a/internal/discovery/config/config.go b/internal/discovery/config/config.go index 6ea99d21b..ebcfb3383 100644 --- a/internal/discovery/config/config.go +++ b/internal/discovery/config/config.go @@ -64,14 +64,14 @@ func (c *Config) Trace() *trace.Discovery { type Option func(c *Config) -// With applies common configuration params +// With applies common configuration params. func With(config config.Common) Option { return func(c *Config) { c.Common = config } } -// WithEndpoint set a required starting endpoint for connect +// WithEndpoint set a required starting endpoint for connect. func WithEndpoint(endpoint string) Option { return func(c *Config) { c.endpoint = endpoint @@ -85,7 +85,7 @@ func WithDatabase(database string) Option { } } -// WithSecure set flag for secure connection +// WithSecure set flag for secure connection. func WithSecure(ssl bool) Option { return func(c *Config) { c.secure = ssl @@ -94,14 +94,14 @@ func WithSecure(ssl bool) Option { // WithMeta is not for user. // -// This option add meta information about database connection +// This option add meta information about database connection. func WithMeta(meta *meta.Meta) Option { return func(c *Config) { c.meta = meta } } -// WithTrace configures discovery client calls tracing +// WithTrace configures discovery client calls tracing. func WithTrace(trace trace.Discovery, opts ...trace.DiscoveryComposeOption) Option { return func(c *Config) { c.trace = c.trace.Compose(&trace, opts...) diff --git a/internal/discovery/discovery.go b/internal/discovery/discovery.go index 1d711ab69..d9aca0c1d 100644 --- a/internal/discovery/discovery.go +++ b/internal/discovery/discovery.go @@ -35,7 +35,7 @@ type Client struct { client Ydb_Discovery_V1.DiscoveryServiceClient } -// Discover cluster endpoints +// Discover cluster endpoints. func (c *Client) Discover(ctx context.Context) (endpoints []endpoint.Endpoint, err error) { var ( onDone = trace.DiscoveryOnDiscover( diff --git a/internal/grpcwrapper/rawtopic/rawtopiccommon/codec.go b/internal/grpcwrapper/rawtopic/rawtopiccommon/codec.go index 166818331..eb28ff7cb 100644 --- a/internal/grpcwrapper/rawtopic/rawtopiccommon/codec.go +++ b/internal/grpcwrapper/rawtopic/rawtopiccommon/codec.go @@ -4,7 +4,7 @@ import ( "github.com/ydb-platform/ydb-go-genproto/protos/Ydb_Topic" ) -// Codec any int value, for example for custom codec +// Codec any int value, for example for custom codec. type Codec int32 const ( diff --git a/internal/grpcwrapper/rawtopic/rawtopicreader/messages.go b/internal/grpcwrapper/rawtopic/rawtopicreader/messages.go index ad60427fa..999e82dfb 100644 --- a/internal/grpcwrapper/rawtopic/rawtopicreader/messages.go +++ b/internal/grpcwrapper/rawtopic/rawtopicreader/messages.go @@ -128,12 +128,12 @@ func (r *InitRequest) toProto() *Ydb_Topic.StreamReadMessage_InitRequest { return p } -// GetConsumer for implement trace.TopicReadStreamInitRequestInfo +// GetConsumer for implement trace.TopicReadStreamInitRequestInfo. func (r *InitRequest) GetConsumer() string { return r.Consumer } -// GetTopics for implement trace.TopicReadStreamInitRequestInfo +// GetTopics for implement trace.TopicReadStreamInitRequestInfo. func (r *InitRequest) GetTopics() []string { res := make([]string, len(r.TopicsReadSettings)) for i := range res { @@ -186,12 +186,12 @@ type ReadResponse struct { PartitionData []PartitionData } -// GetBytesSize implements trace.TopicReaderDataResponseInfo +// GetBytesSize implements trace.TopicReaderDataResponseInfo. func (r *ReadResponse) GetBytesSize() int { return r.BytesSize } -// GetPartitionBatchMessagesCounts implements trace.TopicReaderDataResponseInfo +// GetPartitionBatchMessagesCounts implements trace.TopicReaderDataResponseInfo. func (r *ReadResponse) GetPartitionBatchMessagesCounts() (partitionDataCount, batchCount, messagesCount int) { partitionDataCount = len(r.PartitionData) for partitionIndex := range r.PartitionData { diff --git a/internal/grpcwrapper/rawtopic/rawtopicwriter/messages.go b/internal/grpcwrapper/rawtopic/rawtopicwriter/messages.go index 252b4b3cb..13e35a0a3 100644 --- a/internal/grpcwrapper/rawtopic/rawtopicwriter/messages.go +++ b/internal/grpcwrapper/rawtopic/rawtopicwriter/messages.go @@ -49,7 +49,7 @@ func (r *InitRequest) toProto() (*Ydb_Topic.StreamWriteMessage_InitRequest, erro // Partitioning is struct because it included in per-message structure and // places on hot-path for write messages -// structure will work and compile-optimization better then interface +// structure will work and compile-optimization better then interface. type Partitioning struct { Type PartitioningType MessageGroupID string @@ -237,7 +237,7 @@ func (wa *WriteAck) fromProto(pb *Ydb_Topic.StreamWriteMessage_WriteResponse_Wri // MessageWriteStatus is struct because it included in per-message structure and // places on hot-path for write messages -// structure will work and compile-optimization better then interface +// structure will work and compile-optimization better then interface. type MessageWriteStatus struct { Type WriteStatusType WrittenOffset int64 diff --git a/internal/meta/context.go b/internal/meta/context.go index be6a9cf7a..d43b59fc7 100644 --- a/internal/meta/context.go +++ b/internal/meta/context.go @@ -6,7 +6,7 @@ import ( "google.golang.org/grpc/metadata" ) -// WithTraceID returns a copy of parent context with traceID +// WithTraceID returns a copy of parent context with traceID. func WithTraceID(ctx context.Context, traceID string) context.Context { if md, has := metadata.FromOutgoingContext(ctx); !has || len(md[HeaderTraceID]) == 0 { return metadata.AppendToOutgoingContext(ctx, HeaderTraceID, traceID) @@ -23,17 +23,17 @@ func traceID(ctx context.Context) (string, bool) { return "", false } -// WithUserAgent returns a copy of parent context with custom user-agent info +// WithUserAgent returns a copy of parent context with custom user-agent info. func WithUserAgent(ctx context.Context, userAgent string) context.Context { return metadata.AppendToOutgoingContext(ctx, HeaderUserAgent, userAgent) } -// WithRequestType returns a copy of parent context with custom request type +// WithRequestType returns a copy of parent context with custom request type. func WithRequestType(ctx context.Context, requestType string) context.Context { return metadata.AppendToOutgoingContext(ctx, HeaderRequestType, requestType) } -// WithAllowFeatures returns a copy of parent context with allowed client feature +// WithAllowFeatures returns a copy of parent context with allowed client feature. func WithAllowFeatures(ctx context.Context, features []string) context.Context { kv := make([]string, 0, len(features)*2) for _, feature := range features { diff --git a/internal/meta/headers.go b/internal/meta/headers.go index e68ca4ad4..047afdcd3 100644 --- a/internal/meta/headers.go +++ b/internal/meta/headers.go @@ -1,7 +1,7 @@ package meta const ( - // outgoing headers + // outgoing headers. HeaderDatabase = "x-ydb-database" HeaderTicket = "x-ydb-auth-ticket" HeaderVersion = "x-ydb-sdk-build-info" @@ -10,13 +10,13 @@ const ( HeaderUserAgent = "x-ydb-user-agent" HeaderClientCapabilities = "x-ydb-client-capabilities" - // outgoing hints + // outgoing hints. HintSessionBalancer = "session-balancer" - // incomming headers + // incomming headers. HeaderServerHints = "x-ydb-server-hints" HeaderConsumedUnits = "x-ydb-consumed-units" - // incoming hints + // incoming hints. HintSessionClose = "session-close" ) diff --git a/internal/query/config/config.go b/internal/query/config/config.go index 8163d519e..0a51a4eb1 100644 --- a/internal/query/config/config.go +++ b/internal/query/config/config.go @@ -49,12 +49,12 @@ func defaults() *Config { } } -// Trace defines trace over table client calls +// Trace defines trace over table client calls. func (c *Config) Trace() *trace.Query { return c.trace } -// Clock defines clock +// Clock defines clock. func (c *Config) Clock() clockwork.Clock { return c.clock } @@ -66,7 +66,7 @@ func (c *Config) PoolMaxSize() int { return c.sizeLimit } -// CreateSessionTimeout limits maximum time spent on Create session request +// CreateSessionTimeout limits maximum time spent on Create session request. func (c *Config) CreateSessionTimeout() time.Duration { return c.createSessionTimeout } diff --git a/internal/query/config/options.go b/internal/query/config/options.go index 395746770..8da278a9e 100644 --- a/internal/query/config/options.go +++ b/internal/query/config/options.go @@ -9,14 +9,14 @@ import ( type Option func(*Config) -// With applies common configuration params +// With applies common configuration params. func With(config config.Common) Option { return func(c *Config) { c.Common = config } } -// WithTrace appends table trace to early defined traces +// WithTrace appends table trace to early defined traces. func WithTrace(trace *trace.Query, opts ...trace.QueryComposeOption) Option { return func(c *Config) { c.trace = c.trace.Compose(trace, opts...) @@ -35,7 +35,7 @@ func WithSizeLimit(sizeLimit int) Option { } // WithCreateSessionTimeout limits maximum time spent on Create session request -// If createSessionTimeout is less than or equal to zero then no used timeout on create session request +// If createSessionTimeout is less than or equal to zero then no used timeout on create session request. func WithCreateSessionTimeout(createSessionTimeout time.Duration) Option { return func(c *Config) { if createSessionTimeout > 0 { diff --git a/internal/query/tx/control.go b/internal/query/tx/control.go index 5b71b021e..85acccc5e 100644 --- a/internal/query/tx/control.go +++ b/internal/query/tx/control.go @@ -61,7 +61,7 @@ func (opts beginTxOptions) applyTxSelector(a *allocator.Allocator, txControl *Yd txControl.TxSelector = selector } -// BeginTx returns selector transaction control option +// BeginTx returns selector transaction control option. func BeginTx(opts ...Option) beginTxOptions { return opts } @@ -97,12 +97,12 @@ func (c commitTxOption) applyTxControlOption(txControl *Control) { txControl.commit = true } -// CommitTx returns commit transaction control option +// CommitTx returns commit transaction control option. func CommitTx() ControlOption { return commitTxOption{} } -// NewControl makes transaction control from given options +// NewControl makes transaction control from given options. func NewControl(opts ...ControlOption) *Control { txControl := &Control{ selector: BeginTx(WithSerializableReadWrite()), @@ -121,7 +121,7 @@ func NoTx() *Control { return nil } -// DefaultTxControl returns default transaction control with serializable read-write isolation mode and auto-commit +// DefaultTxControl returns default transaction control with serializable read-write isolation mode and auto-commit. func DefaultTxControl() *Control { return NewControl( BeginTx(WithSerializableReadWrite()), @@ -129,7 +129,7 @@ func DefaultTxControl() *Control { ) } -// SerializableReadWriteTxControl returns transaction control with serializable read-write isolation mode +// SerializableReadWriteTxControl returns transaction control with serializable read-write isolation mode. func SerializableReadWriteTxControl(opts ...ControlOption) *Control { return NewControl( append([]ControlOption{ @@ -138,7 +138,7 @@ func SerializableReadWriteTxControl(opts ...ControlOption) *Control { ) } -// OnlineReadOnlyTxControl returns online read-only transaction control +// OnlineReadOnlyTxControl returns online read-only transaction control. func OnlineReadOnlyTxControl(opts ...OnlineReadOnlyOption) *Control { return NewControl( BeginTx(WithOnlineReadOnly(opts...)), @@ -146,7 +146,7 @@ func OnlineReadOnlyTxControl(opts ...OnlineReadOnlyOption) *Control { ) } -// StaleReadOnlyTxControl returns stale read-only transaction control +// StaleReadOnlyTxControl returns stale read-only transaction control. func StaleReadOnlyTxControl() *Control { return NewControl( BeginTx(WithStaleReadOnly()), @@ -154,7 +154,7 @@ func StaleReadOnlyTxControl() *Control { ) } -// SnapshotReadOnlyTxControl returns snapshot read-only transaction control +// SnapshotReadOnlyTxControl returns snapshot read-only transaction control. func SnapshotReadOnlyTxControl() *Control { return NewControl( BeginTx(WithSnapshotReadOnly()), diff --git a/internal/query/tx/settings.go b/internal/query/tx/settings.go index 15757129d..5f2e35135 100644 --- a/internal/query/tx/settings.go +++ b/internal/query/tx/settings.go @@ -24,7 +24,7 @@ var ( } ) -// Transaction settings options +// Transaction settings options. type ( Option interface { ApplyTxSettingsOption(a *allocator.Allocator, txSettings *Ydb_Query.TransactionSettings) @@ -50,7 +50,7 @@ func (opts Settings) ToYDB(a *allocator.Allocator) *Ydb_Query.TransactionSetting return txSettings } -// NewSettings returns transaction settings +// NewSettings returns transaction settings. func NewSettings(opts ...Option) Settings { return opts } diff --git a/internal/ratelimiter/config/config.go b/internal/ratelimiter/config/config.go index 8a6dd9023..ca7ef32ae 100644 --- a/internal/ratelimiter/config/config.go +++ b/internal/ratelimiter/config/config.go @@ -5,28 +5,28 @@ import ( "github.com/ydb-platform/ydb-go-sdk/v3/trace" ) -// Config is a configuration of ratelimiter client +// Config is a configuration of ratelimiter client. type Config struct { config.Common trace *trace.Ratelimiter } -// Trace returns trace over ratelimiter calls +// Trace returns trace over ratelimiter calls. func (c Config) Trace() *trace.Ratelimiter { return c.trace } type Option func(c *Config) -// WithTrace appends ratelimiter trace to early defined traces +// WithTrace appends ratelimiter trace to early defined traces. func WithTrace(trace trace.Ratelimiter, opts ...trace.RatelimiterComposeOption) Option { return func(c *Config) { c.trace = c.trace.Compose(&trace, opts...) } } -// With applies common configuration params +// With applies common configuration params. func With(config config.Common) Option { return func(c *Config) { c.Common = config diff --git a/internal/scanner/scanner.go b/internal/scanner/scanner.go index 19c91de52..9bf52e4a7 100644 --- a/internal/scanner/scanner.go +++ b/internal/scanner/scanner.go @@ -9,7 +9,7 @@ import ( "github.com/ydb-platform/ydb-go-sdk/v3/internal/value" ) -// RawValue scanning non-primitive yql types or for own implementation scanner native API +// RawValue scanning non-primitive yql types or for own implementation scanner native API. type RawValue interface { Path() string WritePathTo(w io.Writer) (n int64, err error) @@ -138,7 +138,7 @@ type RawValue interface { Err() error } -// Scanner scanning raw ydb types +// Scanner scanning raw ydb types. type Scanner interface { // UnmarshalYDB must be implemented on client-side for unmarshal raw ydb value. UnmarshalYDB(raw RawValue) error diff --git a/internal/scheme/config/config.go b/internal/scheme/config/config.go index 6a7061378..dbad3445b 100644 --- a/internal/scheme/config/config.go +++ b/internal/scheme/config/config.go @@ -5,7 +5,7 @@ import ( "github.com/ydb-platform/ydb-go-sdk/v3/trace" ) -// Config is a configuration of scheme client +// Config is a configuration of scheme client. type Config struct { config.Common @@ -13,33 +13,33 @@ type Config struct { trace *trace.Scheme } -// Trace returns trace over scheme client calls +// Trace returns trace over scheme client calls. func (c Config) Trace() *trace.Scheme { return c.trace } -// Database returns database name +// Database returns database name. func (c Config) Database() string { return c.databaseName } type Option func(c *Config) -// WithTrace appends scheme trace to early defined traces +// WithTrace appends scheme trace to early defined traces. func WithTrace(trace trace.Scheme, opts ...trace.SchemeComposeOption) Option { return func(c *Config) { c.trace = c.trace.Compose(&trace, opts...) } } -// WithDatabaseName applies database name +// WithDatabaseName applies database name. func WithDatabaseName(dbName string) Option { return func(c *Config) { c.databaseName = dbName } } -// With applies common configuration params +// With applies common configuration params. func With(config config.Common) Option { return func(c *Config) { c.Common = config diff --git a/internal/scripting/config/config.go b/internal/scripting/config/config.go index 1b8ee0ff3..366e0dbd9 100644 --- a/internal/scripting/config/config.go +++ b/internal/scripting/config/config.go @@ -11,21 +11,21 @@ type Config struct { trace *trace.Scripting } -// Trace defines trace over scripting client calls +// Trace defines trace over scripting client calls. func (c Config) Trace() *trace.Scripting { return c.trace } type Option func(c *Config) -// WithTrace appends scripting trace to early added traces +// WithTrace appends scripting trace to early added traces. func WithTrace(trace trace.Scripting, opts ...trace.ScriptingComposeOption) Option { return func(c *Config) { c.trace = c.trace.Compose(&trace, opts...) } } -// With applies common configuration params +// With applies common configuration params. func With(config config.Common) Option { return func(c *Config) { c.Common = config diff --git a/internal/table/client.go b/internal/table/client.go index 505a66f01..b4f692195 100644 --- a/internal/table/client.go +++ b/internal/table/client.go @@ -630,7 +630,7 @@ func (c *Client) Close(ctx context.Context) (err error) { // Do implements internal busy loop until one of the following conditions is met: // - deadline was canceled or deadlined // - retry operation returned nil as error -// Warning: if deadline without deadline or cancellation func Retry will be worked infinite +// Warning: if deadline without deadline or cancellation func Retry will be worked infinite. func (c *Client) Do(ctx context.Context, op table.Operation, opts ...table.Option) (finalErr error) { if c == nil { return xerrors.WithStackTrace(errNilClient) diff --git a/internal/table/config/config.go b/internal/table/config/config.go index 5013ab332..727fc4465 100644 --- a/internal/table/config/config.go +++ b/internal/table/config/config.go @@ -15,13 +15,13 @@ const ( DefaultSessionPoolSizeLimit = 50 DefaultSessionPoolIdleThreshold = 5 * time.Minute - // Deprecated: table client do not supports background session keep-aliving now + // Deprecated: table client do not supports background session keep-aliving now. DefaultKeepAliveMinSize = 10 - // Deprecated: table client do not supports background session keep-aliving now + // Deprecated: table client do not supports background session keep-aliving now. DefaultIdleKeepAliveThreshold = 2 - // Deprecated: table client do not supports background session keep-aliving now + // Deprecated: table client do not supports background session keep-aliving now. DefaultSessionPoolKeepAliveTimeout = 500 * time.Millisecond ) @@ -38,7 +38,7 @@ func New(opts ...Option) *Config { type Option func(*Config) -// With applies common configuration params +// With applies common configuration params. func With(config config.Common) Option { return func(c *Config) { c.Common = config @@ -61,7 +61,7 @@ func WithSizeLimit(sizeLimit int) Option { // If keepAliveMinSize is less than zero, then no sessions will be preserved // If keepAliveMinSize is zero, the DefaultKeepAliveMinSize is used // -// Deprecated: table client do not supports background session keep-aliving now +// Deprecated: table client do not supports background session keep-aliving now. func WithKeepAliveMinSize(keepAliveMinSize int) Option { return func(c *Config) {} } @@ -73,7 +73,7 @@ func WithKeepAliveMinSize(keepAliveMinSize int) Option { // be removed ever. // If IdleKeepAliveThreshold is equal to zero, it will be set to DefaultIdleKeepAliveThreshold // -// Deprecated: table client do not support background session keep-aliving now +// Deprecated: table client do not support background session keep-aliving now. func WithIdleKeepAliveThreshold(idleKeepAliveThreshold int) Option { return func(c *Config) {} } @@ -95,13 +95,13 @@ func WithIdleThreshold(idleThreshold time.Duration) Option { // WithKeepAliveTimeout limits maximum time spent on KeepAlive request // If keepAliveTimeout is less than or equal to zero then the DefaultSessionPoolKeepAliveTimeout is used. // -// Deprecated: table client do not support background session keep-aliving now +// Deprecated: table client do not support background session keep-aliving now. func WithKeepAliveTimeout(keepAliveTimeout time.Duration) Option { return func(c *Config) {} } // WithCreateSessionTimeout limits maximum time spent on Create session request -// If createSessionTimeout is less than or equal to zero then no used timeout on create session request +// If createSessionTimeout is less than or equal to zero then no used timeout on create session request. func WithCreateSessionTimeout(createSessionTimeout time.Duration) Option { return func(c *Config) { if createSessionTimeout > 0 { @@ -122,28 +122,28 @@ func WithDeleteTimeout(deleteTimeout time.Duration) Option { } } -// WithTrace appends table trace to early defined traces +// WithTrace appends table trace to early defined traces. func WithTrace(trace *trace.Table, opts ...trace.TableComposeOption) Option { return func(c *Config) { c.trace = c.trace.Compose(trace, opts...) } } -// WithIgnoreTruncated disables errors on truncated flag +// WithIgnoreTruncated disables errors on truncated flag. func WithIgnoreTruncated() Option { return func(c *Config) { c.ignoreTruncated = true } } -// WithClock replaces default clock +// WithClock replaces default clock. func WithClock(clock clockwork.Clock) Option { return func(c *Config) { c.clock = clock } } -// Config is a configuration of table client +// Config is a configuration of table client. type Config struct { config.Common @@ -160,12 +160,12 @@ type Config struct { clock clockwork.Clock } -// Trace defines trace over table client calls +// Trace defines trace over table client calls. func (c *Config) Trace() *trace.Table { return c.trace } -// Clock defines clock +// Clock defines clock. func (c *Config) Clock() clockwork.Clock { return c.clock } @@ -182,12 +182,12 @@ func (c *Config) SizeLimit() int { // If KeepAliveMinSize is less than zero, then no sessions will be preserved // If KeepAliveMinSize is zero, the DefaultKeepAliveMinSize is used // -// Deprecated: table client do not support background session keep-aliving now +// Deprecated: table client do not support background session keep-aliving now. func (c *Config) KeepAliveMinSize() int { return DefaultKeepAliveMinSize } -// IgnoreTruncated specifies behavior on truncated flag +// IgnoreTruncated specifies behavior on truncated flag. func (c *Config) IgnoreTruncated() bool { return c.ignoreTruncated } @@ -199,7 +199,7 @@ func (c *Config) IgnoreTruncated() bool { // be removed ever. // If IdleKeepAliveThreshold is equal to zero, it will be set to DefaultIdleKeepAliveThreshold // -// Deprecated: table client do not support background session keep-aliving now +// Deprecated: table client do not support background session keep-aliving now. func (c *Config) IdleKeepAliveThreshold() int { return DefaultIdleKeepAliveThreshold } @@ -216,12 +216,12 @@ func (c *Config) IdleThreshold() time.Duration { // KeepAliveTimeout limits maximum time spent on KeepAlive request // If KeepAliveTimeout is less than or equal to zero then the DefaultSessionPoolKeepAliveTimeout is used. // -// Deprecated: table client do not support background session keep-aliving now +// Deprecated: table client do not support background session keep-aliving now. func (c *Config) KeepAliveTimeout() time.Duration { return DefaultSessionPoolKeepAliveTimeout } -// CreateSessionTimeout limits maximum time spent on Create session request +// CreateSessionTimeout limits maximum time spent on Create session request. func (c *Config) CreateSessionTimeout() time.Duration { return c.createSessionTimeout } diff --git a/internal/table/errors.go b/internal/table/errors.go index 4ba5473f0..75c8c63fa 100644 --- a/internal/table/errors.go +++ b/internal/table/errors.go @@ -32,10 +32,10 @@ var ( // operation could not be completed. errNoProgress = xerrors.Wrap(errors.New("no progress")) - // errNodeIsNotObservable returned by a Client instance to indicate that required node is not observable + // errNodeIsNotObservable returned by a Client instance to indicate that required node is not observable. errNodeIsNotObservable = xerrors.Wrap(errors.New("node is not observable")) - // errParamsRequired returned by a Client instance to indicate that required params is not defined + // errParamsRequired returned by a Client instance to indicate that required params is not defined. errParamsRequired = xerrors.Wrap(errors.New("params required")) ) diff --git a/internal/table/retry_test.go b/internal/table/retry_test.go index 008633786..9e886b566 100644 --- a/internal/table/retry_test.go +++ b/internal/table/retry_test.go @@ -235,7 +235,7 @@ func TestRetryerImmediateReturn(t *testing.T) { } // We are testing all suspentions of custom operation func against to all deadline -// timeouts - all sub-tests must have latency less than timeouts (+tolerance) +// timeouts - all sub-tests must have latency less than timeouts (+tolerance). func TestRetryContextDeadline(t *testing.T) { timeouts := []time.Duration{ 50 * time.Millisecond, diff --git a/internal/table/scanner/result.go b/internal/table/scanner/result.go index f0b0d0cd7..eb78076a3 100644 --- a/internal/table/scanner/result.go +++ b/internal/table/scanner/result.go @@ -216,7 +216,7 @@ func (r *streamResult) NextResultSet(ctx context.Context, columns ...string) boo return r.NextResultSetErr(ctx, columns...) == nil } -// CurrentResultSet get current result set +// CurrentResultSet get current result set. func (r *baseResult) CurrentResultSet() result.Set { return r } diff --git a/internal/table/scanner/scan_raw.go b/internal/table/scanner/scan_raw.go index 7c0782f3c..47d670c41 100644 --- a/internal/table/scanner/scan_raw.go +++ b/internal/table/scanner/scan_raw.go @@ -283,7 +283,7 @@ func (s *rawConverter) Any() interface{} { return s.any() } -// Value returns current item under scan as value +// Value returns current item under scan as value. func (s *rawConverter) Value() value.Value { if s.Err() != nil { return nil diff --git a/internal/table/scanner/scanner.go b/internal/table/scanner/scanner.go index f541a1235..d26366cfc 100644 --- a/internal/table/scanner/scanner.go +++ b/internal/table/scanner/scanner.go @@ -208,7 +208,7 @@ func (s *valueScanner) ScanNamed(namedValues ...named.Value) error { return s.Err() } -// Truncated returns true if current result set has been truncated by server +// Truncated returns true if current result set has been truncated by server. func (s *valueScanner) Truncated() bool { if s.set == nil { _ = s.errorf(0, "there are no sets in the scanner") @@ -219,7 +219,7 @@ func (s *valueScanner) Truncated() bool { return s.set.GetTruncated() } -// Truncated returns true if current result set has been truncated by server +// Truncated returns true if current result set has been truncated by server. func (s *valueScanner) truncated() bool { if s.set == nil { return false @@ -461,7 +461,7 @@ func (s *valueScanner) any() interface{} { } } -// valueType returns current item under scan as ydb.valueType types +// valueType returns current item under scan as ydb.valueType types. func (s *valueScanner) value() value.Value { x := s.stack.current() @@ -481,7 +481,7 @@ func (s *valueScanner) isNull() bool { } // unwrap current item under scan interpreting it as Optional types -// ignores if type is not optional +// ignores if type is not optional. func (s *valueScanner) unwrap() { if s.Err() != nil { return diff --git a/internal/topic/topicclientinternal/client.go b/internal/topic/topicclientinternal/client.go index a023b1471..008a9a651 100644 --- a/internal/topic/topicclientinternal/client.go +++ b/internal/topic/topicclientinternal/client.go @@ -61,12 +61,12 @@ func newTopicConfig(opts ...topicoptions.TopicOption) topic.Config { return c } -// Close the client +// Close the client. func (c *Client) Close(_ context.Context) error { return nil } -// Alter topic options +// Alter topic options. func (c *Client) Alter(ctx context.Context, path string, opts ...topicoptions.AlterOption) error { req := &rawtopic.AlterTopicRequest{} req.OperationParams = c.defaultOperationParams @@ -93,7 +93,7 @@ func (c *Client) Alter(ctx context.Context, path string, opts ...topicoptions.Al return call(ctx) } -// Create new topic +// Create new topic. func (c *Client) Create( ctx context.Context, path string, @@ -125,7 +125,7 @@ func (c *Client) Create( return call(ctx) } -// Describe topic +// Describe topic. func (c *Client) Describe( ctx context.Context, path string, @@ -170,7 +170,7 @@ func (c *Client) Describe( return res, nil } -// Drop topic +// Drop topic. func (c *Client) Drop(ctx context.Context, path string, opts ...topicoptions.DropOption) error { req := rawtopic.DropTopicRequest{} req.OperationParams = c.defaultOperationParams @@ -199,7 +199,7 @@ func (c *Client) Drop(ctx context.Context, path string, opts ...topicoptions.Dro } // StartReader create new topic reader and start pull messages from server -// it is fast non block call, connection will start in background +// it is fast non block call, connection will start in background. func (c *Client) StartReader( consumer string, readSelectors topicoptions.ReadSelectors, @@ -225,7 +225,7 @@ func (c *Client) StartReader( return topicreader.NewReader(internalReader), nil } -// StartWriter create new topic writer wrapper +// StartWriter create new topic writer wrapper. func (c *Client) StartWriter(topicPath string, opts ...topicoptions.WriterOption) (*topicwriter.Writer, error) { var connector topicwriterinternal.ConnectFunc = func(ctx context.Context) ( topicwriterinternal.RawTopicWriterStream, diff --git a/internal/topic/topicreaderinternal/batch.go b/internal/topic/topicreaderinternal/batch.go index e8e00ad01..1d766d27e 100644 --- a/internal/topic/topicreaderinternal/batch.go +++ b/internal/topic/topicreaderinternal/batch.go @@ -14,7 +14,7 @@ var ( errBadMessageOffsetWhileMessageBatchCreate = xerrors.Wrap(errors.New("ydb: bad message offset while messages batch create")) //nolint:lll ) -// PublicBatch is ordered group of message from one partition +// PublicBatch is ordered group of message from one partition. type PublicBatch struct { empty.DoNotCopy @@ -102,17 +102,17 @@ func newBatchFromStream( } // Context is cancelled when code should stop to process messages batch -// for example - lost connection to server or receive stop partition signal without graceful flag +// for example - lost connection to server or receive stop partition signal without graceful flag. func (m *PublicBatch) Context() context.Context { return m.commitRange.partitionSession.Context() } -// Topic is path of source topic of the messages in the batch +// Topic is path of source topic of the messages in the batch. func (m *PublicBatch) Topic() string { return m.partitionSession().Topic } -// PartitionID of messages in the batch +// PartitionID of messages in the batch. func (m *PublicBatch) PartitionID() int64 { return m.partitionSession().PartitionID } diff --git a/internal/topic/topicreaderinternal/commit_range.go b/internal/topic/topicreaderinternal/commit_range.go index c744cd49b..5c833c7c9 100644 --- a/internal/topic/topicreaderinternal/commit_range.go +++ b/internal/topic/topicreaderinternal/commit_range.go @@ -7,7 +7,7 @@ import ( "github.com/ydb-platform/ydb-go-sdk/v3/trace" ) -// PublicCommitRangeGetter return data piece for commit messages range +// PublicCommitRangeGetter return data piece for commit messages range. type PublicCommitRangeGetter interface { getCommitRange() PublicCommitRange } @@ -20,7 +20,7 @@ func (r *CommitRanges) len() int { return len(r.ranges) } -// GetCommitsInfo implements trace.TopicReaderStreamSendCommitMessageStartMessageInfo +// GetCommitsInfo implements trace.TopicReaderStreamSendCommitMessageStartMessageInfo. func (r *CommitRanges) GetCommitsInfo() []trace.TopicReaderStreamCommitInfo { res := make([]trace.TopicReaderStreamCommitInfo, len(r.ranges)) for i := range res { diff --git a/internal/topic/topicreaderinternal/message.go b/internal/topic/topicreaderinternal/message.go index 13cc98f0c..f26f0be08 100644 --- a/internal/topic/topicreaderinternal/message.go +++ b/internal/topic/topicreaderinternal/message.go @@ -14,10 +14,10 @@ import ( var errMessageWasReadEarly = xerrors.Wrap(errors.New("ydb: message was read early")) -// ErrPublicUnexpectedCodec return when try to read message content with unknown codec +// ErrPublicUnexpectedCodec return when try to read message content with unknown codec. var ErrPublicUnexpectedCodec = errors.New("unexpected codec") -// PublicMessage is representation of topic message +// PublicMessage is representation of topic message. type PublicMessage struct { empty.DoNotCopy @@ -55,7 +55,7 @@ func (m *PublicMessage) getCommitRange() PublicCommitRange { } // UnmarshalTo can call most once per message, it read all data from internal reader and -// call PublicMessageContentUnmarshaler.UnmarshalYDBTopicMessage with uncompressed content +// call PublicMessageContentUnmarshaler.UnmarshalYDBTopicMessage with uncompressed content. func (m *PublicMessage) UnmarshalTo(dst PublicMessageContentUnmarshaler) error { if m.dataConsumed { return xerrors.WithStackTrace(errMessageWasReadEarly) @@ -68,14 +68,14 @@ func (m *PublicMessage) UnmarshalTo(dst PublicMessageContentUnmarshaler) error { // Read implements io.Reader // Read uncompressed message content -// return topicreader.UnexpectedCodec if message compressed with unknown codec +// return topicreader.UnexpectedCodec if message compressed with unknown codec. func (m *PublicMessage) Read(p []byte) (n int, err error) { m.dataConsumed = true return m.data.Read(p) } -// PublicMessageContentUnmarshaler is interface for unmarshal message content +// PublicMessageContentUnmarshaler is interface for unmarshal message content. type PublicMessageContentUnmarshaler interface { // UnmarshalYDBTopicMessage MUST NOT use data after return. // If you need content after return from Consume - copy data content to @@ -127,14 +127,14 @@ func (pmb *PublicMessageBuilder) initMessage() { } } -// Seqno set message Seqno +// Seqno set message Seqno. func (pmb *PublicMessageBuilder) Seqno(seqNo int64) *PublicMessageBuilder { pmb.mess.SeqNo = seqNo return pmb } -// CreatedAt set message CreatedAt +// CreatedAt set message CreatedAt. func (pmb *PublicMessageBuilder) CreatedAt(createdAt time.Time) *PublicMessageBuilder { pmb.mess.CreatedAt = createdAt @@ -150,42 +150,42 @@ func (pmb *PublicMessageBuilder) Metadata(metadata map[string][]byte) *PublicMes return pmb } -// MessageGroupID set message MessageGroupID +// MessageGroupID set message MessageGroupID. func (pmb *PublicMessageBuilder) MessageGroupID(messageGroupID string) *PublicMessageBuilder { pmb.mess.MessageGroupID = messageGroupID return pmb } -// WriteSessionMetadata set message WriteSessionMetadata +// WriteSessionMetadata set message WriteSessionMetadata. func (pmb *PublicMessageBuilder) WriteSessionMetadata(writeSessionMetadata map[string]string) *PublicMessageBuilder { pmb.mess.WriteSessionMetadata = writeSessionMetadata return pmb } -// Offset set message Offset +// Offset set message Offset. func (pmb *PublicMessageBuilder) Offset(offset int64) *PublicMessageBuilder { pmb.mess.Offset = offset return pmb } -// WrittenAt set message WrittenAt +// WrittenAt set message WrittenAt. func (pmb *PublicMessageBuilder) WrittenAt(writtenAt time.Time) *PublicMessageBuilder { pmb.mess.WrittenAt = writtenAt return pmb } -// ProducerID set message ProducerID +// ProducerID set message ProducerID. func (pmb *PublicMessageBuilder) ProducerID(producerID string) *PublicMessageBuilder { pmb.mess.ProducerID = producerID return pmb } -// DataAndUncompressedSize set message uncompressed content and field UncompressedSize +// DataAndUncompressedSize set message uncompressed content and field UncompressedSize. func (pmb *PublicMessageBuilder) DataAndUncompressedSize(data []byte) *PublicMessageBuilder { copyData := make([]byte, len(data)) copy(copyData, data) @@ -197,29 +197,29 @@ func (pmb *PublicMessageBuilder) DataAndUncompressedSize(data []byte) *PublicMes return pmb } -// UncompressedSize set message UncompressedSize +// UncompressedSize set message UncompressedSize. func (pmb *PublicMessageBuilder) UncompressedSize(uncompressedSize int) *PublicMessageBuilder { pmb.mess.UncompressedSize = uncompressedSize return pmb } -// Context set message Context +// Context set message Context. func (pmb *PublicMessageBuilder) Context(ctx context.Context) { pmb.mess.commitRange.partitionSession.ctx = ctx } -// Topic set message Topic +// Topic set message Topic. func (pmb *PublicMessageBuilder) Topic(topic string) { pmb.mess.commitRange.partitionSession.Topic = topic } -// PartitionID set message PartitionID +// PartitionID set message PartitionID. func (pmb *PublicMessageBuilder) PartitionID(partitionID int64) { pmb.mess.commitRange.partitionSession.PartitionID = partitionID } -// Build return builded message and reset internal state for create new message +// Build return builded message and reset internal state for create new message. func (pmb *PublicMessageBuilder) Build() *PublicMessage { mess := pmb.mess pmb.initMessage() diff --git a/internal/topic/topicreaderinternal/message_content_pool.go b/internal/topic/topicreaderinternal/message_content_pool.go index 73b561cae..d2ac2b3cf 100644 --- a/internal/topic/topicreaderinternal/message_content_pool.go +++ b/internal/topic/topicreaderinternal/message_content_pool.go @@ -19,7 +19,7 @@ type Pool interface { // CallbackWithMessageContentFunc is callback function for work with message content // data bytes MUST NOT be used after f returned -// if you need content longer - copy content to other slice +// if you need content longer - copy content to other slice. type CallbackWithMessageContentFunc func(data []byte) error const ( diff --git a/internal/topic/topicreaderinternal/message_content_pool_test.go b/internal/topic/topicreaderinternal/message_content_pool_test.go index 60a6477f5..f0d2947d1 100644 --- a/internal/topic/topicreaderinternal/message_content_pool_test.go +++ b/internal/topic/topicreaderinternal/message_content_pool_test.go @@ -165,7 +165,7 @@ func (c testFuncConsumer) UnmarshalYDBTopicMessage(data []byte) error { } // ErrReader returns an io.Reader that returns 0, err from all Read calls. -// copy for use with go pre 1.16 +// copy for use with go pre 1.16. func ErrReader(err error) io.Reader { return &errReader{err: err} } diff --git a/internal/topic/topicreaderinternal/public_callbacks.go b/internal/topic/topicreaderinternal/public_callbacks.go index 91fed02a0..d51fcb677 100644 --- a/internal/topic/topicreaderinternal/public_callbacks.go +++ b/internal/topic/topicreaderinternal/public_callbacks.go @@ -6,25 +6,25 @@ import ( "github.com/ydb-platform/ydb-go-sdk/v3/internal/grpcwrapper/rawtopic/rawtopicreader" ) -// PublicGetPartitionStartOffsetResponse allow to set start offset for read messages for the partition +// PublicGetPartitionStartOffsetResponse allow to set start offset for read messages for the partition. type PublicGetPartitionStartOffsetResponse struct { startOffset rawtopicreader.Offset startOffsetUsed bool } -// StartFrom set start offset for read the partition +// StartFrom set start offset for read the partition. func (r *PublicGetPartitionStartOffsetResponse) StartFrom(offset int64) { r.startOffset.FromInt64(offset) r.startOffsetUsed = true } -// PublicGetPartitionStartOffsetRequest info about partition +// PublicGetPartitionStartOffsetRequest info about partition. type PublicGetPartitionStartOffsetRequest struct { Topic string PartitionID int64 } -// PublicGetPartitionStartOffsetFunc callback function for optional manage read progress store at own side +// PublicGetPartitionStartOffsetFunc callback function for optional manage read progress store at own side. type PublicGetPartitionStartOffsetFunc func( ctx context.Context, req PublicGetPartitionStartOffsetRequest, diff --git a/internal/topic/topicreaderinternal/reader.go b/internal/topic/topicreaderinternal/reader.go index 030a5ca4b..c7a0afb45 100644 --- a/internal/topic/topicreaderinternal/reader.go +++ b/internal/topic/topicreaderinternal/reader.go @@ -40,7 +40,7 @@ type RawTopicReaderStream interface { } // TopicSteamReaderConnect connect to grpc stream -// when connectionCtx closed stream must stop work and return errors for all methods +// when connectionCtx closed stream must stop work and return errors for all methods. type TopicSteamReaderConnect func(connectionCtx context.Context) (RawTopicReaderStream, error) type Reader struct { @@ -62,14 +62,14 @@ func newReadMessageBatchOptions() ReadMessageBatchOptions { return ReadMessageBatchOptions{} } -// PublicReadBatchOption для различных пожеланий к батчу вроде WithMaxMessages(int) +// PublicReadBatchOption для различных пожеланий к батчу вроде WithMaxMessages(int). type PublicReadBatchOption interface { Apply(options ReadMessageBatchOptions) ReadMessageBatchOptions } type readExplicitMessagesCount int -// Apply implements PublicReadBatchOption +// Apply implements PublicReadBatchOption. func (count readExplicitMessagesCount) Apply(options ReadMessageBatchOptions) ReadMessageBatchOptions { options.MinCount = int(count) options.MaxCount = int(count) @@ -128,7 +128,7 @@ func (r *Reader) Close(ctx context.Context) error { return r.reader.CloseWithError(ctx, xerrors.WithStackTrace(errReaderClosed)) } -// ReadMessage read exactly one message +// ReadMessage read exactly one message. func (r *Reader) ReadMessage(ctx context.Context) (*PublicMessage, error) { res, err := r.ReadMessageBatch(ctx, readExplicitMessagesCount(1)) if err != nil { @@ -139,7 +139,7 @@ func (r *Reader) ReadMessage(ctx context.Context) (*PublicMessage, error) { } // ReadMessageBatch read batch of messages. -// Batch is collection of messages, which can be atomically committed +// Batch is collection of messages, which can be atomically committed. func (r *Reader) ReadMessageBatch(ctx context.Context, opts ...PublicReadBatchOption) (batch *PublicBatch, err error) { readOptions := r.defaultBatchConfig.clone() @@ -274,7 +274,7 @@ type PublicReadSelector struct { MaxTimeLag time.Duration // 0 mean skip time lag filter } -// Clone create deep clone of the selector +// Clone create deep clone of the selector. func (s PublicReadSelector) Clone() *PublicReadSelector { //nolint:gocritic s.Partitions = clone.Int64Slice(s.Partitions) diff --git a/internal/topic/topicwriterinternal/encoders.go b/internal/topic/topicwriterinternal/encoders.go index 7ae89d534..ec56e7278 100644 --- a/internal/topic/topicwriterinternal/encoders.go +++ b/internal/topic/topicwriterinternal/encoders.go @@ -71,7 +71,7 @@ func (nopWriteCloser) Close() error { return nil } -// EncoderSelector not thread safe +// EncoderSelector not thread safe. type EncoderSelector struct { m *EncoderMap diff --git a/internal/topic/topicwriterinternal/queue.go b/internal/topic/topicwriterinternal/queue.go index 25ff072d3..6753cc892 100644 --- a/internal/topic/topicwriterinternal/queue.go +++ b/internal/topic/topicwriterinternal/queue.go @@ -213,7 +213,7 @@ func (q *messageQueue) ensureNoSmallIntIndexes() { } // GetMessagesForSend one or more messages for send -// it blocked until context cancelled of have least one message for send +// it blocked until context cancelled of have least one message for send. func (q *messageQueue) GetMessagesForSend(ctx context.Context) ([]messageWithDataContent, error) { if err := ctx.Err(); err != nil { return nil, err @@ -327,7 +327,7 @@ func (m *MessageQueueAckWaiter) AddWaitIndex(index int) { m.sequenseNumbers = append(m.sequenseNumbers, index) } -// sortMessageQueueIndexes deprecated +// sortMessageQueueIndexes deprecated. func sortMessageQueueIndexes(keys []int) { sort.Ints(keys) // check index overflow diff --git a/internal/topic/topicwriterinternal/writer_options.go b/internal/topic/topicwriterinternal/writer_options.go index 51b21b93d..0afb22bfc 100644 --- a/internal/topic/topicwriterinternal/writer_options.go +++ b/internal/topic/topicwriterinternal/writer_options.go @@ -61,7 +61,7 @@ func WithCommonConfig(common config.Common) PublicWriterOption { } // WithCredentials for internal usage only -// no proxy to public interface +// no proxy to public interface. func WithCredentials(cred credentials.Credentials) PublicWriterOption { return func(cfg *WriterReconnectorConfig) { if cred == nil { diff --git a/internal/value/time.go b/internal/value/time.go index 37f7aa374..a5741be4f 100644 --- a/internal/value/time.go +++ b/internal/value/time.go @@ -28,12 +28,12 @@ const ( var epoch = time.Unix(0, 0) -// IntervalToDuration returns time.Duration from given microseconds +// IntervalToDuration returns time.Duration from given microseconds. func IntervalToDuration(n int64) time.Duration { return time.Duration(n) * time.Microsecond } -// durationToMicroseconds returns microseconds from given time.Duration +// durationToMicroseconds returns microseconds from given time.Duration. func durationToMicroseconds(d time.Duration) int64 { return int64(d / time.Microsecond) } diff --git a/internal/value/value.go b/internal/value/value.go index d88046417..c0b15967f 100644 --- a/internal/value/value.go +++ b/internal/value/value.go @@ -377,7 +377,7 @@ func (v dateValue) toYDB(a *allocator.Allocator) *Ydb.Value { return vvv } -// DateValue returns ydb date value by given days since Epoch +// DateValue returns ydb date value by given days since Epoch. func DateValue(v uint32) dateValue { return dateValue(v) } @@ -432,7 +432,7 @@ func (v datetimeValue) toYDB(a *allocator.Allocator) *Ydb.Value { return vvv } -// DatetimeValue makes ydb datetime value from seconds since Epoch +// DatetimeValue makes ydb datetime value from seconds since Epoch. func DatetimeValue(v uint32) datetimeValue { return datetimeValue(v) } @@ -1072,7 +1072,7 @@ func (v intervalValue) toYDB(a *allocator.Allocator) *Ydb.Value { return vvv } -// IntervalValue makes Value from given microseconds value +// IntervalValue makes Value from given microseconds value. func IntervalValue(v int64) intervalValue { return intervalValue(v) } @@ -1494,7 +1494,7 @@ func (v timestampValue) toYDB(a *allocator.Allocator) *Ydb.Value { return vvv } -// TimestampValue makes ydb timestamp value by given microseconds since Epoch +// TimestampValue makes ydb timestamp value by given microseconds since Epoch. func TimestampValue(v uint64) timestampValue { return timestampValue(v) } diff --git a/internal/version/parse.go b/internal/version/parse.go index e901ed031..a9c6284ed 100644 --- a/internal/version/parse.go +++ b/internal/version/parse.go @@ -37,7 +37,7 @@ func (lhs version) Less(rhs version) bool { return lhs.Suffix < rhs.Suffix } -// Lt compare lhs and rhs as (lhs < rhs) +// Lt compare lhs and rhs as (lhs < rhs). func Lt(lhs, rhs string) bool { v1, err := parse(lhs) if err != nil { @@ -51,7 +51,7 @@ func Lt(lhs, rhs string) bool { return v1.Less(v2) } -// Gte compare lhs and rhs as (lhs >= rhs) +// Gte compare lhs and rhs as (lhs >= rhs). func Gte(lhs, rhs string) bool { v1, err := parse(lhs) if err != nil { diff --git a/internal/xcontext/without_deadline.go b/internal/xcontext/without_deadline.go index c0d92045c..5296a1196 100644 --- a/internal/xcontext/without_deadline.go +++ b/internal/xcontext/without_deadline.go @@ -13,7 +13,7 @@ func (valueOnlyContext) Done() <-chan struct{} { return nil } func (valueOnlyContext) Err() error { return nil } -// WithoutDeadline helps to clear derived deadline from deadline +// WithoutDeadline helps to clear derived deadline from deadline. func WithoutDeadline(ctx context.Context) context.Context { return valueOnlyContext{ctx} } diff --git a/internal/xerrors/issues.go b/internal/xerrors/issues.go index 066bb94eb..94132a69b 100644 --- a/internal/xerrors/issues.go +++ b/internal/xerrors/issues.go @@ -55,7 +55,7 @@ func (ii issues) String() string { return b.String() } -// NewWithIssues returns error which contains child issues +// NewWithIssues returns error which contains child issues. func NewWithIssues(text string, issues ...error) error { err := &withIssuesError{ reason: text, @@ -115,7 +115,7 @@ func (e *withIssuesError) Is(target error) bool { return false } -// Issue struct +// Issue struct. type Issue struct { Message string Code uint32 diff --git a/internal/xerrors/operation.go b/internal/xerrors/operation.go index ded028e9f..74e0e3633 100644 --- a/internal/xerrors/operation.go +++ b/internal/xerrors/operation.go @@ -37,7 +37,7 @@ func (issues issuesOption) applyToOperationError(oe *operationError) { } // WithIssues is an option for construct operation error with issues list -// WithIssues must use as `Operation(WithIssues(issues))` +// WithIssues must use as `Operation(WithIssues(issues))`. func WithIssues(issues []*Ydb_Issue.IssueMessage) issuesOption { return issues } @@ -49,7 +49,7 @@ func (code statusCodeOption) applyToOperationError(oe *operationError) { } // WithStatusCode is an option for construct operation error with reason code -// WithStatusCode must use as `Operation(WithStatusCode(reason))` +// WithStatusCode must use as `Operation(WithStatusCode(reason))`. func WithStatusCode(code Ydb.StatusIds_StatusCode) statusCodeOption { return statusCodeOption(code) } @@ -68,7 +68,7 @@ func (traceID traceIDOption) applyToOperationError(oe *operationError) { oe.traceID = string(traceID) } -// WithTraceID is an option for construct operation error with traceID +// WithTraceID is an option for construct operation error with traceID. func WithTraceID(traceID string) traceIDOption { return traceIDOption(traceID) } @@ -81,7 +81,7 @@ func (e *operationOption) applyToOperationError(oe *operationError) { } // FromOperation is an option for construct operation error from operation.Status -// FromOperation must use as `Operation(FromOperation(operation.Status))` +// FromOperation must use as `Operation(FromOperation(operation.Status))`. func FromOperation(operation operation.Status) *operationOption { return &operationOption{ code: operation.GetStatus(), diff --git a/internal/xerrors/retryable.go b/internal/xerrors/retryable.go index f37bc2eb6..7825c0f07 100644 --- a/internal/xerrors/retryable.go +++ b/internal/xerrors/retryable.go @@ -86,7 +86,7 @@ func Retryable(err error, opts ...RetryableErrorOption) error { return re } -// RetryableError return Error if err is retriable error, else nil +// RetryableError return Error if err is retriable error, else nil. func RetryableError(err error) Error { var e *retryableError if errors.As(err, &e) { diff --git a/internal/xerrors/stacktrace.go b/internal/xerrors/stacktrace.go index d59c092e7..87695c632 100644 --- a/internal/xerrors/stacktrace.go +++ b/internal/xerrors/stacktrace.go @@ -18,7 +18,7 @@ func WithSkipDepth(skipDepth int) withStackTraceOption { } } -// WithStackTrace is a wrapper over original err with file:line identification +// WithStackTrace is a wrapper over original err with file:line identification. func WithStackTrace(err error, opts ...withStackTraceOption) error { if err == nil { return nil diff --git a/internal/xerrors/transport.go b/internal/xerrors/transport.go index ad2bf00a6..98253f10f 100644 --- a/internal/xerrors/transport.go +++ b/internal/xerrors/transport.go @@ -109,7 +109,7 @@ func (e *transportError) MustDeleteSession() bool { } } -// IsTransportError reports whether err is transportError with given grpc codes +// IsTransportError reports whether err is transportError with given grpc codes. func IsTransportError(err error, codes ...grpcCodes.Code) bool { if err == nil { return false @@ -134,7 +134,7 @@ func IsTransportError(err error, codes ...grpcCodes.Code) bool { return false } -// Transport returns a new transport error with given options +// Transport returns a new transport error with given options. func Transport(err error, opts ...teOpt) error { if err == nil { return nil diff --git a/internal/xerrors/type.go b/internal/xerrors/type.go index 7cb3b1ff9..5a9bec4bb 100644 --- a/internal/xerrors/type.go +++ b/internal/xerrors/type.go @@ -2,7 +2,7 @@ package xerrors import "fmt" -// Type reports which error type +// Type reports which error type. type Type uint8 const ( diff --git a/internal/xerrors/xerrors.go b/internal/xerrors/xerrors.go index a15bf85f8..cdf7409d8 100644 --- a/internal/xerrors/xerrors.go +++ b/internal/xerrors/xerrors.go @@ -62,7 +62,7 @@ func HideEOF(err error) error { } // As is a proxy to errors.As -// This need to single import errors +// This need to single import errors. func As(err error, targets ...interface{}) bool { if err == nil { panic("nil err") @@ -80,13 +80,13 @@ func As(err error, targets ...interface{}) bool { } // IsErrorFromServer return true if err returned from server -// (opposite to raised internally in sdk) +// (opposite to raised internally in sdk). func IsErrorFromServer(err error) bool { return IsTransportError(err) || IsOperationError(err) } // Is is a improved proxy to errors.Is -// This need to single import errors +// This need to single import errors. func Is(err error, targets ...error) bool { if len(targets) == 0 { panic("empty targets") diff --git a/internal/xerrors/ydb.go b/internal/xerrors/ydb.go index 3c168703c..4dd16fa9f 100644 --- a/internal/xerrors/ydb.go +++ b/internal/xerrors/ydb.go @@ -28,7 +28,7 @@ func (e *ydbError) Unwrap() error { return e.err } -// Wrap makes internal ydb error +// Wrap makes internal ydb error. func Wrap(err error) error { return &ydbError{err: err} } diff --git a/internal/xsql/connector.go b/internal/xsql/connector.go index a00246969..2d5cc38b0 100644 --- a/internal/xsql/connector.go +++ b/internal/xsql/connector.go @@ -183,7 +183,7 @@ func (m fakeTxConnectorOption) Apply(c *Connector) error { return nil } -// WithFakeTx returns a copy of context with given QueryMode +// WithFakeTx returns a copy of context with given QueryMode. func WithFakeTx(m QueryMode) ConnectorOption { return fakeTxConnectorOption(m) } @@ -223,7 +223,7 @@ type pathNormalizer interface { NormalizePath(folderOrTable string) string } -// Connector is a producer of database/sql connections +// Connector is a producer of database/sql connections. type Connector struct { parent ydbDriver diff --git a/internal/xsql/context.go b/internal/xsql/context.go index af1516de0..255774954 100644 --- a/internal/xsql/context.go +++ b/internal/xsql/context.go @@ -21,12 +21,12 @@ func WithTxControlHook(ctx context.Context, hook txControlHook) context.Context return context.WithValue(ctx, ctxTxControlHookKey{}, hook) } -// WithQueryMode returns a copy of context with given QueryMode +// WithQueryMode returns a copy of context with given QueryMode. func WithQueryMode(ctx context.Context, m QueryMode) context.Context { return context.WithValue(ctx, ctxModeTypeKey{}, m) } -// queryModeFromContext returns defined QueryMode or DefaultQueryMode +// queryModeFromContext returns defined QueryMode or DefaultQueryMode. func queryModeFromContext(ctx context.Context, defaultQueryMode QueryMode) QueryMode { if m, ok := ctx.Value(ctxModeTypeKey{}).(QueryMode); ok { return m diff --git a/internal/xstring/convert_bench_test.go b/internal/xstring/convert_bench_test.go index 3e6714e5f..256add7d9 100644 --- a/internal/xstring/convert_bench_test.go +++ b/internal/xstring/convert_bench_test.go @@ -4,7 +4,7 @@ import ( "testing" ) -// Test the performance of the standard conversion string() +// Test the performance of the standard conversion string(). func Benchmark_StdFromBytes(b *testing.B) { b.ReportAllocs() x := []byte("Hello world! Hello world! Hello world!") @@ -13,7 +13,7 @@ func Benchmark_StdFromBytes(b *testing.B) { } } -// Test the performance of strong conversion []byte to string +// Test the performance of strong conversion []byte to string. func Benchmark_FromBytes(b *testing.B) { b.ReportAllocs() x := []byte("Hello world! Hello world! Hello world!") @@ -22,7 +22,7 @@ func Benchmark_FromBytes(b *testing.B) { } } -// Test the performance of standard conversion []byte +// Test the performance of standard conversion []byte. func Benchmark_StdToBytes(b *testing.B) { b.ReportAllocs() x := "Hello world! Hello world! Hello world!" @@ -31,7 +31,7 @@ func Benchmark_StdToBytes(b *testing.B) { } } -// Test the performance of strong conversion string to []byte +// Test the performance of strong conversion string to []byte. func Benchmark_ToBytes(b *testing.B) { b.ReportAllocs() x := "Hello world! Hello world! Hello world!" diff --git a/internal/xsync/event_broadcast.go b/internal/xsync/event_broadcast.go index fba5fde30..1cb71100e 100644 --- a/internal/xsync/event_broadcast.go +++ b/internal/xsync/event_broadcast.go @@ -7,7 +7,7 @@ import ( ) // EventBroadcast is implementation of broadcast notify about event -// Zero value is usable, must not copy after first call any method +// Zero value is usable, must not copy after first call any method. type EventBroadcast struct { m sync.Mutex @@ -22,7 +22,7 @@ func (b *EventBroadcast) initNeedLock() { // Waiter return channel, that will close when next event will be broadcast. // For prevent race between subscribe and event client code must subscribe at first, then check condition -// if false - wait closing channed and check condition again +// if false - wait closing channed and check condition again. func (b *EventBroadcast) Waiter() OneTimeWaiter { b.m.Lock() defer b.m.Unlock() diff --git a/internal/xtest/test_condition.go b/internal/xtest/test_condition.go index 09d67aa25..ac6a2694f 100644 --- a/internal/xtest/test_condition.go +++ b/internal/xtest/test_condition.go @@ -7,7 +7,7 @@ import ( // enableAllTestsFlag set the env var for run all tests // some of them may take a lot ot time (hours) or use functions -// not published to common test docker image +// not published to common test docker image. const enableAllTestsFlag = "YDB_GO_SDK_ENABLE_ALL_TESTS" func AllowByFlag(t testing.TB, flag string) { diff --git a/internal/xtest/waiters.go b/internal/xtest/waiters.go index 34389c1c0..113ffcb02 100644 --- a/internal/xtest/waiters.go +++ b/internal/xtest/waiters.go @@ -47,7 +47,7 @@ func WaitChannelClosedWithTimeout(t testing.TB, ch <-chan struct{}, timeout time } // SpinWaitCondition wait while cond return true with check it in loop -// l can be nil - then locker use for check conditions +// l can be nil - then locker use for check conditions. func SpinWaitCondition(tb testing.TB, l sync.Locker, cond func() bool) { tb.Helper() @@ -55,7 +55,7 @@ func SpinWaitCondition(tb testing.TB, l sync.Locker, cond func() bool) { } // SpinWaitConditionWithTimeout wait while cond return true with check it in loop -// l can be nil - then locker use for check conditions +// l can be nil - then locker use for check conditions. func SpinWaitConditionWithTimeout(tb testing.TB, l sync.Locker, condWaitTimeout time.Duration, cond func() bool) { tb.Helper() @@ -82,7 +82,7 @@ func SpinWaitConditionWithTimeout(tb testing.TB, l sync.Locker, condWaitTimeout } } -// SpinWaitProgress failed if result of progress func no changes without timeout +// SpinWaitProgress failed if result of progress func no changes without timeout. func SpinWaitProgress(tb testing.TB, progress func() (progressValue interface{}, finished bool)) { tb.Helper() SpinWaitProgressWithTimeout(tb, commonWaitTimeout, progress) diff --git a/log/coordination.go b/log/coordination.go index 1485118de..dd0d3ea09 100644 --- a/log/coordination.go +++ b/log/coordination.go @@ -4,7 +4,7 @@ import ( "github.com/ydb-platform/ydb-go-sdk/v3/trace" ) -// Coordination makes trace.Coordination with logging events from details +// Coordination makes trace.Coordination with logging events from details. func Coordination(l Logger, d trace.Detailer, opts ...Option) (t trace.Coordination) { return t } diff --git a/log/discovery.go b/log/discovery.go index 452c61876..94b8c37b5 100644 --- a/log/discovery.go +++ b/log/discovery.go @@ -6,7 +6,7 @@ import ( "github.com/ydb-platform/ydb-go-sdk/v3/trace" ) -// Discovery makes trace.Discovery with logging events from details +// Discovery makes trace.Discovery with logging events from details. func Discovery(l Logger, d trace.Detailer, opts ...Option) (t trace.Discovery) { return internalDiscovery(wrapLogger(l, opts...), d) } diff --git a/log/driver.go b/log/driver.go index a94ffb262..6770ba2e1 100644 --- a/log/driver.go +++ b/log/driver.go @@ -8,7 +8,7 @@ import ( "github.com/ydb-platform/ydb-go-sdk/v3/trace" ) -// Driver makes trace.Driver with logging events from details +// Driver makes trace.Driver with logging events from details. func Driver(l Logger, d trace.Detailer, opts ...Option) (t trace.Driver) { return internalDriver(wrapLogger(l, opts...), d) } diff --git a/log/field.go b/log/field.go index af6f65598..d6b122f87 100644 --- a/log/field.go +++ b/log/field.go @@ -48,42 +48,42 @@ func (f Field) Key() string { return f.key } -// StringValue is a value getter for fields with StringType type +// StringValue is a value getter for fields with StringType type. func (f Field) StringValue() string { f.checkType(StringType) return f.vstr } -// IntValue is a value getter for fields with IntType type +// IntValue is a value getter for fields with IntType type. func (f Field) IntValue() int { f.checkType(IntType) return int(f.vint) } -// Int64Value is a value getter for fields with Int64Type type +// Int64Value is a value getter for fields with Int64Type type. func (f Field) Int64Value() int64 { f.checkType(Int64Type) return f.vint } -// BoolValue is a value getter for fields with BoolType type +// BoolValue is a value getter for fields with BoolType type. func (f Field) BoolValue() bool { f.checkType(BoolType) return f.vint != 0 } -// DurationValue is a value getter for fields with DurationType type +// DurationValue is a value getter for fields with DurationType type. func (f Field) DurationValue() time.Duration { f.checkType(DurationType) return time.Nanosecond * time.Duration(f.vint) } -// StringsValue is a value getter for fields with StringsType type +// StringsValue is a value getter for fields with StringsType type. func (f Field) StringsValue() []string { f.checkType(StringsType) if f.vany == nil { @@ -93,7 +93,7 @@ func (f Field) StringsValue() []string { return f.vany.([]string) } -// ErrorValue is a value getter for fields with ErrorType type +// ErrorValue is a value getter for fields with ErrorType type. func (f Field) ErrorValue() error { f.checkType(ErrorType) if f.vany == nil { @@ -103,7 +103,7 @@ func (f Field) ErrorValue() error { return f.vany.(error) } -// AnyValue is a value getter for fields with AnyType type +// AnyValue is a value getter for fields with AnyType type. func (f Field) AnyValue() interface{} { switch f.ftype { case AnyType: @@ -129,7 +129,7 @@ func (f Field) AnyValue() interface{} { } } -// Stringer is a value getter for fields with StringerType type +// Stringer is a value getter for fields with StringerType type. func (f Field) Stringer() fmt.Stringer { f.checkType(StringerType) if f.vany == nil { @@ -139,7 +139,7 @@ func (f Field) Stringer() fmt.Stringer { return f.vany.(fmt.Stringer) } -// Panics on type mismatch +// Panics on type mismatch. func (f Field) checkType(want FieldType) { if f.ftype != want { panic(fmt.Sprintf("bad type. have: %s, want: %s", f.ftype, want)) @@ -186,7 +186,7 @@ func (f Field) String() string { } } -// String constructs Field with StringType +// String constructs Field with StringType. func String(k, v string) Field { return Field{ ftype: StringType, @@ -195,7 +195,7 @@ func String(k, v string) Field { } } -// Int constructs Field with IntType +// Int constructs Field with IntType. func Int(k string, v int) Field { return Field{ ftype: IntType, @@ -212,7 +212,7 @@ func Int64(k string, v int64) Field { } } -// Bool constructs Field with BoolType +// Bool constructs Field with BoolType. func Bool(key string, value bool) Field { var vint int64 if value { @@ -228,7 +228,7 @@ func Bool(key string, value bool) Field { } } -// Duration constructs Field with DurationType +// Duration constructs Field with DurationType. func Duration(key string, value time.Duration) Field { return Field{ ftype: DurationType, @@ -237,7 +237,7 @@ func Duration(key string, value time.Duration) Field { } } -// Strings constructs Field with StringsType +// Strings constructs Field with StringsType. func Strings(key string, value []string) Field { return Field{ ftype: StringsType, @@ -246,7 +246,7 @@ func Strings(key string, value []string) Field { } } -// NamedError constructs Field with ErrorType +// NamedError constructs Field with ErrorType. func NamedError(key string, value error) Field { return Field{ ftype: ErrorType, @@ -255,7 +255,7 @@ func NamedError(key string, value error) Field { } } -// Error is the same as NamedError("error", value) +// Error is the same as NamedError("error", value). func Error(value error) Field { return NamedError("error", value) } @@ -299,7 +299,7 @@ const ( BoolType DurationType - // StringsType corresponds to []string + // StringsType corresponds to []string. StringsType ErrorType @@ -307,7 +307,7 @@ const ( // reflection-based approached to marshal this field. AnyType - // StringerType corresponds to fmt.Stringer + // StringerType corresponds to fmt.Stringer. StringerType endType @@ -344,12 +344,12 @@ func (ft FieldType) String() (typeName string) { return typeName } -// latencyField creates Field "latency": time.Since(start) +// latencyField creates Field "latency": time.Since(start). func latencyField(start time.Time) Field { return Duration("latency", time.Since(start)) } -// versionField creates Field "version": version.Version +// versionField creates Field "version": version.Version. func versionField() Field { return String("version", version.Version) } diff --git a/log/query.go b/log/query.go index d99b3d696..894765916 100644 --- a/log/query.go +++ b/log/query.go @@ -7,7 +7,7 @@ import ( "github.com/ydb-platform/ydb-go-sdk/v3/trace" ) -// Query makes trace.Query with logging events from details +// Query makes trace.Query with logging events from details. func Query(l Logger, d trace.Detailer, opts ...Option) (t trace.Query) { return internalQuery(wrapLogger(l, opts...), d) } diff --git a/log/ratelimiter.go b/log/ratelimiter.go index 55a7dc162..50c9f89e4 100644 --- a/log/ratelimiter.go +++ b/log/ratelimiter.go @@ -4,7 +4,7 @@ import ( "github.com/ydb-platform/ydb-go-sdk/v3/trace" ) -// Ratelimiter returns trace.Ratelimiter with logging events from details +// Ratelimiter returns trace.Ratelimiter with logging events from details. func Ratelimiter(l Logger, d trace.Detailer, opts ...Option) (t trace.Ratelimiter) { return t } diff --git a/log/retry.go b/log/retry.go index 8b52911b7..c1128bf91 100644 --- a/log/retry.go +++ b/log/retry.go @@ -8,7 +8,7 @@ import ( "github.com/ydb-platform/ydb-go-sdk/v3/trace" ) -// Retry returns trace.Retry with logging events from details +// Retry returns trace.Retry with logging events from details. func Retry(l Logger, d trace.Detailer, opts ...Option) (t trace.Retry) { return internalRetry(wrapLogger(l, opts...), d) } diff --git a/log/scheme.go b/log/scheme.go index 586bf0797..ebac1a6eb 100644 --- a/log/scheme.go +++ b/log/scheme.go @@ -4,7 +4,7 @@ import ( "github.com/ydb-platform/ydb-go-sdk/v3/trace" ) -// Scheme returns trace.Scheme with logging events from details +// Scheme returns trace.Scheme with logging events from details. func Scheme(l Logger, d trace.Detailer, opts ...Option) (t trace.Scheme) { return t } diff --git a/log/scripting.go b/log/scripting.go index 4af256cb1..03b765763 100644 --- a/log/scripting.go +++ b/log/scripting.go @@ -6,7 +6,7 @@ import ( "github.com/ydb-platform/ydb-go-sdk/v3/trace" ) -// Scripting returns trace.Scripting with logging events from details +// Scripting returns trace.Scripting with logging events from details. func Scripting(l Logger, d trace.Detailer, opts ...Option) (t trace.Scripting) { return internalScripting(wrapLogger(l, opts...), d) } diff --git a/log/sql.go b/log/sql.go index 3a71f3cb7..0d7bb6f79 100644 --- a/log/sql.go +++ b/log/sql.go @@ -8,7 +8,7 @@ import ( "github.com/ydb-platform/ydb-go-sdk/v3/trace" ) -// DatabaseSQL makes trace.DatabaseSQL with logging events from details +// DatabaseSQL makes trace.DatabaseSQL with logging events from details. func DatabaseSQL(l Logger, d trace.Detailer, opts ...Option) (t trace.DatabaseSQL) { return internalDatabaseSQL(wrapLogger(l, opts...), d) } diff --git a/log/table.go b/log/table.go index 5afa72bee..6882c61de 100644 --- a/log/table.go +++ b/log/table.go @@ -9,7 +9,7 @@ import ( "github.com/ydb-platform/ydb-go-sdk/v3/trace" ) -// Table makes trace.Table with logging events from details +// Table makes trace.Table with logging events from details. func Table(l Logger, d trace.Detailer, opts ...Option) (t trace.Table) { return internalTable(wrapLogger(l, opts...), d) } diff --git a/log/topic.go b/log/topic.go index 87d645d9b..03fbe66fe 100644 --- a/log/topic.go +++ b/log/topic.go @@ -7,7 +7,7 @@ import ( "github.com/ydb-platform/ydb-go-sdk/v3/trace" ) -// Topic returns trace.Topic with logging events from details +// Topic returns trace.Topic with logging events from details. func Topic(l Logger, d trace.Detailer, opts ...Option) (t trace.Topic) { return internalTopic(wrapLogger(l, opts...), d) } diff --git a/meta.go b/meta.go index f039f40fe..082e3cf11 100644 --- a/meta.go +++ b/meta.go @@ -8,14 +8,14 @@ import ( // WithTraceID returns a copy of parent context with traceID // -// Deprecated: use meta.WithTraceID instead +// Deprecated: use meta.WithTraceID instead. func WithTraceID(ctx context.Context, traceID string) context.Context { return meta.WithTraceID(ctx, traceID) } // WithRequestType returns a copy of parent context with custom request type // -// Deprecated: use meta.WithRequestType instead +// Deprecated: use meta.WithRequestType instead. func WithRequestType(ctx context.Context, requestType string) context.Context { return meta.WithRequestType(ctx, requestType) } diff --git a/meta/context.go b/meta/context.go index b2f95b5be..a6e9e29bc 100644 --- a/meta/context.go +++ b/meta/context.go @@ -8,27 +8,27 @@ import ( "github.com/ydb-platform/ydb-go-sdk/v3/internal/meta" ) -// WithTraceID returns a copy of parent context with traceID +// WithTraceID returns a copy of parent context with traceID. func WithTraceID(ctx context.Context, traceID string) context.Context { return meta.WithTraceID(ctx, traceID) } -// WithUserAgent returns a copy of parent context with custom user-agent info +// WithUserAgent returns a copy of parent context with custom user-agent info. func WithUserAgent(ctx context.Context, userAgent string) context.Context { return meta.WithUserAgent(ctx, userAgent) } -// WithRequestType returns a copy of parent context with custom request type +// WithRequestType returns a copy of parent context with custom request type. func WithRequestType(ctx context.Context, requestType string) context.Context { return meta.WithRequestType(ctx, requestType) } -// WithAllowFeatures returns a copy of parent context with allowed client feature +// WithAllowFeatures returns a copy of parent context with allowed client feature. func WithAllowFeatures(ctx context.Context, features ...string) context.Context { return meta.WithAllowFeatures(ctx, features) } -// WithTrailerCallback attaches callback to context for listening incoming metadata +// WithTrailerCallback attaches callback to context for listening incoming metadata. func WithTrailerCallback( ctx context.Context, callback func(md metadata.MD), diff --git a/metrics/config.go b/metrics/config.go index 85902821f..025e15e5b 100644 --- a/metrics/config.go +++ b/metrics/config.go @@ -2,7 +2,7 @@ package metrics import "github.com/ydb-platform/ydb-go-sdk/v3/trace" -// Config is experimental interface for metrics registry config +// Config is experimental interface for metrics registry config. type Config interface { Registry diff --git a/metrics/counter.go b/metrics/counter.go index 315e4ef47..5d44881ac 100644 --- a/metrics/counter.go +++ b/metrics/counter.go @@ -1,11 +1,11 @@ package metrics -// Counter counts value +// Counter counts value. type Counter interface { Inc() } -// CounterVec returns Counter from CounterVec by labels +// CounterVec returns Counter from CounterVec by labels. type CounterVec interface { With(labels map[string]string) Counter } diff --git a/metrics/driver.go b/metrics/driver.go index f20e7ae09..d268a6728 100644 --- a/metrics/driver.go +++ b/metrics/driver.go @@ -8,7 +8,7 @@ import ( "github.com/ydb-platform/ydb-go-sdk/v3/trace" ) -// driver makes driver with New publishing +// driver makes driver with New publishing. func driver(config Config) (t trace.Driver) { config = config.WithSystem("driver") endpoints := config.WithSystem("balancer").GaugeVec("endpoints", "local_dc", "az") diff --git a/metrics/gauge.go b/metrics/gauge.go index afd11e875..dc40823b3 100644 --- a/metrics/gauge.go +++ b/metrics/gauge.go @@ -6,7 +6,7 @@ type Gauge interface { Set(value float64) } -// GaugeVec returns Gauge from GaugeVec by labels +// GaugeVec returns Gauge from GaugeVec by labels. type GaugeVec interface { With(labels map[string]string) Gauge } diff --git a/metrics/histogram.go b/metrics/histogram.go index d946aba41..78db6f0ba 100644 --- a/metrics/histogram.go +++ b/metrics/histogram.go @@ -1,6 +1,6 @@ package metrics -// HistogramVec stores multiple dynamically created timers +// HistogramVec stores multiple dynamically created timers. type HistogramVec interface { With(labels map[string]string) Histogram } diff --git a/metrics/registry.go b/metrics/registry.go index 738afd886..7994b4e2f 100644 --- a/metrics/registry.go +++ b/metrics/registry.go @@ -1,6 +1,6 @@ package metrics -// Registry is experimental interface for metrics registry +// Registry is experimental interface for metrics registry. type Registry interface { // CounterVec returns CounterVec by name, subsystem and labels // If counter by args already created - return counter from cache diff --git a/metrics/sql.go b/metrics/sql.go index 66b1303a2..d490d93dd 100644 --- a/metrics/sql.go +++ b/metrics/sql.go @@ -6,7 +6,7 @@ import ( "github.com/ydb-platform/ydb-go-sdk/v3/trace" ) -// databaseSQL makes trace.DatabaseSQL with measuring `database/sql` events +// databaseSQL makes trace.DatabaseSQL with measuring `database/sql` events. func databaseSQL(config Config) (t trace.DatabaseSQL) { config = config.WithSystem("database").WithSystem("sql") conns := config.GaugeVec("conns") diff --git a/metrics/timer.go b/metrics/timer.go index 3849c3424..7e7dc3a36 100644 --- a/metrics/timer.go +++ b/metrics/timer.go @@ -2,7 +2,7 @@ package metrics import "time" -// TimerVec stores multiple dynamically created timers +// TimerVec stores multiple dynamically created timers. type TimerVec interface { With(labels map[string]string) Timer } diff --git a/options.go b/options.go index 5e6176f40..59f760fbe 100644 --- a/options.go +++ b/options.go @@ -29,7 +29,7 @@ import ( "github.com/ydb-platform/ydb-go-sdk/v3/trace" ) -// Option contains configuration values for Driver +// Option contains configuration values for Driver. type Option func(ctx context.Context, c *Driver) error func WithStaticCredentials(user, password string) Option { @@ -54,7 +54,7 @@ func WithAccessTokenCredentials(accessToken string) Option { ) } -// WithUserAgent add provided user agent value to all api requests +// WithUserAgent add provided user agent value to all api requests. func WithUserAgent(userAgent string) Option { return func(ctx context.Context, c *Driver) error { c.options = append(c.options, config.WithUserAgent(userAgent)) @@ -77,7 +77,7 @@ func WithRequestsType(requestsType string) Option { // // Warning: WithConnectionString will be removed at next major release // -// (Driver string will be required string param of ydb.Open) +// (Driver string will be required string param of ydb.Open). func WithConnectionString(connectionString string) Option { return func(ctx context.Context, c *Driver) error { if connectionString == "" { @@ -96,7 +96,7 @@ func WithConnectionString(connectionString string) Option { } } -// WithConnectionTTL defines duration for parking idle connections +// WithConnectionTTL defines duration for parking idle connections. func WithConnectionTTL(ttl time.Duration) Option { return func(ctx context.Context, c *Driver) error { c.options = append(c.options, config.WithConnectionTTL(ttl)) @@ -109,7 +109,7 @@ func WithConnectionTTL(ttl time.Duration) Option { // // Warning: use ydb.Open with required Driver string parameter instead // -// For making Driver string from endpoint+database+secure - use sugar.DSN() +// For making Driver string from endpoint+database+secure - use sugar.DSN(). func WithEndpoint(endpoint string) Option { return func(ctx context.Context, c *Driver) error { c.options = append(c.options, config.WithEndpoint(endpoint)) @@ -122,7 +122,7 @@ func WithEndpoint(endpoint string) Option { // // Warning: use ydb.Open with required Driver string parameter instead // -// For making Driver string from endpoint+database+secure - use sugar.DSN() +// For making Driver string from endpoint+database+secure - use sugar.DSN(). func WithDatabase(database string) Option { return func(ctx context.Context, c *Driver) error { c.options = append(c.options, config.WithDatabase(database)) @@ -135,7 +135,7 @@ func WithDatabase(database string) Option { // // Warning: use ydb.Open with required Driver string parameter instead // -// For making Driver string from endpoint+database+secure - use sugar.DSN() +// For making Driver string from endpoint+database+secure - use sugar.DSN(). func WithSecure(secure bool) Option { return func(ctx context.Context, c *Driver) error { c.options = append(c.options, config.WithSecure(secure)) @@ -155,7 +155,7 @@ func WithInsecure() Option { } } -// WithMinTLSVersion set minimum TLS version acceptable for connections +// WithMinTLSVersion set minimum TLS version acceptable for connections. func WithMinTLSVersion(minVersion uint16) Option { return func(ctx context.Context, c *Driver) error { c.options = append(c.options, config.WithMinTLSVersion(minVersion)) @@ -164,7 +164,7 @@ func WithMinTLSVersion(minVersion uint16) Option { } } -// WithTLSSInsecureSkipVerify applies InsecureSkipVerify flag to TLS config +// WithTLSSInsecureSkipVerify applies InsecureSkipVerify flag to TLS config. func WithTLSSInsecureSkipVerify() Option { return func(ctx context.Context, c *Driver) error { c.options = append(c.options, config.WithTLSSInsecureSkipVerify()) @@ -193,7 +193,7 @@ func WithAnonymousCredentials() Option { ) } -// WithCreateCredentialsFunc add callback funcion to provide requests credentials +// WithCreateCredentialsFunc add callback funcion to provide requests credentials. func WithCreateCredentialsFunc(createCredentials func(ctx context.Context) (credentials.Credentials, error)) Option { return func(ctx context.Context, c *Driver) error { creds, err := createCredentials(ctx) @@ -224,7 +224,7 @@ func WithBalancer(balancer *balancerConfig.Config) Option { // WithDialTimeout sets timeout for establishing new Driver to cluster // -// Default dial timeout is config.DefaultDialTimeout +// Default dial timeout is config.DefaultDialTimeout. func WithDialTimeout(timeout time.Duration) Option { return func(ctx context.Context, c *Driver) error { c.options = append(c.options, config.WithDialTimeout(timeout)) @@ -268,7 +268,7 @@ func WithDiscoveryInterval(discoveryInterval time.Duration) Option { } } -// WithTraceDriver appends trace.Driver into driver traces +// WithTraceDriver appends trace.Driver into driver traces. func WithTraceDriver(t trace.Driver, opts ...trace.DriverComposeOption) Option { //nolint:gocritic return func(ctx context.Context, c *Driver) error { c.options = append(c.options, config.WithTrace(t, opts...)) @@ -277,7 +277,7 @@ func WithTraceDriver(t trace.Driver, opts ...trace.DriverComposeOption) Option { } } -// WithTraceRetry appends trace.Retry into retry traces +// WithTraceRetry appends trace.Retry into retry traces. func WithTraceRetry(t trace.Retry, opts ...trace.RetryComposeOption) Option { return func(ctx context.Context, c *Driver) error { c.options = append(c.options, @@ -293,7 +293,7 @@ func WithTraceRetry(t trace.Retry, opts ...trace.RetryComposeOption) Option { } } -// WithCertificate appends certificate to TLS config root certificates +// WithCertificate appends certificate to TLS config root certificates. func WithCertificate(cert *x509.Certificate) Option { return func(ctx context.Context, c *Driver) error { c.options = append(c.options, config.WithCertificate(cert)) @@ -302,7 +302,7 @@ func WithCertificate(cert *x509.Certificate) Option { } } -// WithCertificatesFromFile appends certificates by filepath to TLS config root certificates +// WithCertificatesFromFile appends certificates by filepath to TLS config root certificates. func WithCertificatesFromFile(caFile string, opts ...certificates.FromFileOption) Option { if len(caFile) > 0 && caFile[0] == '~' { if home, err := os.UserHomeDir(); err == nil { @@ -334,7 +334,7 @@ func WithCertificatesFromFile(caFile string, opts ...certificates.FromFileOption // WithTLSConfig replaces older TLS config // // Warning: all early TLS config changes (such as WithCertificate, WithCertificatesFromFile, WithCertificatesFromPem, -// WithMinTLSVersion, WithTLSSInsecureSkipVerify) will be lost +// WithMinTLSVersion, WithTLSSInsecureSkipVerify) will be lost. func WithTLSConfig(tlsConfig *tls.Config) Option { return func(ctx context.Context, c *Driver) error { c.options = append(c.options, config.WithTLSConfig(tlsConfig)) @@ -343,7 +343,7 @@ func WithTLSConfig(tlsConfig *tls.Config) Option { } } -// WithCertificatesFromPem appends certificates from pem-encoded data to TLS config root certificates +// WithCertificatesFromPem appends certificates from pem-encoded data to TLS config root certificates. func WithCertificatesFromPem(bytes []byte, opts ...certificates.FromPemOption) Option { return func(ctx context.Context, c *Driver) error { certs, err := certificates.FromPem(bytes, opts...) @@ -378,7 +378,7 @@ func WithQueryConfigOption(option queryConfig.Option) Option { } } -// WithSessionPoolSizeLimit set max size of internal sessions pool in table.Client +// WithSessionPoolSizeLimit set max size of internal sessions pool in table.Client. func WithSessionPoolSizeLimit(sizeLimit int) Option { return func(ctx context.Context, c *Driver) error { c.tableOptions = append(c.tableOptions, tableConfig.WithSizeLimit(sizeLimit)) @@ -390,12 +390,12 @@ func WithSessionPoolSizeLimit(sizeLimit int) Option { // WithSessionPoolKeepAliveMinSize set minimum sessions should be keeped alive in table.Client // -// Deprecated: table client do not supports background session keep-aliving now +// Deprecated: table client do not supports background session keep-aliving now. func WithSessionPoolKeepAliveMinSize(keepAliveMinSize int) Option { return func(ctx context.Context, c *Driver) error { return nil } } -// WithSessionPoolIdleThreshold defines interval for idle sessions +// WithSessionPoolIdleThreshold defines interval for idle sessions. func WithSessionPoolIdleThreshold(idleThreshold time.Duration) Option { return func(ctx context.Context, c *Driver) error { c.tableOptions = append(c.tableOptions, tableConfig.WithIdleThreshold(idleThreshold)) @@ -408,12 +408,12 @@ func WithSessionPoolIdleThreshold(idleThreshold time.Duration) Option { } } -// WithSessionPoolKeepAliveTimeout set timeout of keep alive requests for session in table.Client +// WithSessionPoolKeepAliveTimeout set timeout of keep alive requests for session in table.Client. func WithSessionPoolKeepAliveTimeout(keepAliveTimeout time.Duration) Option { return func(ctx context.Context, c *Driver) error { return nil } } -// WithSessionPoolCreateSessionTimeout set timeout for new session creation process in table.Client +// WithSessionPoolCreateSessionTimeout set timeout for new session creation process in table.Client. func WithSessionPoolCreateSessionTimeout(createSessionTimeout time.Duration) Option { return func(ctx context.Context, c *Driver) error { c.tableOptions = append(c.tableOptions, tableConfig.WithCreateSessionTimeout(createSessionTimeout)) @@ -423,7 +423,7 @@ func WithSessionPoolCreateSessionTimeout(createSessionTimeout time.Duration) Opt } } -// WithSessionPoolDeleteTimeout set timeout to gracefully close deleting session in table.Client +// WithSessionPoolDeleteTimeout set timeout to gracefully close deleting session in table.Client. func WithSessionPoolDeleteTimeout(deleteTimeout time.Duration) Option { return func(ctx context.Context, c *Driver) error { c.tableOptions = append(c.tableOptions, tableConfig.WithDeleteTimeout(deleteTimeout)) @@ -433,7 +433,7 @@ func WithSessionPoolDeleteTimeout(deleteTimeout time.Duration) Option { } } -// WithIgnoreTruncated disables errors on truncated flag +// WithIgnoreTruncated disables errors on truncated flag. func WithIgnoreTruncated() Option { return func(ctx context.Context, c *Driver) error { c.tableOptions = append(c.tableOptions, tableConfig.WithIgnoreTruncated()) @@ -445,7 +445,7 @@ func WithIgnoreTruncated() Option { // WithPanicCallback specified behavior on panic // Warning: WithPanicCallback must be defined on start of all options // (before `WithTrace{Driver,Table,Scheme,Scripting,Coordination,Ratelimiter}` and other options) -// If not defined - panic would not intercept with driver +// If not defined - panic would not intercept with driver. func WithPanicCallback(panicCallback func(e interface{})) Option { return func(ctx context.Context, c *Driver) error { c.panicCallback = panicCallback @@ -455,7 +455,7 @@ func WithPanicCallback(panicCallback func(e interface{})) Option { } } -// WithTraceTable appends trace.Table into table traces +// WithTraceTable appends trace.Table into table traces. func WithTraceTable(t trace.Table, opts ...trace.TableComposeOption) Option { //nolint:gocritic return func(ctx context.Context, c *Driver) error { c.tableOptions = append( @@ -475,7 +475,7 @@ func WithTraceTable(t trace.Table, opts ...trace.TableComposeOption) Option { // } } -// WithTraceQuery appends trace.Query into query traces +// WithTraceQuery appends trace.Query into query traces. func WithTraceQuery(t trace.Query, opts ...trace.QueryComposeOption) Option { return func(ctx context.Context, c *Driver) error { c.queryOptions = append( @@ -494,7 +494,7 @@ func WithTraceQuery(t trace.Query, opts ...trace.QueryComposeOption) Option { } } -// WithTraceScripting scripting trace option +// WithTraceScripting scripting trace option. func WithTraceScripting(t trace.Scripting, opts ...trace.ScriptingComposeOption) Option { return func(ctx context.Context, c *Driver) error { c.scriptingOptions = append( @@ -514,7 +514,7 @@ func WithTraceScripting(t trace.Scripting, opts ...trace.ScriptingComposeOption) } } -// WithTraceScheme returns scheme trace option +// WithTraceScheme returns scheme trace option. func WithTraceScheme(t trace.Scheme, opts ...trace.SchemeComposeOption) Option { return func(ctx context.Context, c *Driver) error { c.schemeOptions = append( @@ -534,7 +534,7 @@ func WithTraceScheme(t trace.Scheme, opts ...trace.SchemeComposeOption) Option { } } -// WithTraceCoordination returns coordination trace option +// WithTraceCoordination returns coordination trace option. func WithTraceCoordination(t trace.Coordination, opts ...trace.CoordinationComposeOption) Option { return func(ctx context.Context, c *Driver) error { c.coordinationOptions = append( @@ -554,7 +554,7 @@ func WithTraceCoordination(t trace.Coordination, opts ...trace.CoordinationCompo } } -// WithTraceRatelimiter returns ratelimiter trace option +// WithTraceRatelimiter returns ratelimiter trace option. func WithTraceRatelimiter(t trace.Ratelimiter, opts ...trace.RatelimiterComposeOption) Option { return func(ctx context.Context, c *Driver) error { c.ratelimiterOptions = append( @@ -574,7 +574,7 @@ func WithTraceRatelimiter(t trace.Ratelimiter, opts ...trace.RatelimiterComposeO } } -// WithRatelimiterOptions returns reatelimiter option +// WithRatelimiterOptions returns reatelimiter option. func WithRatelimiterOptions(opts ...ratelimiterConfig.Option) Option { return func(ctx context.Context, c *Driver) error { c.ratelimiterOptions = append(c.ratelimiterOptions, opts...) @@ -583,7 +583,7 @@ func WithRatelimiterOptions(opts ...ratelimiterConfig.Option) Option { } } -// WithTraceDiscovery adds configured discovery tracer to Driver +// WithTraceDiscovery adds configured discovery tracer to Driver. func WithTraceDiscovery(t trace.Discovery, opts ...trace.DiscoveryComposeOption) Option { return func(ctx context.Context, c *Driver) error { c.discoveryOptions = append( @@ -603,7 +603,7 @@ func WithTraceDiscovery(t trace.Discovery, opts ...trace.DiscoveryComposeOption) } } -// WithTraceTopic adds configured discovery tracer to Driver +// WithTraceTopic adds configured discovery tracer to Driver. func WithTraceTopic(t trace.Topic, opts ...trace.TopicComposeOption) Option { //nolint:gocritic return func(ctx context.Context, c *Driver) error { c.topicOptions = append( @@ -623,7 +623,7 @@ func WithTraceTopic(t trace.Topic, opts ...trace.TopicComposeOption) Option { // } } -// WithTraceDatabaseSQL adds configured discovery tracer to Driver +// WithTraceDatabaseSQL adds configured discovery tracer to Driver. func WithTraceDatabaseSQL(t trace.DatabaseSQL, opts ...trace.DatabaseSQLComposeOption) Option { //nolint:gocritic return func(ctx context.Context, c *Driver) error { c.databaseSQLOptions = append( diff --git a/query/client.go b/query/client.go index 87fedc52b..e6f6b65f4 100644 --- a/query/client.go +++ b/query/client.go @@ -36,12 +36,12 @@ type Client interface { type ( // Operation is the interface that holds an operation for retry. // if Operation returns not nil - operation will retry - // if Operation returns nil - retry loop will break + // if Operation returns nil - retry loop will break. Operation func(ctx context.Context, s Session) error // TxOperation is the interface that holds an operation for retry. // if TxOperation returns not nil - operation will retry - // if TxOperation returns nil - retry loop will break + // if TxOperation returns nil - retry loop will break. TxOperation func(ctx context.Context, tx TxActor) error ClosableSession interface { diff --git a/query/transaction.go b/query/transaction.go index 877c93296..b3bb7f9da 100644 --- a/query/transaction.go +++ b/query/transaction.go @@ -31,7 +31,7 @@ type ( TransactionSettings = tx.Settings ) -// BeginTx returns selector transaction control option +// BeginTx returns selector transaction control option. func BeginTx(opts ...tx.Option) tx.ControlOption { return tx.BeginTx(opts...) } @@ -44,12 +44,12 @@ func WithTxID(txID string) tx.ControlOption { return tx.WithTxID(txID) } -// CommitTx returns commit transaction control option +// CommitTx returns commit transaction control option. func CommitTx() tx.ControlOption { return tx.CommitTx() } -// TxControl makes transaction control from given options +// TxControl makes transaction control from given options. func TxControl(opts ...tx.ControlOption) *TransactionControl { return tx.NewControl(opts...) } @@ -58,7 +58,7 @@ func NoTx() *TransactionControl { return nil } -// DefaultTxControl returns default transaction control with serializable read-write isolation mode and auto-commit +// DefaultTxControl returns default transaction control with serializable read-write isolation mode and auto-commit. func DefaultTxControl() *TransactionControl { return TxControl( BeginTx(WithSerializableReadWrite()), @@ -66,12 +66,12 @@ func DefaultTxControl() *TransactionControl { ) } -// SerializableReadWriteTxControl returns transaction control with serializable read-write isolation mode +// SerializableReadWriteTxControl returns transaction control with serializable read-write isolation mode. func SerializableReadWriteTxControl(opts ...tx.ControlOption) *TransactionControl { return tx.SerializableReadWriteTxControl(opts...) } -// OnlineReadOnlyTxControl returns online read-only transaction control +// OnlineReadOnlyTxControl returns online read-only transaction control. func OnlineReadOnlyTxControl(opts ...tx.OnlineReadOnlyOption) *TransactionControl { return TxControl( BeginTx(WithOnlineReadOnly(opts...)), @@ -79,7 +79,7 @@ func OnlineReadOnlyTxControl(opts ...tx.OnlineReadOnlyOption) *TransactionContro ) } -// StaleReadOnlyTxControl returns stale read-only transaction control +// StaleReadOnlyTxControl returns stale read-only transaction control. func StaleReadOnlyTxControl() *TransactionControl { return TxControl( BeginTx(WithStaleReadOnly()), @@ -87,7 +87,7 @@ func StaleReadOnlyTxControl() *TransactionControl { ) } -// SnapshotReadOnlyTxControl returns snapshot read-only transaction control +// SnapshotReadOnlyTxControl returns snapshot read-only transaction control. func SnapshotReadOnlyTxControl() *TransactionControl { return TxControl( BeginTx(WithSnapshotReadOnly()), @@ -95,7 +95,7 @@ func SnapshotReadOnlyTxControl() *TransactionControl { ) } -// TxSettings returns transaction settings +// TxSettings returns transaction settings. func TxSettings(opts ...tx.Option) TransactionSettings { return opts } diff --git a/retry/backoff.go b/retry/backoff.go index 155bcf922..b000d4365 100644 --- a/retry/backoff.go +++ b/retry/backoff.go @@ -6,7 +6,7 @@ import ( "github.com/ydb-platform/ydb-go-sdk/v3/internal/backoff" ) -// Backoff makes backoff object with custom params +// Backoff makes backoff object with custom params. func Backoff(slotDuration time.Duration, ceiling uint, jitterLimit float64) backoff.Backoff { return backoff.New( backoff.WithSlotDuration(slotDuration), diff --git a/retry/context.go b/retry/context.go index a3898fc0b..e41ddfc21 100644 --- a/retry/context.go +++ b/retry/context.go @@ -7,19 +7,19 @@ type ( ) // WithIdempotentOperation returns a copy of parent context with idempotent operation feature -// Deprecated: use retry.WithIdempotent option instead +// Deprecated: use retry.WithIdempotent option instead. func WithIdempotentOperation(ctx context.Context) context.Context { return context.WithValue(ctx, ctxIsOperationIdempotentKey{}, true) } // WithNonIdempotentOperation returns a copy of parent context with non-idempotent operation feature -// Deprecated: idempotent flag is false by default +// Deprecated: idempotent flag is false by default. func WithNonIdempotentOperation(ctx context.Context) context.Context { return context.WithValue(ctx, ctxIsOperationIdempotentKey{}, false) } // IsOperationIdempotent returns the flag for retry with no idempotent errors -// Deprecated: context cannot store idempotent value now +// Deprecated: context cannot store idempotent value now. func IsOperationIdempotent(ctx context.Context) bool { v, ok := ctx.Value(ctxIsOperationIdempotentKey{}).(bool) diff --git a/retry/retry.go b/retry/retry.go index d936fd5a2..d8d875743 100644 --- a/retry/retry.go +++ b/retry/retry.go @@ -14,7 +14,7 @@ import ( // retryOperation is the interface that holds an operation for retry. // if retryOperation returns not nil - operation will retry -// if retryOperation returns nil - retry loop will break +// if retryOperation returns nil - retry loop will break. type retryOperation func(context.Context) (err error) type retryOptions struct { @@ -49,7 +49,7 @@ func (label labelOption) ApplyRetryOption(opts *retryOptions) { opts.label = string(label) } -// WithLabel applies label for identification call Retry in trace.Retry.OnRetry +// WithLabel applies label for identification call Retry in trace.Retry.OnRetry. func WithLabel(label string) labelOption { return labelOption(label) } @@ -96,7 +96,7 @@ func (stackTraceOption) ApplyDoTxOption(opts *doTxOptions) { opts.retryOptions = append(opts.retryOptions, WithStackTrace()) } -// WithStackTrace wraps errors with stacktrace from Retry call +// WithStackTrace wraps errors with stacktrace from Retry call. func WithStackTrace() stackTraceOption { return stackTraceOption{} } @@ -119,7 +119,7 @@ func (t traceOption) ApplyDoTxOption(opts *doTxOptions) { opts.retryOptions = append(opts.retryOptions, WithTrace(t.t)) } -// WithTrace returns trace option +// WithTrace returns trace option. func WithTrace(t *trace.Retry) traceOption { return traceOption{t: t} } @@ -140,7 +140,7 @@ func (idempotent idempotentOption) ApplyDoTxOption(opts *doTxOptions) { opts.retryOptions = append(opts.retryOptions, WithIdempotent(bool(idempotent))) } -// WithIdempotent applies idempotent flag to retry operation +// WithIdempotent applies idempotent flag to retry operation. func WithIdempotent(idempotent bool) idempotentOption { return idempotentOption(idempotent) } @@ -165,7 +165,7 @@ func (o fastBackoffOption) ApplyDoTxOption(opts *doTxOptions) { opts.retryOptions = append(opts.retryOptions, WithFastBackoff(o.backoff)) } -// WithFastBackoff replaces default fast backoff +// WithFastBackoff replaces default fast backoff. func WithFastBackoff(b backoff.Backoff) fastBackoffOption { return fastBackoffOption{backoff: b} } @@ -190,7 +190,7 @@ func (o slowBackoffOption) ApplyDoTxOption(opts *doTxOptions) { opts.retryOptions = append(opts.retryOptions, WithSlowBackoff(o.backoff)) } -// WithSlowBackoff replaces default slow backoff +// WithSlowBackoff replaces default slow backoff. func WithSlowBackoff(b backoff.Backoff) slowBackoffOption { return slowBackoffOption{backoff: b} } @@ -214,7 +214,7 @@ func (o panicCallbackOption) ApplyDoTxOption(opts *doTxOptions) { } // WithPanicCallback returns panic callback option -// If not defined - panic would not intercept with driver +// If not defined - panic would not intercept with driver. func WithPanicCallback(panicCallback func(e interface{})) panicCallbackOption { return panicCallbackOption{callback: panicCallback} } @@ -229,7 +229,7 @@ func WithPanicCallback(panicCallback func(e interface{})) panicCallbackOption { // // Warning: if deadline without deadline or cancellation func Retry will be worked infinite // -// If you need to retry your op func on some logic errors - you must return RetryableError() from retryOperation +// If you need to retry your op func on some logic errors - you must return RetryableError() from retryOperation. func Retry(ctx context.Context, op retryOperation, opts ...Option) (finalErr error) { options := &retryOptions{ call: stack.FunctionID(""), diff --git a/retry/retryable_error.go b/retry/retryable_error.go index e0778c1df..9198c5449 100644 --- a/retry/retryable_error.go +++ b/retry/retryable_error.go @@ -13,18 +13,18 @@ const ( TypeSlowBackoff = backoff.TypeSlow ) -// WithBackoff makes retryable error option with custom backoff type +// WithBackoff makes retryable error option with custom backoff type. func WithBackoff(t backoff.Type) retryableErrorOption { return retryableErrorOption(xerrors.WithBackoff(t)) } -// WithDeleteSession makes retryable error option with delete session flag +// WithDeleteSession makes retryable error option with delete session flag. func WithDeleteSession() retryableErrorOption { return retryableErrorOption(xerrors.WithDeleteSession()) } // RetryableError makes retryable error from options -// RetryableError provides retrying on custom errors +// RetryableError provides retrying on custom errors. func RetryableError(err error, opts ...retryableErrorOption) error { return xerrors.Retryable( err, diff --git a/retry/sql.go b/retry/sql.go index 115b685ad..242e89e17 100644 --- a/retry/sql.go +++ b/retry/sql.go @@ -15,7 +15,7 @@ type doOptions struct { retryOptions []Option } -// doTxOption defines option for redefine default Retry behavior +// doTxOption defines option for redefine default Retry behavior. type doOption interface { ApplyDoOption(opts *doOptions) } @@ -32,12 +32,12 @@ func (retryOptions doRetryOptionsOption) ApplyDoOption(opts *doOptions) { } // WithDoRetryOptions specified retry options -// Deprecated: use implicit options instead +// Deprecated: use implicit options instead. func WithDoRetryOptions(opts ...Option) doRetryOptionsOption { return opts } -// Do is a retryer of database/sql Conn with fallbacks on errors +// Do is a retryer of database/sql Conn with fallbacks on errors. func Do(ctx context.Context, db *sql.DB, op func(ctx context.Context, cc *sql.Conn) error, opts ...doOption) error { var ( options = doOptions{ @@ -88,7 +88,7 @@ type doTxOptions struct { retryOptions []Option } -// doTxOption defines option for redefine default Retry behavior +// doTxOption defines option for redefine default Retry behavior. type doTxOption interface { ApplyDoTxOption(o *doTxOptions) } @@ -102,7 +102,7 @@ func (doTxRetryOptions doTxRetryOptionsOption) ApplyDoTxOption(o *doTxOptions) { } // WithDoTxRetryOptions specified retry options -// Deprecated: use implicit options instead +// Deprecated: use implicit options instead. func WithDoTxRetryOptions(opts ...Option) doTxRetryOptionsOption { return opts } @@ -117,14 +117,14 @@ func (txOptions txOptionsOption) ApplyDoTxOption(o *doTxOptions) { o.txOptions = txOptions.txOptions } -// WithTxOptions specified transaction options +// WithTxOptions specified transaction options. func WithTxOptions(txOptions *sql.TxOptions) txOptionsOption { return txOptionsOption{ txOptions: txOptions, } } -// DoTx is a retryer of database/sql transactions with fallbacks on errors +// DoTx is a retryer of database/sql transactions with fallbacks on errors. func DoTx(ctx context.Context, db *sql.DB, op func(context.Context, *sql.Tx) error, opts ...doTxOption) error { var ( options = doTxOptions{ diff --git a/sugar/certificates.go b/sugar/certificates.go index 5ab386c34..fecb75673 100644 --- a/sugar/certificates.go +++ b/sugar/certificates.go @@ -9,7 +9,7 @@ import ( "github.com/ydb-platform/ydb-go-sdk/v3/internal/xerrors" ) -// LoadCertificatesFromFile read and parse caFile and returns certificates +// LoadCertificatesFromFile read and parse caFile and returns certificates. func LoadCertificatesFromFile(caFile string) ([]*x509.Certificate, error) { bytes, err := os.ReadFile(filepath.Clean(caFile)) if err != nil { @@ -19,7 +19,7 @@ func LoadCertificatesFromFile(caFile string) ([]*x509.Certificate, error) { return LoadCertificatesFromPem(bytes), nil } -// LoadCertificatesFromPem parse bytes and returns certificates +// LoadCertificatesFromPem parse bytes and returns certificates. func LoadCertificatesFromPem(bytes []byte) (certs []*x509.Certificate) { var ( cert *x509.Certificate diff --git a/sugar/dsn.go b/sugar/dsn.go index b94e5fc57..e30752ec9 100644 --- a/sugar/dsn.go +++ b/sugar/dsn.go @@ -8,7 +8,7 @@ import "net/url" // sugar.DSN("endpoint", "database", false), // ) -// DSN makes connection string (data source name) by endpoint, database and secure +// DSN makes connection string (data source name) by endpoint, database and secure. func DSN(endpoint, database string, secure bool) (s string) { qp := url.Values{} diff --git a/sugar/params.go b/sugar/params.go index 612268260..1d8b9a63f 100644 --- a/sugar/params.go +++ b/sugar/params.go @@ -18,7 +18,7 @@ type constraint interface { // GenerateDeclareSection generates DECLARE section text in YQL query by params // -// Deprecated: use testutil.QueryBind(ydb.WithAutoDeclare()) helper +// Deprecated: use testutil.QueryBind(ydb.WithAutoDeclare()) helper. func GenerateDeclareSection[T constraint](parameters T) (string, error) { switch v := any(parameters).(type) { case *params.Parameters: @@ -36,7 +36,7 @@ func GenerateDeclareSection[T constraint](parameters T) (string, error) { // ToYdbParam converts // -// Deprecated: use testutil/QueryBind helper +// Deprecated: use testutil/QueryBind helper. func ToYdbParam(param sql.NamedArg) (*params.Parameter, error) { params, err := bind.Params(param) if err != nil { diff --git a/sugar/path.go b/sugar/path.go index cc22e15aa..83fbc2d02 100644 --- a/sugar/path.go +++ b/sugar/path.go @@ -47,7 +47,7 @@ type dbFoRemoveRecursive interface { // MakeRecursive creates path inside database // pathToCreate is a database root relative path // MakeRecursive method equal bash command `mkdir -p ~/path/to/create` -// where `~` - is a root of database +// where `~` - is a root of database. func MakeRecursive(ctx context.Context, db dbForMakeRecursive, pathToCreate string) error { if strings.HasPrefix(pathToCreate, sysDirectory+"/") { return xerrors.WithStackTrace( @@ -88,7 +88,7 @@ func MakeRecursive(ctx context.Context, db dbForMakeRecursive, pathToCreate stri // All database entities in prefix path will remove if names list is empty. // Empty prefix means than use root of database. // RemoveRecursive method equal bash command `rm -rf ~/path/to/remove` -// where `~` - is a root of database +// where `~` - is a root of database. func RemoveRecursive(ctx context.Context, db dbFoRemoveRecursive, pathToRemove string) error { fullSysTablePath := path.Join(db.Name(), sysDirectory) var rmPath func(int, string) error diff --git a/table/options/options.go b/table/options/options.go index c44d049f0..0aa1cd32a 100644 --- a/table/options/options.go +++ b/table/options/options.go @@ -113,7 +113,7 @@ func (settings timeToLiveSettings) ApplyCreateTableOption(d *CreateTableDesc, a d.TtlSettings = (*TimeToLiveSettings)(&settings).ToYDB() } -// WithTimeToLiveSettings defines TTL settings in CreateTable request +// WithTimeToLiveSettings defines TTL settings in CreateTable request. func WithTimeToLiveSettings(settings TimeToLiveSettings) CreateTableOption { return timeToLiveSettings(settings) } @@ -514,7 +514,7 @@ func WithPartitioningPolicyMode(mode PartitioningMode) PartitioningPolicyOption } } -// Deprecated: use WithUniformPartitions instead +// Deprecated: use WithUniformPartitions instead. func WithPartitioningPolicyUniformPartitions(n uint64) PartitioningPolicyOption { return func(p *partitioningPolicy, a *allocator.Allocator) { p.Partitions = &Ydb_Table.PartitioningPolicy_UniformPartitions{ @@ -523,7 +523,7 @@ func WithPartitioningPolicyUniformPartitions(n uint64) PartitioningPolicyOption } } -// Deprecated: use WithExplicitPartitions instead +// Deprecated: use WithExplicitPartitions instead. func WithPartitioningPolicyExplicitPartitions(splitPoints ...value.Value) PartitioningPolicyOption { return func(p *partitioningPolicy, a *allocator.Allocator) { values := make([]*Ydb.TypedValue, len(splitPoints)) @@ -697,7 +697,7 @@ type ( } ) -// WithAddColumn adds column in AlterTable request +// WithAddColumn adds column in AlterTable request. func WithAddColumn(name string, typ types.Type) AlterTableOption { return column{ name: name, @@ -705,7 +705,7 @@ func WithAddColumn(name string, typ types.Type) AlterTableOption { } } -// WithAlterAttribute changes attribute in AlterTable request +// WithAlterAttribute changes attribute in AlterTable request. func WithAlterAttribute(key, value string) AlterTableOption { return attribute{ key: key, @@ -713,7 +713,7 @@ func WithAlterAttribute(key, value string) AlterTableOption { } } -// WithAddAttribute adds attribute to table in AlterTable request +// WithAddAttribute adds attribute to table in AlterTable request. func WithAddAttribute(key, value string) AlterTableOption { return attribute{ key: key, @@ -721,7 +721,7 @@ func WithAddAttribute(key, value string) AlterTableOption { } } -// WithDropAttribute drops attribute from table in AlterTable request +// WithDropAttribute drops attribute from table in AlterTable request. func WithDropAttribute(key string) AlterTableOption { return attribute{ key: key, @@ -766,7 +766,7 @@ func WithAlterPartitionSettingsObject(ps PartitioningSettings) AlterTableOption return partitioningSettingsObject(ps) } -// WithSetTimeToLiveSettings appends TTL settings in AlterTable request +// WithSetTimeToLiveSettings appends TTL settings in AlterTable request. func WithSetTimeToLiveSettings(settings TimeToLiveSettings) AlterTableOption { return timeToLiveSettings(settings) } @@ -777,7 +777,7 @@ func (dropTimeToLive) ApplyAlterTableOption(d *AlterTableDesc, a *allocator.Allo d.TtlAction = &Ydb_Table.AlterTableRequest_DropTtlSettings{} } -// WithDropTimeToLive drops TTL settings in AlterTable request +// WithDropTimeToLive drops TTL settings in AlterTable request. func WithDropTimeToLive() AlterTableOption { return dropTimeToLive{} } @@ -839,7 +839,7 @@ type ( // WithKeepInCache manages keep-in-cache flag in query cache policy // -// By default all data queries executes with keep-in-cache policy +// By default all data queries executes with keep-in-cache policy. func WithKeepInCache(keepInCache bool) ExecuteDataQueryOption { return withQueryCachePolicy( withQueryCachePolicyKeepInCache(keepInCache), @@ -862,12 +862,12 @@ func (opts withCallOptions) ApplyExecuteDataQueryOption( return opts } -// WithCallOptions appends flag of commit transaction with executing query +// WithCallOptions appends flag of commit transaction with executing query. func WithCallOptions(opts ...grpc.CallOption) withCallOptions { return opts } -// WithCommit appends flag of commit transaction with executing query +// WithCommit appends flag of commit transaction with executing query. func WithCommit() ExecuteDataQueryOption { return executeDataQueryOptionFunc(func(desc *ExecuteDataQueryDesc, a *allocator.Allocator) []grpc.CallOption { desc.TxControl.CommitTx = true @@ -876,7 +876,7 @@ func WithCommit() ExecuteDataQueryOption { }) } -// WithIgnoreTruncated mark truncated result as good (without error) +// WithIgnoreTruncated mark truncated result as good (without error). func WithIgnoreTruncated() ExecuteDataQueryOption { return executeDataQueryOptionFunc(func(desc *ExecuteDataQueryDesc, a *allocator.Allocator) []grpc.CallOption { desc.IgnoreTruncated = true @@ -888,7 +888,7 @@ func WithIgnoreTruncated() ExecuteDataQueryOption { // WithQueryCachePolicyKeepInCache manages keep-in-cache policy // // Deprecated: data queries always executes with enabled keep-in-cache policy. -// Use WithKeepInCache for disabling keep-in-cache policy +// Use WithKeepInCache for disabling keep-in-cache policy. func WithQueryCachePolicyKeepInCache() QueryCachePolicyOption { return withQueryCachePolicyKeepInCache(true) } @@ -901,7 +901,7 @@ func withQueryCachePolicyKeepInCache(keepInCache bool) QueryCachePolicyOption { // WithQueryCachePolicy manages query cache policy // -// Deprecated: use WithKeepInCache for disabling keep-in-cache policy +// Deprecated: use WithKeepInCache for disabling keep-in-cache policy. func WithQueryCachePolicy(opts ...QueryCachePolicyOption) ExecuteDataQueryOption { return withQueryCachePolicy(opts...) } @@ -970,7 +970,7 @@ func (f executeScanQueryOptionFunc) ApplyExecuteScanQueryOption(d *ExecuteScanQu var _ ExecuteScanQueryOption = executeScanQueryOptionFunc(nil) -// WithExecuteScanQueryMode defines scan query mode: execute or explain +// WithExecuteScanQueryMode defines scan query mode: execute or explain. func WithExecuteScanQueryMode(m ExecuteScanQueryRequestMode) ExecuteScanQueryOption { return executeScanQueryOptionFunc(func(desc *ExecuteScanQueryDesc) []grpc.CallOption { desc.Mode = m.toYDB() @@ -979,7 +979,7 @@ func WithExecuteScanQueryMode(m ExecuteScanQueryRequestMode) ExecuteScanQueryOpt }) } -// ExecuteScanQueryStatsType specified scan query mode +// ExecuteScanQueryStatsType specified scan query mode. type ExecuteScanQueryStatsType uint32 const ( @@ -1001,7 +1001,7 @@ func (stats ExecuteScanQueryStatsType) toYDB() Ydb_Table.QueryStatsCollection_Mo } } -// WithExecuteScanQueryStats defines query statistics mode +// WithExecuteScanQueryStats defines query statistics mode. func WithExecuteScanQueryStats(stats ExecuteScanQueryStatsType) ExecuteScanQueryOption { return executeScanQueryOptionFunc(func(desc *ExecuteScanQueryDesc) []grpc.CallOption { desc.CollectStats = stats.toYDB() diff --git a/table/result/named/named.go b/table/result/named/named.go index 2d7295a3a..579f5fd64 100644 --- a/table/result/named/named.go +++ b/table/result/named/named.go @@ -19,7 +19,7 @@ type Value struct { // // # If column value is NULL, then ScanNamed will write a nil into destination // -// Warning: value must double-pointed data destination +// Warning: value must double-pointed data destination. func Optional(columnName string, destination interface{}) Value { if columnName == "" { panic("columnName must be not empty") @@ -34,7 +34,7 @@ func Optional(columnName string, destination interface{}) Value { // Required makes an object with destination address for column value with name columnName // -// Warning: value must single-pointed data destination +// Warning: value must single-pointed data destination. func Required(columnName string, destinationValueReference interface{}) Value { if columnName == "" { panic("columnName must be not empty") @@ -50,7 +50,7 @@ func Required(columnName string, destinationValueReference interface{}) Value { // OptionalWithDefault makes an object with destination address for column value with name columnName // // If scanned YDB value is NULL - default type value will be applied to value destination -// Warning: value must single-pointed data destination +// Warning: value must single-pointed data destination. func OptionalWithDefault(columnName string, destinationValueReference interface{}) Value { if columnName == "" { panic("columnName must be not empty") diff --git a/table/table.go b/table/table.go index 83f915ddb..120c28958 100644 --- a/table/table.go +++ b/table/table.go @@ -18,12 +18,12 @@ import ( // Operation is the interface that holds an operation for retry. // if Operation returns not nil - operation will retry -// if Operation returns nil - retry loop will break +// if Operation returns nil - retry loop will break. type Operation func(ctx context.Context, s Session) error // TxOperation is the interface that holds an operation for retry. // if TxOperation returns not nil - operation will retry -// if TxOperation returns nil - retry loop will break +// if TxOperation returns nil - retry loop will break. type TxOperation func(ctx context.Context, tx TransactionActor) error type ClosableSession interface { @@ -223,7 +223,7 @@ type DataQueryExplanation struct { AST string } -// DataQuery only for tracers +// DataQuery only for tracers. type DataQuery interface { String() string ID() string @@ -286,13 +286,13 @@ var ( } ) -// Transaction control options +// Transaction control options. type ( txDesc Ydb_Table.TransactionSettings TxOption func(*txDesc) ) -// TxSettings returns transaction settings +// TxSettings returns transaction settings. func TxSettings(opts ...TxOption) *TransactionSettings { s := new(TransactionSettings) for _, opt := range opts { @@ -304,7 +304,7 @@ func TxSettings(opts ...TxOption) *TransactionSettings { return s } -// BeginTx returns begin transaction control option +// BeginTx returns begin transaction control option. func BeginTx(opts ...TxOption) TxControlOption { return func(d *txControlDesc) { s := TxSettings(opts...) @@ -330,7 +330,7 @@ func WithTxID(txID string) TxControlOption { } } -// CommitTx returns commit transaction control option +// CommitTx returns commit transaction control option. func CommitTx() TxControlOption { return func(d *txControlDesc) { d.CommitTx = true @@ -397,7 +397,7 @@ func (t *TransactionControl) Desc() *Ydb_Table.TransactionControl { return &t.desc } -// TxControl makes transaction control from given options +// TxControl makes transaction control from given options. func TxControl(opts ...TxControlOption) *TransactionControl { c := new(TransactionControl) for _, opt := range opts { @@ -409,7 +409,7 @@ func TxControl(opts ...TxControlOption) *TransactionControl { return c } -// DefaultTxControl returns default transaction control with serializable read-write isolation mode and auto-commit +// DefaultTxControl returns default transaction control with serializable read-write isolation mode and auto-commit. func DefaultTxControl() *TransactionControl { return TxControl( BeginTx(WithSerializableReadWrite()), @@ -417,7 +417,7 @@ func DefaultTxControl() *TransactionControl { ) } -// SerializableReadWriteTxControl returns transaction control with serializable read-write isolation mode +// SerializableReadWriteTxControl returns transaction control with serializable read-write isolation mode. func SerializableReadWriteTxControl(opts ...TxControlOption) *TransactionControl { return TxControl( append([]TxControlOption{ @@ -426,7 +426,7 @@ func SerializableReadWriteTxControl(opts ...TxControlOption) *TransactionControl ) } -// OnlineReadOnlyTxControl returns online read-only transaction control +// OnlineReadOnlyTxControl returns online read-only transaction control. func OnlineReadOnlyTxControl(opts ...TxOnlineReadOnlyOption) *TransactionControl { return TxControl( BeginTx(WithOnlineReadOnly(opts...)), @@ -434,7 +434,7 @@ func OnlineReadOnlyTxControl(opts ...TxOnlineReadOnlyOption) *TransactionControl ) } -// StaleReadOnlyTxControl returns stale read-only transaction control +// StaleReadOnlyTxControl returns stale read-only transaction control. func StaleReadOnlyTxControl() *TransactionControl { return TxControl( BeginTx(WithStaleReadOnly()), @@ -442,7 +442,7 @@ func StaleReadOnlyTxControl() *TransactionControl { ) } -// SnapshotReadOnlyTxControl returns snapshot read-only transaction control +// SnapshotReadOnlyTxControl returns snapshot read-only transaction control. func SnapshotReadOnlyTxControl() *TransactionControl { return TxControl( BeginTx(WithSnapshotReadOnly()), @@ -450,7 +450,7 @@ func SnapshotReadOnlyTxControl() *TransactionControl { ) } -// QueryParameters +// QueryParameters. type ( ParameterOption = params.NamedValue QueryParameters = params.Parameters diff --git a/table/types/cast.go b/table/types/cast.go index 71d8476ea..efb119bba 100644 --- a/table/types/cast.go +++ b/table/types/cast.go @@ -10,7 +10,7 @@ import ( var errNilValue = errors.New("nil value") -// CastTo try cast value to destination type value +// CastTo try cast value to destination type value. func CastTo(v Value, dst interface{}) error { if v == nil { return xerrors.WithStackTrace(errNilValue) @@ -31,7 +31,7 @@ func IsOptional(t Type) (isOptional bool, innerType Type) { return false, nil } -// ToDecimal returns Decimal struct from abstract Value +// ToDecimal returns Decimal struct from abstract Value. func ToDecimal(v Value) (*Decimal, error) { if valuer, isDecimalValuer := v.(value.DecimalValuer); isDecimalValuer { return &Decimal{ @@ -44,7 +44,7 @@ func ToDecimal(v Value) (*Decimal, error) { return nil, xerrors.WithStackTrace(fmt.Errorf("value type '%s' is not decimal type", v.Type().Yql())) } -// ListItems returns list items from abstract Value +// ListItems returns list items from abstract Value. func ListItems(v Value) ([]Value, error) { if vv, has := v.(interface { ListItems() []Value @@ -55,7 +55,7 @@ func ListItems(v Value) ([]Value, error) { return nil, xerrors.WithStackTrace(fmt.Errorf("cannot get list items from '%s'", v.Type().Yql())) } -// TupleItems returns tuple items from abstract Value +// TupleItems returns tuple items from abstract Value. func TupleItems(v Value) ([]Value, error) { if vv, has := v.(interface { TupleItems() []Value @@ -66,7 +66,7 @@ func TupleItems(v Value) ([]Value, error) { return nil, xerrors.WithStackTrace(fmt.Errorf("cannot get tuple items from '%s'", v.Type().Yql())) } -// StructFields returns struct fields from abstract Value +// StructFields returns struct fields from abstract Value. func StructFields(v Value) (map[string]Value, error) { if vv, has := v.(interface { StructFields() map[string]Value @@ -77,7 +77,7 @@ func StructFields(v Value) (map[string]Value, error) { return nil, xerrors.WithStackTrace(fmt.Errorf("cannot get struct fields from '%s'", v.Type().Yql())) } -// VariantValue returns variant value from abstract Value +// VariantValue returns variant value from abstract Value. func VariantValue(v Value) (name string, idx uint32, _ Value, _ error) { if vv, has := v.(interface { Variant() (name string, index uint32) @@ -93,12 +93,12 @@ func VariantValue(v Value) (name string, idx uint32, _ Value, _ error) { // DictFields returns dict values from abstract Value // -// Deprecated: use DictValues instead +// Deprecated: use DictValues instead. func DictFields(v Value) (map[Value]Value, error) { return DictValues(v) } -// DictValues returns dict values from abstract Value +// DictValues returns dict values from abstract Value. func DictValues(v Value) (map[Value]Value, error) { if vv, has := v.(interface { DictValues() map[Value]Value diff --git a/table/types/types.go b/table/types/types.go index cca6b5c09..11b6338b7 100644 --- a/table/types/types.go +++ b/table/types/types.go @@ -10,7 +10,7 @@ import ( // Type describes YDB data types. type Type = types.Type -// Equal checks for type equivalence +// Equal checks for type equivalence. func Equal(lhs, rhs Type) bool { return types.Equal(lhs, rhs) } @@ -120,7 +120,7 @@ const ( // WriteTypeStringTo writes ydb type string representation into buffer // -// Deprecated: use types.Type.Yql() instead +// Deprecated: use types.Type.Yql() instead. func WriteTypeStringTo(buf *bytes.Buffer, t Type) { //nolint: interfacer buf.WriteString(t.Yql()) } diff --git a/table/types/value.go b/table/types/value.go index 9249c4e3c..8ac5569ab 100644 --- a/table/types/value.go +++ b/table/types/value.go @@ -33,36 +33,36 @@ func FloatValue(v float32) Value { return value.FloatValue(v) } func DoubleValue(v float64) Value { return value.DoubleValue(v) } -// DateValue returns ydb date value by given days since Epoch +// DateValue returns ydb date value by given days since Epoch. func DateValue(v uint32) Value { return value.DateValue(v) } -// DatetimeValue makes ydb datetime value from seconds since Epoch +// DatetimeValue makes ydb datetime value from seconds since Epoch. func DatetimeValue(v uint32) Value { return value.DatetimeValue(v) } -// TimestampValue makes ydb timestamp value from microseconds since Epoch +// TimestampValue makes ydb timestamp value from microseconds since Epoch. func TimestampValue(v uint64) Value { return value.TimestampValue(v) } -// IntervalValueFromMicroseconds makes Value from given microseconds value +// IntervalValueFromMicroseconds makes Value from given microseconds value. func IntervalValueFromMicroseconds(v int64) Value { return value.IntervalValue(v) } // IntervalValue makes Value from given microseconds value // -// Deprecated: use IntervalValueFromMicroseconds instead +// Deprecated: use IntervalValueFromMicroseconds instead. func IntervalValue(v int64) Value { return value.IntervalValue(v) } -// TzDateValue makes TzDate value from string +// TzDateValue makes TzDate value from string. func TzDateValue(v string) Value { return value.TzDateValue(v) } -// TzDatetimeValue makes TzDatetime value from string +// TzDatetimeValue makes TzDatetime value from string. func TzDatetimeValue(v string) Value { return value.TzDatetimeValue(v) } -// TzTimestampValue makes TzTimestamp value from string +// TzTimestampValue makes TzTimestamp value from string. func TzTimestampValue(v string) Value { return value.TzTimestampValue(v) } // DateValueFromTime makes Date value from time.Time // // Warning: all *From* helpers will be removed at next major release -// (functional will be implements with go1.18 type lists) +// (functional will be implements with go1.18 type lists). func DateValueFromTime(t time.Time) Value { return value.DateValueFromTime(t) } @@ -70,7 +70,7 @@ func DateValueFromTime(t time.Time) Value { // DatetimeValueFromTime makes Datetime value from time.Time // // Warning: all *From* helpers will be removed at next major release -// (functional will be implements with go1.18 type lists) +// (functional will be implements with go1.18 type lists). func DatetimeValueFromTime(t time.Time) Value { return value.DatetimeValueFromTime(t) } @@ -78,7 +78,7 @@ func DatetimeValueFromTime(t time.Time) Value { // TimestampValueFromTime makes Timestamp value from time.Time // // Warning: all *From* helpers will be removed at next major release -// (functional will be implements with go1.18 type lists) +// (functional will be implements with go1.18 type lists). func TimestampValueFromTime(t time.Time) Value { return value.TimestampValueFromTime(t) } @@ -86,7 +86,7 @@ func TimestampValueFromTime(t time.Time) Value { // IntervalValueFromDuration makes Interval value from time.Duration // // Warning: all *From* helpers will be removed at next major release -// (functional will be implements with go1.18 type lists) +// (functional will be implements with go1.18 type lists). func IntervalValueFromDuration(v time.Duration) Value { return value.IntervalValueFromDuration(v) } @@ -94,7 +94,7 @@ func IntervalValueFromDuration(v time.Duration) Value { // TzDateValueFromTime makes TzDate value from time.Time // // Warning: all *From* helpers will be removed at next major release -// (functional will be implements with go1.18 type lists) +// (functional will be implements with go1.18 type lists). func TzDateValueFromTime(t time.Time) Value { return value.TzDateValueFromTime(t) } @@ -102,7 +102,7 @@ func TzDateValueFromTime(t time.Time) Value { // TzDatetimeValueFromTime makes TzDatetime value from time.Time // // Warning: all *From* helpers will be removed at next major release -// (functional will be implements with go1.18 type lists) +// (functional will be implements with go1.18 type lists). func TzDatetimeValueFromTime(t time.Time) Value { return value.TzDatetimeValueFromTime(t) } @@ -110,14 +110,14 @@ func TzDatetimeValueFromTime(t time.Time) Value { // TzTimestampValueFromTime makes TzTimestamp value from time.Time // // Warning: all *From* helpers will be removed at next major release -// (functional will be implements with go1.18 type lists) +// (functional will be implements with go1.18 type lists). func TzTimestampValueFromTime(t time.Time) Value { return value.TzTimestampValueFromTime(t) } // StringValue returns bytes value // -// Deprecated: use BytesValue instead +// Deprecated: use BytesValue instead. func StringValue(v []byte) Value { return value.BytesValue(v) } func BytesValue(v []byte) Value { return value.BytesValue(v) } @@ -127,7 +127,7 @@ func BytesValueFromString(v string) Value { return value.BytesValue(xstring.ToBy // StringValueFromString makes String value from string // // Warning: all *From* helpers will be removed at next major release -// (functional will be implements with go1.18 type lists) +// (functional will be implements with go1.18 type lists). func StringValueFromString(v string) Value { return value.BytesValue(xstring.ToBytes(v)) } func UTF8Value(v string) Value { return value.TextValue(v) } @@ -139,7 +139,7 @@ func YSONValue(v string) Value { return value.YSONValue(xstring.ToBytes(v)) } // YSONValueFromBytes makes YSON value from bytes // // Warning: all *From* helpers will be removed at next major release -// (functional will be implements with go1.18 type lists) +// (functional will be implements with go1.18 type lists). func YSONValueFromBytes(v []byte) Value { return value.YSONValue(v) } func JSONValue(v string) Value { return value.JSONValue(v) } @@ -147,7 +147,7 @@ func JSONValue(v string) Value { return value.JSONValue(v) } // JSONValueFromBytes makes JSON value from bytes // // Warning: all *From* helpers will be removed at next major release -// (functional will be implements with go1.18 type lists) +// (functional will be implements with go1.18 type lists). func JSONValueFromBytes(v []byte) Value { return value.JSONValue(xstring.FromBytes(v)) } func UUIDValue(v [16]byte) Value { return value.UUIDValue(v) } @@ -157,7 +157,7 @@ func JSONDocumentValue(v string) Value { return value.JSONDocumentValue(v) } // JSONDocumentValueFromBytes makes JSONDocument value from bytes // // Warning: all *From* helpers will be removed at next major release -// (functional will be implements with go1.18 type lists) +// (functional will be implements with go1.18 type lists). func JSONDocumentValueFromBytes(v []byte) Value { return value.JSONDocumentValue(xstring.FromBytes(v)) } @@ -172,7 +172,7 @@ func ZeroValue(t Type) Value { return value.ZeroValue(t) } func OptionalValue(v Value) Value { return value.OptionalValue(v) } -// Decimal supported in scanner API +// Decimal supported in scanner API. type Decimal = decimal.Decimal // DecimalValue creates decimal value of given types t and value v. @@ -345,7 +345,7 @@ func NullableTzTimestampValueFromTime(v *time.Time) Value { // NullableIntervalValue makes Value which maybe nil or valued // -// Deprecated: use NullableIntervalValueFromMicroseconds instead +// Deprecated: use NullableIntervalValueFromMicroseconds instead. func NullableIntervalValue(v *int64) Value { return value.NullableIntervalValueFromMicroseconds(v) } @@ -360,7 +360,7 @@ func NullableIntervalValueFromDuration(v *time.Duration) Value { // NullableStringValue // -// Deprecated: use NullableBytesValue instead +// Deprecated: use NullableBytesValue instead. func NullableStringValue(v *[]byte) Value { return value.NullableBytesValue(v) } diff --git a/tests/integration/database_sql_containers_test.go b/tests/integration/database_sql_containers_test.go index 5e8ae71f8..9b185f33a 100644 --- a/tests/integration/database_sql_containers_test.go +++ b/tests/integration/database_sql_containers_test.go @@ -18,7 +18,7 @@ import ( ) // https://github.com/ydb-platform/ydb-go-sdk/issues/757 -// Containers example demonstrates how to work with YDB container values such as `List`, `Tuple`, `Dict`, `Struct` and `Variant` +// Containers example demonstrates how to work with YDB container values such as `List`, `Tuple`, `Dict`, `Struct` and `Variant`. func TestDatabaseSqlContainers(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() diff --git a/tests/integration/helpers_test.go b/tests/integration/helpers_test.go index 9184ad86c..35c5e821e 100644 --- a/tests/integration/helpers_test.go +++ b/tests/integration/helpers_test.go @@ -261,7 +261,7 @@ func withCreateTableQueryTemplate(createTableQueryTemplate string) func(t *table // TableName return name (without path) to example table with struct: // id Int64 NOT NULL, -// val Text +// val Text. func (scope *scopeT) TableName(opts ...func(t *tableNameParams)) string { params := tableNameParams{ tableName: "table", @@ -308,12 +308,12 @@ func (scope *scopeT) TableName(opts ...func(t *tableNameParams)) string { // TablePath return path to example table with struct: // id Int64 NOT NULL, -// val Text +// val Text. func (scope *scopeT) TablePath(opts ...func(t *tableNameParams)) string { return path.Join(scope.Folder(), scope.TableName(opts...)) } -// logger for tests +// logger for tests. type testLogger struct { test testing.TB testName string diff --git a/tests/integration/metrics_registry_test.go b/tests/integration/metrics_registry_test.go index eaa481694..e51ee1c79 100644 --- a/tests/integration/metrics_registry_test.go +++ b/tests/integration/metrics_registry_test.go @@ -82,7 +82,7 @@ func (c *counter) Value() string { return fmt.Sprintf("%d", c.value) } -// define custom counterVec +// define custom counterVec. type counterVec struct { name string labelNames []string @@ -145,7 +145,7 @@ func (t *timer) Value() string { return fmt.Sprintf("%v", t.value) } -// define custom timerVec +// define custom timerVec. type timerVec struct { name string labelNames []string @@ -233,7 +233,7 @@ func (h *histogram) Value() string { return buffer.String() } -// define custom histogramVec +// define custom histogramVec. type histogramVec struct { name string labelNames []string @@ -278,7 +278,7 @@ func (vec *histogramVec) Values() (values []string) { return values } -// define custom gaugeVec +// define custom gaugeVec. type gaugeVec struct { name string labelNames []string @@ -373,7 +373,7 @@ func (v *vec[T]) iterate(f func(element *T)) { } } -// define custom registryConfig +// define custom registryConfig. type registryConfig struct { prefix string details trace.Details diff --git a/tests/integration/table_containers_test.go b/tests/integration/table_containers_test.go index dad0e986d..3d928e9ca 100644 --- a/tests/integration/table_containers_test.go +++ b/tests/integration/table_containers_test.go @@ -15,7 +15,7 @@ import ( "github.com/ydb-platform/ydb-go-sdk/v3/table/types" ) -// Containers example demonstrates how to work with YDB container values such as `List`, `Tuple`, `Dict`, `Struct` and `Variant` +// Containers example demonstrates how to work with YDB container values such as `List`, `Tuple`, `Dict`, `Struct` and `Variant`. func TestContainers(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() diff --git a/tests/integration/table_unexpected_null_while_parse_nil_json_document_value_test.go b/tests/integration/table_unexpected_null_while_parse_nil_json_document_value_test.go index d62987e56..75a778999 100644 --- a/tests/integration/table_unexpected_null_while_parse_nil_json_document_value_test.go +++ b/tests/integration/table_unexpected_null_while_parse_nil_json_document_value_test.go @@ -17,7 +17,7 @@ import ( type issue229Struct struct{} -// UnmarshalJSON implements json.Unmarshaler +// UnmarshalJSON implements json.Unmarshaler. func (i *issue229Struct) UnmarshalJSON(_ []byte) error { return nil } diff --git a/tests/integration/topic_grpc_stopper_helper_test.go b/tests/integration/topic_grpc_stopper_helper_test.go index d9b521bed..2d1d4732a 100644 --- a/tests/integration/topic_grpc_stopper_helper_test.go +++ b/tests/integration/topic_grpc_stopper_helper_test.go @@ -25,7 +25,7 @@ import ( // // grpcStopper.Stop(errors.New("test error")) // -// ) +// ). type GrpcStopper struct { stopChannel empty.Chan stopError error diff --git a/testutil/topic.go b/testutil/topic.go index 44b3d486c..a89b64ba0 100644 --- a/testutil/topic.go +++ b/testutil/topic.go @@ -4,7 +4,7 @@ import "github.com/ydb-platform/ydb-go-sdk/v3/internal/topic/topicreaderinternal type TopicReaderMessageBuilder = topicreaderinternal.PublicMessageBuilder -// NewTopicReaderMessageBuilder create builder, which can create Message (use for tests only) +// NewTopicReaderMessageBuilder create builder, which can create Message (use for tests only). func NewTopicReaderMessageBuilder() *TopicReaderMessageBuilder { return topicreaderinternal.NewPublicMessageBuilder() } diff --git a/topic/topicoptions/topicoptions_alter.go b/topic/topicoptions/topicoptions_alter.go index 52700a7f4..71711fec6 100644 --- a/topic/topicoptions/topicoptions_alter.go +++ b/topic/topicoptions/topicoptions_alter.go @@ -8,27 +8,27 @@ import ( "github.com/ydb-platform/ydb-go-sdk/v3/topic/topictypes" ) -// AlterOption type of options for change topic settings +// AlterOption type of options for change topic settings. type AlterOption interface { ApplyAlterOption(req *rawtopic.AlterTopicRequest) } -// AlterWithMeteringMode change metering mode for topic (need for serverless installations) +// AlterWithMeteringMode change metering mode for topic (need for serverless installations). func AlterWithMeteringMode(m topictypes.MeteringMode) AlterOption { return withMeteringMode(m) } -// AlterWithMinActivePartitions change min active partitions of the topic +// AlterWithMinActivePartitions change min active partitions of the topic. func AlterWithMinActivePartitions(minActivePartitions int64) AlterOption { return withMinActivePartitions(minActivePartitions) } -// AlterWithPartitionCountLimit change partition count limit of the topic +// AlterWithPartitionCountLimit change partition count limit of the topic. func AlterWithPartitionCountLimit(partitionCountLimit int64) AlterOption { return withPartitionCountLimit(partitionCountLimit) } -// AlterWithRetentionPeriod change retention period of topic +// AlterWithRetentionPeriod change retention period of topic. func AlterWithRetentionPeriod(retentionPeriod time.Duration) AlterOption { return withRetentionPeriod(retentionPeriod) } @@ -38,7 +38,7 @@ func AlterWithRetentionStorageMB(retentionStorageMB int64) AlterOption { return withRetentionStorageMB(retentionStorageMB) } -// AlterWithSupportedCodecs change set of codec, allowed for the topic +// AlterWithSupportedCodecs change set of codec, allowed for the topic. func AlterWithSupportedCodecs(codecs ...topictypes.Codec) AlterOption { sort.Slice(codecs, func(i, j int) bool { return codecs[i] < codecs[j] @@ -47,22 +47,22 @@ func AlterWithSupportedCodecs(codecs ...topictypes.Codec) AlterOption { return withSupportedCodecs(codecs) } -// AlterWithPartitionWriteSpeedBytesPerSecond change limit of write speed for partitions of the topic +// AlterWithPartitionWriteSpeedBytesPerSecond change limit of write speed for partitions of the topic. func AlterWithPartitionWriteSpeedBytesPerSecond(bytesPerSecond int64) AlterOption { return withPartitionWriteSpeedBytesPerSecond(bytesPerSecond) } -// AlterWithPartitionWriteBurstBytes change burst size for write to partition of topic +// AlterWithPartitionWriteBurstBytes change burst size for write to partition of topic. func AlterWithPartitionWriteBurstBytes(burstBytes int64) AlterOption { return withPartitionWriteBurstBytes(burstBytes) } -// AlterWithAttributes change attributes map of topic +// AlterWithAttributes change attributes map of topic. func AlterWithAttributes(attributes map[string]string) AlterOption { return withAttributes(attributes) } -// AlterWithAddConsumers add consumer to the topic +// AlterWithAddConsumers add consumer to the topic. func AlterWithAddConsumers(consumers ...topictypes.Consumer) AlterOption { sort.Slice(consumers, func(i, j int) bool { return consumers[i].Name < consumers[j].Name @@ -71,14 +71,14 @@ func AlterWithAddConsumers(consumers ...topictypes.Consumer) AlterOption { return withAddConsumers(consumers) } -// AlterWithDropConsumers drop consumer from the topic +// AlterWithDropConsumers drop consumer from the topic. func AlterWithDropConsumers(consumersName ...string) AlterOption { sort.Strings(consumersName) return withDropConsumers(consumersName) } -// AlterConsumerWithImportant set/remove important flag for the consumer of topic +// AlterConsumerWithImportant set/remove important flag for the consumer of topic. func AlterConsumerWithImportant(name string, important bool) AlterOption { return withConsumerWithImportant{ name: name, @@ -86,7 +86,7 @@ func AlterConsumerWithImportant(name string, important bool) AlterOption { } } -// AlterConsumerWithReadFrom change min time of messages, received for the topic +// AlterConsumerWithReadFrom change min time of messages, received for the topic. func AlterConsumerWithReadFrom(name string, readFrom time.Time) AlterOption { return withConsumerWithReadFrom{ name: name, @@ -94,7 +94,7 @@ func AlterConsumerWithReadFrom(name string, readFrom time.Time) AlterOption { } } -// AlterConsumerWithSupportedCodecs change codecs, supported by the consumer +// AlterConsumerWithSupportedCodecs change codecs, supported by the consumer. func AlterConsumerWithSupportedCodecs(name string, codecs []topictypes.Codec) AlterOption { sort.Slice(codecs, func(i, j int) bool { return codecs[i] < codecs[j] @@ -106,7 +106,7 @@ func AlterConsumerWithSupportedCodecs(name string, codecs []topictypes.Codec) Al } } -// AlterConsumerWithAttributes change attributes of the consumer +// AlterConsumerWithAttributes change attributes of the consumer. func AlterConsumerWithAttributes(name string, attributes map[string]string) AlterOption { return withConsumerWithAttributes{ name: name, diff --git a/topic/topicoptions/topicoptions_create.go b/topic/topicoptions/topicoptions_create.go index 6fa1cb4dc..d7211706e 100644 --- a/topic/topicoptions/topicoptions_create.go +++ b/topic/topicoptions/topicoptions_create.go @@ -8,22 +8,22 @@ import ( "github.com/ydb-platform/ydb-go-sdk/v3/topic/topictypes" ) -// CreateOption type for options of topic create +// CreateOption type for options of topic create. type CreateOption interface { ApplyCreateOption(request *rawtopic.CreateTopicRequest) } -// CreateWithMeteringMode set metering mode for the topic +// CreateWithMeteringMode set metering mode for the topic. func CreateWithMeteringMode(mode topictypes.MeteringMode) CreateOption { return withMeteringMode(mode) } -// CreateWithMinActivePartitions set min active partitions for the topic +// CreateWithMinActivePartitions set min active partitions for the topic. func CreateWithMinActivePartitions(count int64) CreateOption { return withMinActivePartitions(count) } -// CreateWithPartitionCountLimit set partition count limit for the topic +// CreateWithPartitionCountLimit set partition count limit for the topic. func CreateWithPartitionCountLimit(count int64) CreateOption { return withPartitionCountLimit(count) } @@ -38,7 +38,7 @@ func CreateWithRetentionStorageMB(retentionStorageMB int64) CreateOption { return withRetentionStorageMB(retentionStorageMB) } -// CreateWithSupportedCodecs set supported codecs for the topic +// CreateWithSupportedCodecs set supported codecs for the topic. func CreateWithSupportedCodecs(codecs ...topictypes.Codec) CreateOption { sort.Slice(codecs, func(i, j int) bool { return codecs[i] < codecs[j] @@ -47,12 +47,12 @@ func CreateWithSupportedCodecs(codecs ...topictypes.Codec) CreateOption { return withSupportedCodecs(codecs) } -// CreateWithPartitionWriteSpeedBytesPerSecond set write size limit for partitions of the topic +// CreateWithPartitionWriteSpeedBytesPerSecond set write size limit for partitions of the topic. func CreateWithPartitionWriteSpeedBytesPerSecond(partitionWriteSpeedBytesPerSecond int64) CreateOption { return withPartitionWriteSpeedBytesPerSecond(partitionWriteSpeedBytesPerSecond) } -// CreateWithPartitionWriteBurstBytes set burst limit for partitions of the topic +// CreateWithPartitionWriteBurstBytes set burst limit for partitions of the topic. func CreateWithPartitionWriteBurstBytes(partitionWriteBurstBytes int64) CreateOption { return withPartitionWriteBurstBytes(partitionWriteBurstBytes) } @@ -62,7 +62,7 @@ func CreateWithAttributes(attributes map[string]string) CreateOption { return withAttributes(attributes) } -// CreateWithConsumer create new consumers with the topic +// CreateWithConsumer create new consumers with the topic. func CreateWithConsumer(consumers ...topictypes.Consumer) CreateOption { sort.Slice(consumers, func(i, j int) bool { return consumers[i].Name < consumers[j].Name diff --git a/topic/topicoptions/topicoptions_reader.go b/topic/topicoptions/topicoptions_reader.go index 549211688..aa60858bd 100644 --- a/topic/topicoptions/topicoptions_reader.go +++ b/topic/topicoptions/topicoptions_reader.go @@ -13,7 +13,7 @@ import ( // ReadSelector set rules for reader: set of topic, partitions, start time filted, etc. type ReadSelector = topicreaderinternal.PublicReadSelector -// ReadSelectors slice of rules for topic reader +// ReadSelectors slice of rules for topic reader. type ReadSelectors []ReadSelector // ReadTopic create simple selector for read topics, if no need special settings. @@ -21,7 +21,7 @@ func ReadTopic(path string) ReadSelectors { return ReadSelectors{{Path: path}} } -// ReaderOption options for topic reader +// ReaderOption options for topic reader. type ReaderOption = topicreaderinternal.PublicReaderOption // WithReaderOperationTimeout @@ -49,7 +49,7 @@ func WithReaderStartTimeout(timeout time.Duration) ReaderOption { // WithReaderCheckRetryErrorFunction can override default error retry policy // use CheckErrorRetryDecisionDefault for use default behavior for the error // callback func must be fast and deterministic: always result same result for same error - it can be called -// few times for every error +// few times for every error. func WithReaderCheckRetryErrorFunction(callback CheckErrorRetryFunction) ReaderOption { return func(cfg *topicreaderinternal.ReaderConfig) { cfg.RetrySettings.CheckError = callback @@ -80,7 +80,7 @@ func WithCommonConfig(common config.Common) ReaderOption { // WithCommitTimeLagTrigger // Deprecated: (was experimental) will be removed soon. -// Use WithReaderCommitTimeLagTrigger instead +// Use WithReaderCommitTimeLagTrigger instead. func WithCommitTimeLagTrigger(lag time.Duration) ReaderOption { return WithReaderCommitTimeLagTrigger(lag) } @@ -88,7 +88,7 @@ func WithCommitTimeLagTrigger(lag time.Duration) ReaderOption { // WithReaderCommitTimeLagTrigger set time lag from first commit message before send commit to server // for accumulate many similar-time commits to one server request // 0 mean no additional lag and send commit soon as possible -// Default value: 1 second +// Default value: 1 second. func WithReaderCommitTimeLagTrigger(lag time.Duration) ReaderOption { return func(cfg *topicreaderinternal.ReaderConfig) { cfg.CommitterBatchTimeLag = lag @@ -97,14 +97,14 @@ func WithReaderCommitTimeLagTrigger(lag time.Duration) ReaderOption { // WithCommitCountTrigger // Deprecated: (was experimental) will be removed soon. -// Use WithReaderCommitCountTrigger instead +// Use WithReaderCommitCountTrigger instead. func WithCommitCountTrigger(count int) ReaderOption { return WithReaderCommitCountTrigger(count) } // WithReaderCommitCountTrigger set count trigger for send batch to server // if count > 0 and sdk count of buffered commits >= count - send commit request to server -// 0 mean no count limit and use timer lag trigger only +// 0 mean no count limit and use timer lag trigger only. func WithReaderCommitCountTrigger(count int) ReaderOption { return func(cfg *topicreaderinternal.ReaderConfig) { cfg.CommitterBatchCounterTrigger = count @@ -117,7 +117,7 @@ func WithReaderCommitCountTrigger(count int) ReaderOption { // // Deprecated: (was experimental) the method will be removed soon. // -// The option will be removed for simplify code internals +// The option will be removed for simplify code internals. func WithBatchReadMinCount(count int) ReaderOption { return func(cfg *topicreaderinternal.ReaderConfig) { cfg.DefaultBatchConfig.MinCount = count @@ -133,7 +133,7 @@ func WithBatchReadMaxCount(count int) ReaderOption { } } -// WithReaderBatchMaxCount set max messages count, returned by topic.TopicReader.ReadBatch method +// WithReaderBatchMaxCount set max messages count, returned by topic.TopicReader.ReadBatch method. func WithReaderBatchMaxCount(count int) ReaderOption { return func(cfg *topicreaderinternal.ReaderConfig) { cfg.DefaultBatchConfig.MaxCount = count @@ -154,7 +154,7 @@ func WithReaderBufferSizeBytes(size int) ReaderOption { } } -// CreateDecoderFunc interface for fabric of message decoders +// CreateDecoderFunc interface for fabric of message decoders. type CreateDecoderFunc = topicreaderinternal.PublicCreateDecoderFunc // WithAddDecoder add decoder for a codec. @@ -165,15 +165,15 @@ func WithAddDecoder(codec topictypes.Codec, decoderCreate CreateDecoderFunc) Rea } } -// CommitMode variants of commit mode of the reader +// CommitMode variants of commit mode of the reader. type CommitMode = topicreaderinternal.PublicCommitMode const ( // CommitModeAsync - commit return true if commit success add to internal send buffer (but not sent to server) - // now it is grpc buffer, in feature it may be internal sdk buffer + // now it is grpc buffer, in feature it may be internal sdk buffer. CommitModeAsync = topicreaderinternal.CommitModeAsync // default - // CommitModeNone - reader will not be commit operation + // CommitModeNone - reader will not be commit operation. CommitModeNone = topicreaderinternal.CommitModeNone // CommitModeSync - commit return true when sdk receive ack of commit from server @@ -197,7 +197,7 @@ func WithCommitMode(mode CommitMode) ReaderOption { return WithReaderCommitMode(mode) } -// WithReaderCommitMode set commit mode to the reader +// WithReaderCommitMode set commit mode to the reader. func WithReaderCommitMode(mode CommitMode) ReaderOption { return func(cfg *topicreaderinternal.ReaderConfig) { cfg.CommitMode = mode @@ -209,22 +209,22 @@ type ( // at own side. It can call multiply times in parallel. GetPartitionStartOffsetFunc = topicreaderinternal.PublicGetPartitionStartOffsetFunc - // GetPartitionStartOffsetRequest info about the partition + // GetPartitionStartOffsetRequest info about the partition. GetPartitionStartOffsetRequest = topicreaderinternal.PublicGetPartitionStartOffsetRequest - // GetPartitionStartOffsetResponse optional set offset for start reade messages for the partition + // GetPartitionStartOffsetResponse optional set offset for start reade messages for the partition. GetPartitionStartOffsetResponse = topicreaderinternal.PublicGetPartitionStartOffsetResponse ) // WithGetPartitionStartOffset // Deprecated: (was experimental) will be removed soon. -// Use WithReaderGetPartitionStartOffset instead +// Use WithReaderGetPartitionStartOffset instead. func WithGetPartitionStartOffset(f GetPartitionStartOffsetFunc) ReaderOption { return WithReaderGetPartitionStartOffset(f) } // WithReaderGetPartitionStartOffset set optional handler for own manage progress of read partitions -// instead of/additional to commit messages +// instead of/additional to commit messages. func WithReaderGetPartitionStartOffset(f GetPartitionStartOffsetFunc) ReaderOption { return func(cfg *topicreaderinternal.ReaderConfig) { cfg.GetPartitionStartOffsetCallback = f @@ -242,7 +242,7 @@ func WithReaderTrace(t trace.Topic) ReaderOption { //nolint:gocritic } } -// WithReaderUpdateTokenInterval set custom interval for send update token message to the server +// WithReaderUpdateTokenInterval set custom interval for send update token message to the server. func WithReaderUpdateTokenInterval(interval time.Duration) ReaderOption { return func(cfg *topicreaderinternal.ReaderConfig) { cfg.CredUpdateInterval = interval diff --git a/topic/topicoptions/topicoptions_writer.go b/topic/topicoptions/topicoptions_writer.go index a29c501cb..b2f333129 100644 --- a/topic/topicoptions/topicoptions_writer.go +++ b/topic/topicoptions/topicoptions_writer.go @@ -9,14 +9,14 @@ import ( "github.com/ydb-platform/ydb-go-sdk/v3/trace" ) -// WriterOption options for a topic writer +// WriterOption options for a topic writer. type WriterOption = topicwriterinternal.PublicWriterOption // WriteSessionMetadata set key-value metadata for write session. // The metadata will allow for messages of the session in topic reader. type WriteSessionMetadata map[string]string -// CreateEncoderFunc for create message decoders +// CreateEncoderFunc for create message decoders. type CreateEncoderFunc = topicwriterinternal.PublicCreateEncoderFunc // WithWriterAddEncoder add custom codec implementation to writer. @@ -28,7 +28,7 @@ func WithWriterAddEncoder(codec topictypes.Codec, f CreateEncoderFunc) WriterOpt // WithWriterCheckRetryErrorFunction can override default error retry policy // use CheckErrorRetryDecisionDefault for use default behavior for the error // callback func must be fast and deterministic: always result same result for same error - it can be called -// few times for every error +// few times for every error. func WithWriterCheckRetryErrorFunction(callback CheckErrorRetryFunction) WriterOption { return func(cfg *topicwriterinternal.WriterReconnectorConfig) { cfg.RetrySettings.CheckError = callback @@ -38,7 +38,7 @@ func WithWriterCheckRetryErrorFunction(callback CheckErrorRetryFunction) WriterO // WithWriterCompressorCount set max count of goroutine for compress messages // must be more zero // -// panic if num <= 0 +// panic if num <= 0. func WithWriterCompressorCount(num int) WriterOption { return topicwriterinternal.WithCompressorCount(num) } @@ -62,42 +62,42 @@ func WithWriterMessageMaxBytesSize(size int) WriterOption { // WithWriteSessionMeta // Deprecated: (was experimental) will be removed soon. -// Use WithWriterSessionMeta instead +// Use WithWriterSessionMeta instead. func WithWriteSessionMeta(meta map[string]string) WriterOption { return WithWriterSessionMeta(meta) } -// WithWriterSessionMeta set writer's session metadata +// WithWriterSessionMeta set writer's session metadata. func WithWriterSessionMeta(meta map[string]string) WriterOption { return topicwriterinternal.WithSessionMeta(meta) } // WithProducerID // Deprecated: (was experimental) will be removed soon. -// Use WithWriterProducerID instead +// Use WithWriterProducerID instead. func WithProducerID(producerID string) WriterOption { return WithWriterProducerID(producerID) } -// WithWriterProducerID set producer for write session +// WithWriterProducerID set producer for write session. func WithWriterProducerID(producerID string) WriterOption { return topicwriterinternal.WithProducerID(producerID) } // WithPartitionID // Deprecated: (was experimental) will be removed soon -// Use WithWriterPartitionID instead +// Use WithWriterPartitionID instead. func WithPartitionID(partitionID int64) WriterOption { return WithWriterPartitionID(partitionID) } -// WithWriterPartitionID set direct partition id on write session level +// WithWriterPartitionID set direct partition id on write session level. func WithWriterPartitionID(partitionID int64) WriterOption { return topicwriterinternal.WithPartitioning(topicwriterinternal.NewPartitioningWithPartitionID(partitionID)) } // WithSyncWrite -// Deprecated: (was experimental) use WithWriterWaitServerAck instead +// Deprecated: (was experimental) use WithWriterWaitServerAck instead. func WithSyncWrite(sync bool) WriterOption { return WithWriterWaitServerAck(sync) } @@ -110,7 +110,7 @@ func WithWriterWaitServerAck(wait bool) WriterOption { type ( // WithOnWriterConnectedInfo present information, received from server - // Deprecated: (was experimental) will be removed soon + // Deprecated: (was experimental) will be removed soon. WithOnWriterConnectedInfo = topicwriterinternal.PublicWithOnWriterConnectedInfo // OnWriterInitResponseCallback @@ -120,7 +120,7 @@ type ( // WithOnWriterFirstConnected set callback f, which will called once - after first successfully init topic writer stream // Deprecated: (was experimental) will be removed soon. -// Use Writer.WaitInit function instead +// Use Writer.WaitInit function instead. func WithOnWriterFirstConnected(f OnWriterInitResponseCallback) WriterOption { return func(cfg *topicwriterinternal.WriterReconnectorConfig) { cfg.OnWriterInitResponseCallback = f @@ -129,12 +129,12 @@ func WithOnWriterFirstConnected(f OnWriterInitResponseCallback) WriterOption { // WithCodec // Deprecated: (was experimental) will be removed soon. -// Use WithWriterCodec instead +// Use WithWriterCodec instead. func WithCodec(codec topictypes.Codec) WriterOption { return WithWriterCodec(codec) } -// WithWriterCodec disable codec auto select and force set codec for the write session +// WithWriterCodec disable codec auto select and force set codec for the write session. func WithWriterCodec(codec topictypes.Codec) WriterOption { return topicwriterinternal.WithCodec(rawtopiccommon.Codec(codec)) } @@ -149,36 +149,36 @@ func WithCodecAutoSelect() WriterOption { // WithWriterCodecAutoSelect - auto select best codec for messages stream // enabled by default // if option enabled - send a batch of messages for every allowed codec (for prevent delayed bad codec accident) -// then from time to time measure all codecs and select codec with the smallest result messages size +// then from time to time measure all codecs and select codec with the smallest result messages size. func WithWriterCodecAutoSelect() WriterOption { return topicwriterinternal.WithAutoCodec() } // WithWriterSetAutoSeqNo set messages SeqNo by SDK // enabled by default -// if enabled - Message.SeqNo field must be zero +// if enabled - Message.SeqNo field must be zero. func WithWriterSetAutoSeqNo(val bool) WriterOption { return topicwriterinternal.WithAutoSetSeqNo(val) } // WithWriterSetAutoCreatedAt set messages CreatedAt by SDK // enabled by default -// if enabled - Message.CreatedAt field must be zero +// if enabled - Message.CreatedAt field must be zero. func WithWriterSetAutoCreatedAt(val bool) WriterOption { return topicwriterinternal.WithAutosetCreatedTime(val) } -// WithWriterStartTimeout mean timeout for connect to writer stream and work some time without errors +// WithWriterStartTimeout mean timeout for connect to writer stream and work some time without errors. func WithWriterStartTimeout(timeout time.Duration) WriterOption { return topicwriterinternal.WithStartTimeout(timeout) } -// WithWriterTrace set tracer for the writer +// WithWriterTrace set tracer for the writer. func WithWriterTrace(t trace.Topic) WriterOption { //nolint:gocritic return topicwriterinternal.WithTrace(&t) } -// WithWriterUpdateTokenInterval set time interval between send auth token to the server +// WithWriterUpdateTokenInterval set time interval between send auth token to the server. func WithWriterUpdateTokenInterval(interval time.Duration) WriterOption { return topicwriterinternal.WithTokenUpdateInterval(interval) } diff --git a/topic/topicreader/batch_options.go b/topic/topicreader/batch_options.go index 166432535..a1f0d2828 100644 --- a/topic/topicreader/batch_options.go +++ b/topic/topicreader/batch_options.go @@ -2,12 +2,12 @@ package topicreader import "github.com/ydb-platform/ydb-go-sdk/v3/internal/topic/topicreaderinternal" -// WithBatchMaxCount max messages within batch +// WithBatchMaxCount max messages within batch. type WithBatchMaxCount int var _ ReadBatchOption = WithBatchMaxCount(0) -// Apply implements ReadBatchOption interface +// Apply implements ReadBatchOption interface. func (count WithBatchMaxCount) Apply( options topicreaderinternal.ReadMessageBatchOptions, ) topicreaderinternal.ReadMessageBatchOptions { @@ -23,10 +23,10 @@ func (count WithBatchMaxCount) Apply( // it will panic if count < 1 // // Deprecated: (was experimental) will be removed soon. -// The option will be removed for simplify code internals +// The option will be removed for simplify code internals. type WithBatchPreferMinCount int -// Apply implements ReadBatchOption interface +// Apply implements ReadBatchOption interface. func (count WithBatchPreferMinCount) Apply( options topicreaderinternal.ReadMessageBatchOptions, ) topicreaderinternal.ReadMessageBatchOptions { diff --git a/topic/topicreader/errors.go b/topic/topicreader/errors.go index f5f4db2d0..5c8468561 100644 --- a/topic/topicreader/errors.go +++ b/topic/topicreader/errors.go @@ -8,13 +8,13 @@ import ( ) // ErrUnexpectedCodec will return if topicreader receive message with unknown codec. -// client side must check error with errors.Is +// client side must check error with errors.Is. var ErrUnexpectedCodec = topicreaderinternal.ErrPublicUnexpectedCodec // ErrConcurrencyCall return if method on reader called in concurrency -// client side must check error with errors.Is +// client side must check error with errors.Is. var ErrConcurrencyCall = xerrors.Wrap(errors.New("ydb: concurrency call denied")) // ErrCommitToExpiredSession it is not fatal error and reader can continue work -// client side must check error with errors.Is +// client side must check error with errors.Is. var ErrCommitToExpiredSession = topicreaderinternal.PublicErrCommitSessionToExpiredSession diff --git a/topic/topicreader/reader.go b/topic/topicreader/reader.go index 9c50d4a51..94487afc8 100644 --- a/topic/topicreader/reader.go +++ b/topic/topicreader/reader.go @@ -18,7 +18,7 @@ import ( // | ReadMessage | - | - | + | - | // | ReadMessageBatch | - | - | + | - | // | Commit | + | + | - | - | -// | Close | - | - | - | - | +// | Close | - | - | - | - |. type Reader struct { reader topicreaderinternal.Reader readInFlyght atomic.Bool @@ -32,13 +32,13 @@ func NewReader(internalReader topicreaderinternal.Reader) *Reader { } // WaitInit waits until the reader is initialized -// or an error occurs +// or an error occurs. func (r *Reader) WaitInit(ctx context.Context) error { return r.reader.WaitInit(ctx) } // ReadMessage read exactly one message -// exactly one of message, error is nil +// exactly one of message, error is nil. func (r *Reader) ReadMessage(ctx context.Context) (*Message, error) { if err := r.inCall(&r.readInFlyght); err != nil { return nil, err @@ -48,10 +48,10 @@ func (r *Reader) ReadMessage(ctx context.Context) (*Message, error) { return r.reader.ReadMessage(ctx) } -// Message contains data and metadata, readed from the server +// Message contains data and metadata, readed from the server. type Message = topicreaderinternal.PublicMessage -// MessageContentUnmarshaler is interface for unmarshal message content to own struct +// MessageContentUnmarshaler is interface for unmarshal message content to own struct. type MessageContentUnmarshaler = topicreaderinternal.PublicMessageContentUnmarshaler // Commit receive Message, Batch of single offset @@ -61,7 +61,7 @@ type MessageContentUnmarshaler = topicreaderinternal.PublicMessageContentUnmarsh // for topicoptions.CommitModeSync mode sync the method can return ErrCommitToExpiredSession // it means about the message/batch was not committed because connection broken or partition routed to // other reader by server. -// Client code should continue work normally +// Client code should continue work normally. func (r *Reader) Commit(ctx context.Context, obj CommitRangeGetter) error { if err := r.inCall(&r.commitInFlyght); err != nil { return err @@ -71,7 +71,7 @@ func (r *Reader) Commit(ctx context.Context, obj CommitRangeGetter) error { return r.reader.Commit(ctx, obj) } -// CommitRangeGetter interface for get commit offsets +// CommitRangeGetter interface for get commit offsets. type CommitRangeGetter = topicreaderinternal.PublicCommitRangeGetter // ReadMessageBatch @@ -89,7 +89,7 @@ func (r *Reader) ReadMessageBatch(ctx context.Context, opts ...ReadBatchOption) // ReadMessagesBatch read batch of messages // Batch is ordered message group from one partition // exactly one of Batch, err is nil -// if Batch is not nil - reader guarantee about all Batch.Messages are not nil +// if Batch is not nil - reader guarantee about all Batch.Messages are not nil. func (r *Reader) ReadMessagesBatch(ctx context.Context, opts ...ReadBatchOption) (*Batch, error) { if err := r.inCall(&r.readInFlyght); err != nil { return nil, err @@ -99,15 +99,15 @@ func (r *Reader) ReadMessagesBatch(ctx context.Context, opts ...ReadBatchOption) return r.reader.ReadMessageBatch(ctx, opts...) } -// Batch is ordered group of messages from one partition +// Batch is ordered group of messages from one partition. type Batch = topicreaderinternal.PublicBatch -// ReadBatchOption is type for options of read batch +// ReadBatchOption is type for options of read batch. type ReadBatchOption = topicreaderinternal.PublicReadBatchOption // Close stop work with reader // return when reader complete internal works, flush commit buffer, ets -// or when ctx cancelled +// or when ctx cancelled. func (r *Reader) Close(ctx context.Context) error { // close must be non-concurrent with read and commit diff --git a/topic/topicsugar/topicreader.go b/topic/topicsugar/topicreader.go index d4f5eb662..84480ae13 100644 --- a/topic/topicsugar/topicreader.go +++ b/topic/topicsugar/topicreader.go @@ -8,12 +8,12 @@ import ( "github.com/ydb-platform/ydb-go-sdk/v3/topic/topicreader" ) -// ProtoUnmarshal unmarshal message content to protobuf struct +// ProtoUnmarshal unmarshal message content to protobuf struct. func ProtoUnmarshal(msg *topicreader.Message, dst proto.Message) error { return msg.UnmarshalTo(protobufUnmarshaler{dst: dst}) } -// JSONUnmarshal unmarshal json message content to dst must by pointer to struct +// JSONUnmarshal unmarshal json message content to dst must by pointer to struct. func JSONUnmarshal(msg *topicreader.Message, dst interface{}) error { return UnmarshalMessageWith(msg, json.Unmarshal, dst) } @@ -26,27 +26,27 @@ func UnmarshalMessageWith(msg *topicreader.Message, unmarshaler UnmarshalFunc, v // 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 +// copy(dst, data) to another byte slice. func ReadMessageDataWithCallback(msg *topicreader.Message, f func(data []byte) error) error { return msg.UnmarshalTo(messageUnmarhalerToCallback(f)) } type messageUnmarhalerToCallback func(data []byte) error -// UnmarshalYDBTopicMessage unmarshal implementation +// UnmarshalYDBTopicMessage unmarshal implementation. func (c messageUnmarhalerToCallback) UnmarshalYDBTopicMessage(data []byte) error { return c(data) } // UnmarshalFunc is func to unmarshal data to interface, for example -// json.Unmarshal from standard library +// json.Unmarshal from standard library. type UnmarshalFunc func(data []byte, dst interface{}) error type protobufUnmarshaler struct { dst proto.Message } -// UnmarshalYDBTopicMessage implement unmarshaller +// UnmarshalYDBTopicMessage implement unmarshaller. func (m protobufUnmarshaler) UnmarshalYDBTopicMessage(data []byte) error { return proto.Unmarshal(data, m.dst) } @@ -56,7 +56,7 @@ type messageUnmarshaler struct { dst interface{} } -// UnmarshalYDBTopicMessage implement unmarshaller +// UnmarshalYDBTopicMessage implement unmarshaller. func (m messageUnmarshaler) UnmarshalYDBTopicMessage(data []byte) error { return m.unmarshaler(data, m.dst) } diff --git a/topic/topictypes/topictypes.go b/topic/topictypes/topictypes.go index 8b66a48cc..d91ca9505 100644 --- a/topic/topictypes/topictypes.go +++ b/topic/topictypes/topictypes.go @@ -9,17 +9,17 @@ import ( ) // Codec code for use in topics -// Allow to use custom values in interval [10000,20000) +// Allow to use custom values in interval [10000,20000). type Codec int32 const ( CodecRaw = Codec(rawtopiccommon.CodecRaw) CodecGzip = Codec(rawtopiccommon.CodecGzip) - // CodecLzop not supported by default, customer need provide own codec library + // CodecLzop not supported by default, customer need provide own codec library. CodecLzop = Codec(rawtopiccommon.CodecLzop) - // CodecZstd not supported by default, customer need provide own codec library + // CodecZstd not supported by default, customer need provide own codec library. CodecZstd = Codec(rawtopiccommon.CodecZstd) CodecCustomerFirst = Codec(rawtopiccommon.CodecCustomerFirst) @@ -30,7 +30,7 @@ func (c Codec) ToRaw(r *rawtopiccommon.Codec) { *r = rawtopiccommon.Codec(c) } -// Consumer contains info about topic consumer +// Consumer contains info about topic consumer. type Consumer struct { Name string Important bool @@ -92,7 +92,7 @@ func (m *MeteringMode) ToRaw(raw *rawtopic.MeteringMode) { *raw = rawtopic.MeteringMode(*m) } -// PartitionSettings settings of partitions +// PartitionSettings settings of partitions. type PartitionSettings struct { MinActivePartitions int64 PartitionCountLimit int64 diff --git a/topic/topicwriter/topicwriter.go b/topic/topicwriter/topicwriter.go index a9b5971f3..51dca49d1 100644 --- a/topic/topicwriter/topicwriter.go +++ b/topic/topicwriter/topicwriter.go @@ -13,12 +13,12 @@ type ( var ErrQueueLimitExceed = topicwriterinternal.PublicErrQueueIsFull // Writer represent write session to topic -// It handles connection problems, reconnect to server when need and resend buffered messages +// It handles connection problems, reconnect to server when need and resend buffered messages. type Writer struct { inner *topicwriterinternal.Writer } -// PublicInitialInfo is an information about writer after initialize +// PublicInitialInfo is an information about writer after initialize. type PublicInitialInfo struct { LastSeqNum int64 } @@ -38,13 +38,13 @@ func NewWriter(writer *topicwriterinternal.Writer) *Writer { // especially when connection has problems. // // It returns ErrQueueLimitExceed (must be checked by errors.Is) -// if ctx cancelled before messages put to internal buffer or try to add more messages, that can be put to queue +// if ctx cancelled before messages put to internal buffer or try to add more messages, that can be put to queue. func (w *Writer) Write(ctx context.Context, messages ...Message) error { return w.inner.Write(ctx, messages...) } // WaitInit waits until the reader is initialized -// or an error occurs, return PublicInitialInfo and err +// or an error occurs, return PublicInitialInfo and err. func (w *Writer) WaitInit(ctx context.Context) (err error) { _, err = w.inner.WaitInit(ctx) if err != nil { @@ -55,7 +55,7 @@ func (w *Writer) WaitInit(ctx context.Context) (err error) { } // WaitInitInfo waits until the reader is initialized -// or an error occurs, return PublicInitialInfo and err +// or an error occurs, return PublicInitialInfo and err. func (w *Writer) WaitInitInfo(ctx context.Context) (info PublicInitialInfo, err error) { privateInfo, err := w.inner.WaitInit(ctx) if err != nil { diff --git a/trace/coordination_gtrace.go b/trace/coordination_gtrace.go index 609198059..fafd59c5d 100644 --- a/trace/coordination_gtrace.go +++ b/trace/coordination_gtrace.go @@ -2,15 +2,15 @@ package trace -// coordinationComposeOptions is a holder of options +// coordinationComposeOptions is a holder of options. type coordinationComposeOptions struct { panicCallback func(e interface{}) } -// CoordinationOption specified Coordination compose option +// CoordinationOption specified Coordination compose option. type CoordinationComposeOption func(o *coordinationComposeOptions) -// WithCoordinationPanicCallback specified behavior on panic +// WithCoordinationPanicCallback specified behavior on panic. func WithCoordinationPanicCallback(cb func(e interface{})) CoordinationComposeOption { return func(o *coordinationComposeOptions) { o.panicCallback = cb diff --git a/trace/details.go b/trace/details.go index faa0599e2..6a574c57b 100644 --- a/trace/details.go +++ b/trace/details.go @@ -78,7 +78,7 @@ const ( CoordinationEvents - // Deprecated: has no effect now + // Deprecated: has no effect now. DriverClusterEvents DriverEvents = DriverConnEvents | diff --git a/trace/discovery_gtrace.go b/trace/discovery_gtrace.go index 362d5c0e5..281b02a3b 100644 --- a/trace/discovery_gtrace.go +++ b/trace/discovery_gtrace.go @@ -6,15 +6,15 @@ import ( "context" ) -// discoveryComposeOptions is a holder of options +// discoveryComposeOptions is a holder of options. type discoveryComposeOptions struct { panicCallback func(e interface{}) } -// DiscoveryOption specified Discovery compose option +// DiscoveryOption specified Discovery compose option. type DiscoveryComposeOption func(o *discoveryComposeOptions) -// WithDiscoveryPanicCallback specified behavior on panic +// WithDiscoveryPanicCallback specified behavior on panic. func WithDiscoveryPanicCallback(cb func(e interface{})) DiscoveryComposeOption { return func(o *discoveryComposeOptions) { o.panicCallback = cb diff --git a/trace/driver.go b/trace/driver.go index 9e954874c..6766597d5 100644 --- a/trace/driver.go +++ b/trace/driver.go @@ -101,7 +101,7 @@ func (m Method) Service() (s string) { return } -// Issue declare interface of operation error issues +// Issue declare interface of operation error issues. type Issue interface { GetMessage() string GetIssueCode() uint32 diff --git a/trace/driver_gtrace.go b/trace/driver_gtrace.go index 0fe4e4fe7..929a865be 100644 --- a/trace/driver_gtrace.go +++ b/trace/driver_gtrace.go @@ -6,15 +6,15 @@ import ( "context" ) -// driverComposeOptions is a holder of options +// driverComposeOptions is a holder of options. type driverComposeOptions struct { panicCallback func(e interface{}) } -// DriverOption specified Driver compose option +// DriverOption specified Driver compose option. type DriverComposeOption func(o *driverComposeOptions) -// WithDriverPanicCallback specified behavior on panic +// WithDriverPanicCallback specified behavior on panic. func WithDriverPanicCallback(cb func(e interface{})) DriverComposeOption { return func(o *driverComposeOptions) { o.panicCallback = cb diff --git a/trace/query_gtrace.go b/trace/query_gtrace.go index a4042572a..5b1fe389d 100644 --- a/trace/query_gtrace.go +++ b/trace/query_gtrace.go @@ -6,15 +6,15 @@ import ( "context" ) -// queryComposeOptions is a holder of options +// queryComposeOptions is a holder of options. type queryComposeOptions struct { panicCallback func(e interface{}) } -// QueryOption specified Query compose option +// QueryOption specified Query compose option. type QueryComposeOption func(o *queryComposeOptions) -// WithQueryPanicCallback specified behavior on panic +// WithQueryPanicCallback specified behavior on panic. func WithQueryPanicCallback(cb func(e interface{})) QueryComposeOption { return func(o *queryComposeOptions) { o.panicCallback = cb diff --git a/trace/ratelimiter_gtrace.go b/trace/ratelimiter_gtrace.go index 015dba417..8e6f34bea 100644 --- a/trace/ratelimiter_gtrace.go +++ b/trace/ratelimiter_gtrace.go @@ -2,15 +2,15 @@ package trace -// ratelimiterComposeOptions is a holder of options +// ratelimiterComposeOptions is a holder of options. type ratelimiterComposeOptions struct { panicCallback func(e interface{}) } -// RatelimiterOption specified Ratelimiter compose option +// RatelimiterOption specified Ratelimiter compose option. type RatelimiterComposeOption func(o *ratelimiterComposeOptions) -// WithRatelimiterPanicCallback specified behavior on panic +// WithRatelimiterPanicCallback specified behavior on panic. func WithRatelimiterPanicCallback(cb func(e interface{})) RatelimiterComposeOption { return func(o *ratelimiterComposeOptions) { o.panicCallback = cb diff --git a/trace/retry_gtrace.go b/trace/retry_gtrace.go index ea80a385f..f720d7b14 100644 --- a/trace/retry_gtrace.go +++ b/trace/retry_gtrace.go @@ -6,15 +6,15 @@ import ( "context" ) -// retryComposeOptions is a holder of options +// retryComposeOptions is a holder of options. type retryComposeOptions struct { panicCallback func(e interface{}) } -// RetryOption specified Retry compose option +// RetryOption specified Retry compose option. type RetryComposeOption func(o *retryComposeOptions) -// WithRetryPanicCallback specified behavior on panic +// WithRetryPanicCallback specified behavior on panic. func WithRetryPanicCallback(cb func(e interface{})) RetryComposeOption { return func(o *retryComposeOptions) { o.panicCallback = cb diff --git a/trace/scheme_gtrace.go b/trace/scheme_gtrace.go index 0001d9e17..f13eacc75 100644 --- a/trace/scheme_gtrace.go +++ b/trace/scheme_gtrace.go @@ -6,15 +6,15 @@ import ( "context" ) -// schemeComposeOptions is a holder of options +// schemeComposeOptions is a holder of options. type schemeComposeOptions struct { panicCallback func(e interface{}) } -// SchemeOption specified Scheme compose option +// SchemeOption specified Scheme compose option. type SchemeComposeOption func(o *schemeComposeOptions) -// WithSchemePanicCallback specified behavior on panic +// WithSchemePanicCallback specified behavior on panic. func WithSchemePanicCallback(cb func(e interface{})) SchemeComposeOption { return func(o *schemeComposeOptions) { o.panicCallback = cb diff --git a/trace/scripting_gtrace.go b/trace/scripting_gtrace.go index 8af5fd07e..613a6c266 100644 --- a/trace/scripting_gtrace.go +++ b/trace/scripting_gtrace.go @@ -6,15 +6,15 @@ import ( "context" ) -// scriptingComposeOptions is a holder of options +// scriptingComposeOptions is a holder of options. type scriptingComposeOptions struct { panicCallback func(e interface{}) } -// ScriptingOption specified Scripting compose option +// ScriptingOption specified Scripting compose option. type ScriptingComposeOption func(o *scriptingComposeOptions) -// WithScriptingPanicCallback specified behavior on panic +// WithScriptingPanicCallback specified behavior on panic. func WithScriptingPanicCallback(cb func(e interface{})) ScriptingComposeOption { return func(o *scriptingComposeOptions) { o.panicCallback = cb diff --git a/trace/sql_gtrace.go b/trace/sql_gtrace.go index a9e59a2ef..2a3e2dd30 100644 --- a/trace/sql_gtrace.go +++ b/trace/sql_gtrace.go @@ -7,15 +7,15 @@ import ( "time" ) -// databaseSQLComposeOptions is a holder of options +// databaseSQLComposeOptions is a holder of options. type databaseSQLComposeOptions struct { panicCallback func(e interface{}) } -// DatabaseSQLOption specified DatabaseSQL compose option +// DatabaseSQLOption specified DatabaseSQL compose option. type DatabaseSQLComposeOption func(o *databaseSQLComposeOptions) -// WithDatabaseSQLPanicCallback specified behavior on panic +// WithDatabaseSQLPanicCallback specified behavior on panic. func WithDatabaseSQLPanicCallback(cb func(e interface{})) DatabaseSQLComposeOption { return func(o *databaseSQLComposeOptions) { o.panicCallback = cb diff --git a/trace/table.go b/trace/table.go index 81e298324..3db633c9e 100644 --- a/trace/table.go +++ b/trace/table.go @@ -363,7 +363,7 @@ type ( } // TablePoolWaitDoneInfo means a wait iteration inside Get call is done // Warning: Session and Error may be nil at the same time. This means - // that a wait iteration donned without any significant tableResultErr + // that a wait iteration donned without any significant tableResultErr. TablePoolWaitDoneInfo struct { Session tableSessionInfo Error error diff --git a/trace/table_gtrace.go b/trace/table_gtrace.go index 95630c8f8..2a17a5b98 100644 --- a/trace/table_gtrace.go +++ b/trace/table_gtrace.go @@ -6,15 +6,15 @@ import ( "context" ) -// tableComposeOptions is a holder of options +// tableComposeOptions is a holder of options. type tableComposeOptions struct { panicCallback func(e interface{}) } -// TableOption specified Table compose option +// TableOption specified Table compose option. type TableComposeOption func(o *tableComposeOptions) -// WithTablePanicCallback specified behavior on panic +// WithTablePanicCallback specified behavior on panic. func WithTablePanicCallback(cb func(e interface{})) TableComposeOption { return func(o *tableComposeOptions) { o.panicCallback = cb diff --git a/trace/topic.go b/trace/topic.go index b6498b52e..ff65ed4be 100644 --- a/trace/topic.go +++ b/trace/topic.go @@ -243,9 +243,7 @@ type ( Error error } - //////////// - //////////// TopicWriter - //////////// + // TopicWriter. TopicWriterReconnectStartInfo struct { WriterInstanceID string diff --git a/trace/topic_gtrace.go b/trace/topic_gtrace.go index 8fa1c6b45..271128b5f 100644 --- a/trace/topic_gtrace.go +++ b/trace/topic_gtrace.go @@ -6,15 +6,15 @@ import ( "context" ) -// topicComposeOptions is a holder of options +// topicComposeOptions is a holder of options. type topicComposeOptions struct { panicCallback func(e interface{}) } -// TopicOption specified Topic compose option +// TopicOption specified Topic compose option. type TopicComposeOption func(o *topicComposeOptions) -// WithTopicPanicCallback specified behavior on panic +// WithTopicPanicCallback specified behavior on panic. func WithTopicPanicCallback(cb func(e interface{})) TopicComposeOption { return func(o *topicComposeOptions) { o.panicCallback = cb diff --git a/version.go b/version.go index 6560a46d0..6afe21788 100644 --- a/version.go +++ b/version.go @@ -4,5 +4,5 @@ import ( "github.com/ydb-platform/ydb-go-sdk/v3/internal/version" ) -// Version reports current version of sdk +// Version reports current version of sdk. const Version = version.Version diff --git a/with.go b/with.go index 248ae9435..511ed8822 100644 --- a/with.go +++ b/with.go @@ -40,7 +40,7 @@ func (d *Driver) with(ctx context.Context, opts ...Option) (*Driver, uint64, err return child, id, nil } -// With makes child Driver with the same options and another options +// With makes child Driver with the same options and another options. func (d *Driver) With(ctx context.Context, opts ...Option) (*Driver, error) { child, id, err := d.with(ctx, opts...) if err != nil {