Documentation ¶
Index ¶
- Constants
- Variables
- func AppendCertsFromFile(certPool *x509.CertPool, caFile string) error
- func Compare(l, r Value) (int, error)
- func ContextConn(ctx context.Context) (conn *conn, backoffUseBalancer bool)
- func ContextCredentialsSourceInfo(ctx context.Context) (sourceInfo string, ok bool)
- func ContextOperationCancelAfter(ctx context.Context) (d time.Duration, ok bool)
- func ContextOperationTimeout(ctx context.Context) (d time.Duration, ok bool)
- func ContextWithoutDeadline(ctx context.Context) context.Context
- func IsOpError(err error, code StatusCode) bool
- func IsOperationIdempotent(ctx context.Context) bool
- func IsTransportError(err error, code TransportErrorCode) bool
- func NewAnonymousCredentials(sourceInfo string) *anonymousCredentials
- func NewRepeater(interval, timeout time.Duration, task func(ctx context.Context), ...) *repeater
- func ReadConnStats(d Driver, f func(Endpoint, ConnStats))
- func Unwrap(op Operation) (method string, req, res proto.Message)
- func WaitBackoff(ctx context.Context, b Backoff, i int) error
- func WithCredentialsSourceInfo(ctx context.Context, sourceInfo string) context.Context
- func WithDriverTrace(ctx context.Context, t DriverTrace) context.Context
- func WithEndpointInfo(ctx context.Context, endpointInfo EndpointInfo) context.Context
- func WithEndpointInfoAndPolicy(ctx context.Context, endpointInfo EndpointInfo, _ ConnUsePolicy) context.Context
- func WithIdempotentOperation(ctx context.Context) context.Context
- func WithNonIdempotentOperation(ctx context.Context) context.Context
- func WithOperationCancelAfter(ctx context.Context, d time.Duration) context.Context
- func WithOperationMode(ctx context.Context, m OperationMode) context.Context
- func WithOperationTimeout(ctx context.Context, d time.Duration) context.Context
- func WithTraceID(ctx context.Context, traceID string) context.Context
- func WithUserAgent(ctx context.Context, userAgent string) context.Context
- func WithYdbCA(certPool *x509.CertPool) (_ *x509.CertPool, err error)
- func WriteTypeStringTo(buf *bytes.Buffer, t Type)
- type AuthTokenCredentials
- type Backoff
- type BackoffFunc
- type BackoffType
- type BalancingMethod
- type CallInfo
- type ConnState
- type ConnStats
- type ConnUsePolicydeprecated
- type Credentials
- type CredentialsFunc
- type CustomScanner
- type DialDoneInfo
- type DialStartInfo
- type Dialer
- type DiscoveryDoneInfo
- type DiscoveryStartInfo
- type Driver
- type DriverConfig
- type DriverTrace
- type Durationdeprecated
- type Endpoint
- type EndpointInfo
- type FeatureFlag
- type GetConnDoneInfo
- type GetConnStartInfo
- type GetCredentialsDoneInfo
- type GetCredentialsStartInfo
- type Issue
- type IssueIterator
- type LogBackoff
- type MetaDatabaseCtxKey
- type Method
- type NoOpResponse
- type OpError
- type OpResponse
- type Operation
- type OperationCompleted
- type OperationDoneInfo
- type OperationMode
- type OperationParams
- type OperationStartInfo
- type OperationWaitInfo
- type P2CConfig
- type PessimizationDoneInfo
- type PessimizationStartInfo
- type RawScanner
- type RawValue
- type Response
- type RetryChecker
- type RetryMode
- func (m RetryMode) BackoffType() BackoffType
- func (m RetryMode) MustBackoff() bool
- func (m RetryMode) MustCheckSession() booldeprecated
- func (m RetryMode) MustDeleteSession() bool
- func (m RetryMode) MustDropCache() booldeprecated
- func (m RetryMode) MustRetry(isOperationIdempotent bool) bool
- func (m RetryMode) Retriable() booldeprecated
- type Scanner
- type StatusCode
- type StreamDoneInfo
- type StreamOperation
- type StreamOperationResponse
- type StreamRecvDoneInfo
- type StreamRecvStartInfo
- type StreamStartInfo
- type StructOption
- type StructValueOption
- type Timedeprecated
- func (t Time) Date() uint32
- func (t Time) Datetime() uint32
- func (t *Time) FromDate(x uint32) error
- func (t *Time) FromDatetime(x uint32) error
- func (t *Time) FromTimestamp(x uint64) error
- func (t *Time) FromTzDate(x string) error
- func (t *Time) FromTzDatetime(x string) error
- func (t *Time) FromTzTimestamp(x string) error
- func (t Time) Timestamp() uint64
- func (t Time) TzDate() string
- func (t Time) TzDatetime() string
- func (t Time) TzTimestamp() string
- type TrackConnDoneInfo
- type TrackConnStartInfo
- type TransportError
- type TransportErrorCode
- type Type
- type Value
- func BoolValue(v bool) Value
- func DateValue(v uint32) Value
- func DateValueFromTime(v time.Time) Value
- func DatetimeValue(v uint32) Value
- func DatetimeValueFromTime(v time.Time) Value
- func DecimalValue(t Type, v [16]byte) Value
- func DictValue(pairs ...Value) Value
- func DoubleValue(v float64) Value
- func DyNumberValue(v string) Value
- func FloatValue(v float32) Value
- func Int16Value(v int16) Value
- func Int32Value(v int32) Value
- func Int64Value(v int64) Value
- func Int8Value(v int8) Value
- func IntervalValue(v int64) Valuedeprecated
- func IntervalValueFromDuration(v time.Duration) Value
- func IntervalValueFromMicroseconds(v int64) Value
- func JSONDocumentValue(v string) Value
- func JSONDocumentValueFromBytes(v []byte) Value
- func JSONValue(v string) Value
- func JSONValueFromBytes(v []byte) Value
- func ListValue(vs ...Value) Value
- func NullValue(t Type) Value
- func OptionalValue(v Value) Value
- func StringValue(v []byte) Value
- func StringValueFromString(v string) Value
- func StructValue(opts ...StructValueOption) Value
- func TimestampValue(v uint64) Value
- func TimestampValueFromTime(v time.Time) Value
- func TupleValue(vs ...Value) Value
- func TzDateValue(v string) Value
- func TzDateValueFromTime(v time.Time) Value
- func TzDatetimeValue(v string) Value
- func TzDatetimeValueFromTime(v time.Time) Value
- func TzTimestampValue(v string) Value
- func TzTimestampValueFromTime(v time.Time) Value
- func UTF8Value(v string) Value
- func UUIDValue(v [16]byte) Value
- func Uint16Value(v uint16) Value
- func Uint32Value(v uint32) Value
- func Uint64Value(v uint64) Value
- func Uint8Value(v uint8) Value
- func VariantValue(v Value, i uint32, variantT Type) Value
- func VoidValue() Value
- func YSONValue(v string) Value
- func YSONValueFromBytes(v []byte) Value
- func ZeroValue(t Type) Value
- type WG
Constants ¶
const ( MaxGetConnTimeout = 10 * time.Second ConnResetOfflineRate = uint64(10) )
const ( FeatureEnabled = internal.FeatureEnabled FeatureDisabled = internal.FeatureDisabled )
const ( StatusUnknownStatus = StatusCode(Ydb.StatusIds_STATUS_CODE_UNSPECIFIED) StatusBadRequest = StatusCode(Ydb.StatusIds_BAD_REQUEST) StatusInternalError = StatusCode(Ydb.StatusIds_INTERNAL_ERROR) StatusAborted = StatusCode(Ydb.StatusIds_ABORTED) StatusOverloaded = StatusCode(Ydb.StatusIds_OVERLOADED) StatusSchemeError = StatusCode(Ydb.StatusIds_SCHEME_ERROR) StatusGenericError = StatusCode(Ydb.StatusIds_GENERIC_ERROR) StatusTimeout = StatusCode(Ydb.StatusIds_TIMEOUT) StatusBadSession = StatusCode(Ydb.StatusIds_BAD_SESSION) StatusPreconditionFailed = StatusCode(Ydb.StatusIds_PRECONDITION_FAILED) StatusAlreadyExists = StatusCode(Ydb.StatusIds_ALREADY_EXISTS) StatusNotFound = StatusCode(Ydb.StatusIds_NOT_FOUND) StatusSessionExpired = StatusCode(Ydb.StatusIds_SESSION_EXPIRED) StatusCancelled = StatusCode(Ydb.StatusIds_CANCELLED) StatusUndetermined = StatusCode(Ydb.StatusIds_UNDETERMINED) StatusUnsupported = StatusCode(Ydb.StatusIds_UNSUPPORTED) StatusSessionBusy = StatusCode(Ydb.StatusIds_SESSION_BUSY) )
Errors describing unsusccessful operation status.
const ( DefaultFastSlot = 5 * time.Millisecond DefaultSlowSlot = 1 * time.Second )
Default parameters used by Retry() functions within different sub packages.
const ( RetryAvailable RetryBackoff RetryDeleteSession RetryCheckSession RetryDropCache )
Deprecated: has no effect now
const ( TypeUnknown = internal.TypeUnknown TypeBool = internal.TypeBool TypeInt8 = internal.TypeInt8 TypeUint8 = internal.TypeUint8 TypeInt16 = internal.TypeInt16 TypeUint16 = internal.TypeUint16 TypeInt32 = internal.TypeInt32 TypeUint32 = internal.TypeUint32 TypeInt64 = internal.TypeInt64 TypeUint64 = internal.TypeUint64 TypeFloat = internal.TypeFloat TypeDouble = internal.TypeDouble TypeDate = internal.TypeDate TypeDatetime = internal.TypeDatetime TypeTimestamp = internal.TypeTimestamp TypeInterval = internal.TypeInterval TypeTzDate = internal.TypeTzDate TypeTzDatetime = internal.TypeTzDatetime TypeTzTimestamp = internal.TypeTzTimestamp TypeString = internal.TypeString TypeUTF8 = internal.TypeUTF8 TypeYSON = internal.TypeYSON TypeJSON = internal.TypeJSON TypeUUID = internal.TypeUUID TypeJSONDocument = internal.TypeJSONDocument TypeDyNumber = internal.TypeDyNumber )
Primitive types known by YDB.
const (
Version = "ydb-go-sdk/2.12.4"
)
Variables ¶
var ( // ErrNilBalancerElement returned when requested on a nil balancer element. ErrNilBalancerElement = errors.New("nil balancer element") // ErrUnknownBalancerElement returned when requested on a unknown balancer element. ErrUnknownBalancerElement = errors.New("unknown balancer element") // ErrUnknownTypeOfBalancerElement returned when requested on a unknown type of balancer element. ErrUnknownTypeOfBalancerElement = errors.New("unknown type of balancer element") )
var ( // ErrClusterClosed returned when requested on a closed cluster. ErrClusterClosed = errors.New("cluster closed") // ErrClusterEmpty returned when no connections left in cluster. ErrClusterEmpty = errors.New("cluster empty") // ErrUnknownEndpoint returned when no connections left in cluster. ErrUnknownEndpoint = errors.New("unknown endpoint") )
var ( // DefaultDiscoveryInterval contains default duration between discovery // requests made by driver. DefaultDiscoveryInterval = time.Minute // DefaultBalancingMethod contains driver's default balancing algorithm. DefaultBalancingMethod = BalancingRandomChoice // ErrClosed is returned when operation requested on a closed driver. ErrClosed = errors.New("driver closed") // ErrNilConnection is returned when use nil preferred connection ErrNilConnection = errors.New("nil connection") )
var ( // DefaultKeepaliveInterval contains default duration between grpc keepalive DefaultKeepaliveInterval = 10 * time.Second MinKeepaliveInterval = 10 * time.Second DefaultGRPCMsgSize = 64 * 1024 * 1024 // 64MB )
var ( // Deprecated: will be redeclared as constant at next major release, // use as constant instead and configure max retries as parameter of Retryer DefaultMaxRetries = 10 DefaultRetryChecker = RetryChecker{} // DefaultBackoff is a logarithmic backoff operationCompleted strategy. // Deprecated: use DefaultFastBackoff or DefaultSlowBackoff instead DefaultBackoff = LogBackoff{ SlotDuration: time.Second, Ceiling: 6, } DefaultFastBackoff = LogBackoff{ SlotDuration: DefaultFastSlot, Ceiling: 6, } DefaultSlowBackoff = LogBackoff{ SlotDuration: DefaultSlowSlot, Ceiling: 6, } )
Default parameters used by Retry() functions within different sub packages.
var DefaultDecimal = Decimal(22, 9)
var ( // ErrCredentialsNoCredentials may be returned by Credentials implementations to // make driver act as if there no Credentials at all. That is, driver will // not send any token meta information during request. ErrCredentialsNoCredentials = errors.New("ydb: credentials: no credentials") )
var ErrOperationNotReady = errors.New("operation is not ready yet")
Functions ¶
func AppendCertsFromFile ¶ added in v2.2.0
func Compare ¶
Compare compares its operands. It returns -1, 0, 1 if l < r, l == r, l > r. Returns error if types are not comparable. Comparable types are all integer types, UUID, DyNumber, Float, Double, String, UTF8, Date, Datetime, Timestamp, Tuples and Lists. Primitive arguments are comparable if their types are the same. Optional type is comparable to underlying type, e.g. Optional<Optional<Float>> is comparable to Float. Null value is comparable to non-null value of the same type and is considered less than any non-null value. Tuples and Lists are comparable if their elements are comparable. Tuples and Lists are compared lexicographically. If tuples (lists) have different length and elements of the shorter tuple (list) are all equal to corresponding elements of the other tuple (list), than the shorter tuple (list) is considered less than the longer one.
func ContextConn ¶
ContextConn returns the connection and connection use policy Deprecated: conn must not used as information about needed destination
func ContextOperationCancelAfter ¶
ContextOperationCancelAfter returns the timeout within given context after which YDB should try to cancel operation and return result regardless of the cancellation.
func ContextOperationTimeout ¶
ContextOperationTimeout returns the timeout within given context after which YDB should try to cancel operation and return result regardless of the cancelation.
func ContextWithoutDeadline ¶
ContextWithoutDeadline helps to clear derived context from deadline
func IsOpError ¶
func IsOpError(err error, code StatusCode) bool
IsOpError reports whether err is OpError with given code as the Reason.
func IsOperationIdempotent ¶ added in v2.9.5
IsOperationIdempotent returns the flag for operationCompleted with no idempotent errors
func IsTransportError ¶
func IsTransportError(err error, code TransportErrorCode) bool
IsTransportError reports whether err is TransportError with given code as the Reason.
func NewAnonymousCredentials ¶
func NewAnonymousCredentials(sourceInfo string) *anonymousCredentials
func NewRepeater ¶
func NewRepeater(interval, timeout time.Duration, task func(ctx context.Context), opts ...repeaterOption) *repeater
NewRepeater creates and begins to execute task periodically.
func ReadConnStats ¶
func WaitBackoff ¶
WaitBackoff is a helper function that waits for i-th backoff b or ctx expiration. It returns non-nil error if and only if context expiration branch wins.
func WithDriverTrace ¶
func WithDriverTrace(ctx context.Context, t DriverTrace) context.Context
WithDriverTrace returns context which has associated DriverTrace with it.
func WithEndpointInfo ¶
func WithEndpointInfo(ctx context.Context, endpointInfo EndpointInfo) context.Context
WithEndpointInfo returns a copy of parent context with endpoint info and default connection use policy
func WithEndpointInfoAndPolicy ¶
func WithEndpointInfoAndPolicy(ctx context.Context, endpointInfo EndpointInfo, _ ConnUsePolicy) context.Context
WithEndpointInfoAndPolicy returns a copy of parent context with endopint info and custom connection use policy Deprecated: from now we use auto policy in cluster.Get()
func WithIdempotentOperation ¶ added in v2.9.5
WithIdempotentOperation returns a copy of parent context with idempotent operation flag
func WithNonIdempotentOperation ¶ added in v2.9.5
WithNonIdempotentOperation returns a copy of parent context with non-idempotent operation flag
func WithOperationCancelAfter ¶
WithOperationCancelAfter returns a copy of parent context in which YDB operation cancel after parameter is set to d. If parent context cancellation timeout is smaller than d, parent context is returned.
func WithOperationMode ¶
func WithOperationMode(ctx context.Context, m OperationMode) context.Context
WithOperationMode returns a copy of parent context in which YDB operation mode parameter is set to m. If parent context mode is set and is not equal to m, WithOperationMode will panic.
func WithOperationTimeout ¶
WithOperationTimeout returns a copy of parent context in which YDB operation timeout parameter is set to d. If parent context timeout is smaller than d, parent context is returned.
func WithTraceID ¶
WithTraceID returns a copy of parent context with traceID
func WithUserAgent ¶
WithUserAgent returns a copy of parent context with custom user-agent info
func WriteTypeStringTo ¶
Types ¶
type AuthTokenCredentials ¶
type AuthTokenCredentials struct { AuthToken string // contains filtered or unexported fields }
AuthTokenCredentials implements Credentials interface with static authorization parameters.
func NewAuthTokenCredentials ¶
func NewAuthTokenCredentials(authToken string, sourceInfo string) *AuthTokenCredentials
func (AuthTokenCredentials) String ¶
func (a AuthTokenCredentials) String() string
Token implements Credentials.
type Backoff ¶
type Backoff interface { // Wait maps index of the operationCompleted to a channel which fulfillment means that // delay is over. // // Note that operationCompleted index begins from 0 and 0-th index means that it is the // first operationCompleted attempt after an initial error. Wait(n int) <-chan time.Time }
Backoff is the interface that contains logic of delaying operation operationCompleted.
type BackoffFunc ¶
BackoffFunc is an adatper to allow the use of ordinary functions as Backoff.
type BackoffType ¶ added in v2.7.0
type BackoffType uint8
BackoffType reports how to backoff operation
const ( BackoffTypeNoBackoff BackoffType = 1 << iota >> 1 BackoffTypeFastBackoff BackoffTypeSlowBackoff )
Binary flags that used as BackoffType
func (BackoffType) String ¶ added in v2.9.4
func (b BackoffType) String() string
type BalancingMethod ¶
type BalancingMethod uint
BalancingMethod encodes balancing method for driver configuration.
const ( BalancingUnknown BalancingMethod = iota BalancingRoundRobin BalancingP2C BalancingRandomChoice )
type CallInfo ¶
type CallInfo interface { EndpointInfo }
CallInfo is struct contained information about call
type ConnStats ¶
type ConnUsePolicy
deprecated
type ConnUsePolicy uint8
Deprecated: from now we use auto policy in cluster.Get()
const ( ConnUseDefault ConnUsePolicy = 1 << iota >> 1 ConnUseBalancer ConnUseEndpoint ConnUseSmart = ConnUseBalancer | ConnUseEndpoint )
Deprecated: from now we use auto policy in cluster.Get()
type Credentials ¶
Credentials is an interface that contains options used to authorize a client.
func MultiCredentials ¶
func MultiCredentials(cs ...Credentials) Credentials
MultiCredentials creates Credentials which represents multiple ways of obtaining token. Its Token() method proxies call to the underlying credentials in order. When first successful call met, it returns. If there are no successful calls, it returns last error.
type CredentialsFunc ¶
CredentialsFunc is an adapter to allow the use of ordinary functions as Credentials.
func (CredentialsFunc) String ¶
func (f CredentialsFunc) String() string
Token implements Credentials.
type CustomScanner ¶ added in v2.5.0
type CustomScanner interface {
UnmarshalYDB(res RawScanner) error
}
deprecated: use ydb.Scanner
type DialStartInfo ¶
type Dialer ¶
type Dialer struct { // DriverConfig is a driver configuration. DriverConfig *DriverConfig // TLSConfig specifies the TLS configuration to use for tls client. // If TLSConfig is zero then connections are insecure. TLSConfig *tls.Config // Timeout is the maximum amount of time a dial will wait for a connect to // complete. // If Timeout is zero then no timeout is used. Timeout time.Duration // Keepalive is the interval used to check whether inner connections are // still valid. // Dialer could increase keepalive interval if given value is too small. Keepalive time.Duration // NetDial is an optional function that may replace default network dialing // function such as net.Dial("tcp"). // Deprecated: Use it for test purposes and special cases only. In most cases should be left empty. NetDial func(context.Context, string) (net.Conn, error) }
Dialer contains options of dialing and initialization of particular ydb driver.
type DiscoveryDoneInfo ¶
type DiscoveryStartInfo ¶
type Driver ¶
type Driver interface { Call(context.Context, Operation) (CallInfo, error) StreamRead(context.Context, StreamOperation) (CallInfo, error) Close() error }
Driver is an interface of YDB driver.
type DriverConfig ¶
type DriverConfig struct { // Database is a required database name. Database string // Credentials is an ydb client credentials. // In most cases Credentials are required. Credentials Credentials // Trace contains driver tracing options. Trace DriverTrace // RequestTimeout is the maximum amount of time a Call() will wait for an // operation to complete. // If RequestTimeout is zero then no timeout is used. RequestTimeout time.Duration // StreamTimeout is the maximum amount of time a StreamRead() will wait for // an operation to complete. // If StreamTimeout is zero then no timeout is used. StreamTimeout time.Duration // OperationTimeout is the maximum amount of time a YDB server will process // an operation. After timeout exceeds YDB will try to cancel operation and // regardless of the cancellation appropriate error will be returned to // the client. // If OperationTimeout is zero then no timeout is used. OperationTimeout time.Duration // OperationCancelAfter is the maximum amount of time a YDB server will process an // operation. After timeout exceeds YDB will try to cancel operation and if // it succeeds appropriate error will be returned to the client; otherwise // processing will be continued. // If OperationCancelAfter is zero then no timeout is used. OperationCancelAfter time.Duration // DiscoveryInterval is the frequency of background tasks of ydb endpoints // discovery. // If DiscoveryInterval is zero then the DefaultDiscoveryInterval is used. // If DiscoveryInterval is negative, then no background discovery prepared. DiscoveryInterval time.Duration // BalancingMethod is an algorithm used by the driver for endpoint // selection. // If BalancingMethod is zero then the DefaultBalancingMethod is used. BalancingMethod BalancingMethod // BalancingConfig is an optional configuration related to selected // BalancingMethod. That is, some balancing methods allow to be configured. BalancingConfig interface{} // PreferLocalEndpoints adds endpoint selection logic when local endpoints // are always used first. // When no alive local endpoints left other endpoints will be used. // // NOTE: some balancing methods (such as p2c) also may use knowledge of // endpoint's locality. Difference is that with PreferLocalEndpoints local // endpoints selected separately from others. That is, if there at least // one local endpoint it will be used regardless of its performance // indicators. // // NOTE: currently driver (and even ydb itself) does not track load factor // of each endpoint properly. Enabling this option may lead to the // situation, when all but one nodes in local datacenter become inactive // and all clients will overload this single instance very quickly. That // is, currently this option may be called as experimental. // You have been warned. PreferLocalEndpoints bool // RequestsType set an additional type hint to all requests. // It is needed only for debug purposes and advanced cases. RequestsType string // FastDial will make dialer return Driver as soon as 1st connection succeeds. // NB: it may be not the fastest node to serve requests. FastDial bool }
DriverConfig contains driver configuration options.
type DriverTrace ¶
type DriverTrace struct { OnDial func(DialStartInfo) func(DialDoneInfo) OnGetConn func(GetConnStartInfo) func(GetConnDoneInfo) OnPessimization func(PessimizationStartInfo) func(PessimizationDoneInfo) // Only for background. TrackConnStart func(TrackConnStartInfo) TrackConnDone func(TrackConnDoneInfo) OnGetCredentials func(GetCredentialsStartInfo) func(GetCredentialsDoneInfo) OnDiscovery func(DiscoveryStartInfo) func(DiscoveryDoneInfo) OnOperation func(OperationStartInfo) func(OperationDoneInfo) OnOperationWait func(OperationWaitInfo) OnStream func(StreamStartInfo) func(StreamDoneInfo) OnStreamRecv func(StreamRecvStartInfo) func(StreamRecvDoneInfo) }
func ContextDriverTrace ¶
func ContextDriverTrace(ctx context.Context) DriverTrace
ContextDriverTrace returns DriverTrace associated with ctx. If there is no DriverTrace associated with ctx then zero value of DriverTrace is returned.
func (DriverTrace) Compose ¶
func (t DriverTrace) Compose(x DriverTrace) (ret DriverTrace)
Compose returns a new DriverTrace which has functional fields composed both from t and x.
type EndpointInfo ¶
type EndpointInfo interface { // Deprecated: using raw conn does not handle endpoint reconnection Conn() *conn Address() string }
EndpointInfo is struct contained information about endpoint
func ContextEndpointInfo ¶ added in v2.9.6
func ContextEndpointInfo(ctx context.Context) (endpointInfo EndpointInfo)
ContextEndpointInfo returns the endpoint info or nil
type FeatureFlag ¶
type FeatureFlag = internal.FeatureFlag
type GetConnDoneInfo ¶
type GetConnStartInfo ¶
type GetCredentialsDoneInfo ¶
type GetCredentialsStartInfo ¶
type IssueIterator ¶
type IssueIterator []*Ydb_Issue.IssueMessage
func (IssueIterator) Get ¶
func (it IssueIterator) Get(i int) (issue Issue, nested IssueIterator)
func (IssueIterator) Len ¶
func (it IssueIterator) Len() int
type LogBackoff ¶
type LogBackoff struct { // SlotDuration is a size of a single time slot used in backoff delay // calculation. // If SlotDuration is less or equal to zero, then the time.Second value is // used. SlotDuration time.Duration // Ceiling is a maximum degree of backoff delay growth. // If Ceiling is less or equal to zero, then the default ceiling of 1 is // used. Ceiling uint // JitterLimit controls fixed and random portions of backoff delay. // Its value can be in range [0, 1]. // If JitterLimit is non zero, then the backoff delay will be equal to (F + R), // where F is a result of multiplication of this value and calculated delay // duration D; and R is a random sized part from [0,(D - F)]. JitterLimit float64 }
LogBackoff contains logarithmic backoff policy.
type MetaDatabaseCtxKey ¶ added in v2.11.0
type MetaDatabaseCtxKey struct{}
type NoOpResponse ¶ added in v2.4.0
type NoOpResponse = internal.NoOpResponse
type OpError ¶
type OpError struct { Reason StatusCode // contains filtered or unexported fields }
OpError reports about operation fail.
func (*OpError) Issues ¶
func (e *OpError) Issues() IssueIterator
type OpResponse ¶ added in v2.4.0
type OpResponse = internal.OpResponse
type OperationCompleted ¶ added in v2.9.4
type OperationCompleted uint8
OperationCompleted reports which operations need to operationCompleted
const ( OperationCompletedTrue OperationCompleted = 1 << iota >> 1 OperationCompletedUndefined // may be true or may be false OperationCompletedFalse )
Binary flags that used as OperationCompleted
func (OperationCompleted) String ¶ added in v2.9.4
func (t OperationCompleted) String() string
type OperationDoneInfo ¶
type OperationDoneInfo struct { Context context.Context Address string Method Method Params OperationParams OpID string Issues IssueIterator Error error }
type OperationMode ¶
type OperationMode uint
const ( OperationModeUnknown OperationMode = iota OperationModeSync OperationModeAsync )
func ContextOperationMode ¶
func ContextOperationMode(ctx context.Context) (m OperationMode, ok bool)
ContextOperationMode returns the mode of YDB operation within given context.
func (OperationMode) String ¶
func (m OperationMode) String() string
type OperationParams ¶
type OperationParams struct { Timeout time.Duration CancelAfter time.Duration Mode OperationMode }
func (OperationParams) Empty ¶
func (p OperationParams) Empty() bool
type OperationStartInfo ¶
type OperationStartInfo struct { Context context.Context Address string Method Method Params OperationParams }
type OperationWaitInfo ¶
type P2CConfig ¶
type P2CConfig struct { // PreferLocal reports whether p2c balancer should prefer local endpoint // when all other runtime indicators are the same (such as error rate or // average response time). PreferLocal bool // OpTimeThreshold specifies such difference between endpoint average // operation time when it becomes significant to be used during comparison. OpTimeThreshold time.Duration }
type PessimizationDoneInfo ¶
type PessimizationStartInfo ¶
type RawScanner ¶ added in v2.5.0
type RawScanner interface { HasItems() bool HasNextItem() bool // NextItem selects next item to parse in the current row. // It returns false if there are no more items in the row. // // Note that NextItem() differs from NextRow() and NextSet() – if it return // false it fails the Result such that no further operations may be processed. // That is, res.Err() becomes non-nil. NextItem() (ok bool) // SeekItem finds the column with given name in the result set and selects // appropriate item to parse in the current row. SeekItem(name string) bool Path() string WritePathTo(w io.Writer) (n int64, err error) Type() Type Bool() (v bool) Int8() (v int8) Uint8() (v uint8) Int16() (v int16) Uint16() (v uint16) Int32() (v int32) Uint32() (v uint32) Int64() (v int64) Uint64() (v uint64) Float() (v float32) Double() (v float64) Date() (v time.Time) Datetime() (v time.Time) Timestamp() (v time.Time) Interval() (v time.Duration) TzDate() (v time.Time) TzDatetime() (v time.Time) TzTimestamp() (v time.Time) String() (v string) UTF8() (v string) YSON() (v []byte) JSON() (v []byte) UUID() (v [16]byte) JSONDocument() (v []byte) DyNumber() (v string) Value() Value // ListIn interprets current item under scan as a ydb's list. // It returns the size of the nested items. // If current item under scan is not a list type, it returns -1. ListIn() (size int) // ListItem selects current item i-th element as an item to scan. // ListIn() must be called before. ListItem(i int) // ListOut leaves list entered before by ListIn() call. ListOut() // TupleIn interprets current item under scan as a ydb's tuple. // It returns the size of the nested items. TupleIn() (size int) // TupleItem selects current item i-th element as an item to scan. // Note that TupleIn() must be called before. // It panics if it is out of bounds. TupleItem(i int) // TupleOut leaves tuple entered before by TupleIn() call. TupleOut() // StructIn interprets current item under scan as a ydb's struct. // It returns the size of the nested items – the struct fields values. // If there is no current item under scan it returns -1. StructIn() (size int) // StructField selects current item i-th field value as an item to scan. // Note that StructIn() must be called before. // It panics if i is out of bounds. StructField(i int) (name string) // StructOut leaves struct entered before by StructIn() call. StructOut() // DictIn interprets current item under scan as a ydb's dict. // It returns the size of the nested items pairs. // If there is no current item under scan it returns -1. DictIn() (size int) // DictKey selects current item i-th pair key as an item to scan. // Note that DictIn() must be called before. // It panics if i is out of bounds. DictKey(i int) // DictPayload selects current item i-th pair value as an item to scan. // Note that DictIn() must be called before. // It panics if i is out of bounds. DictPayload(i int) // DictOut leaves dict entered before by DictIn() call. DictOut() // Variant unwraps current item under scan interpreting it as Variant<T> type. // It returns non-empty name of a field that is filled for struct-based // variant. // It always returns an index of filled field of a T. Variant() (name string, index uint32) // Decimal returns decimal value represented by big-endian 128 bit signed integer. Decimal(t Type) (v [16]byte) ODecimal(t Type) (v [16]byte) // UnwrapDecimal returns decimal value represented by big-endian 128 bit signed // integer and its type information. UnwrapDecimal() (v [16]byte, precision, scale uint32) // Unwrap unwraps current item under scan interpreting it as Optional<T> type. Unwrap() IsNull() bool IsOptional() bool IsDecimal() bool Err() error }
deprecated: use RawValue
type RawValue ¶ added in v2.9.0
type RawValue interface { Path() string WritePathTo(w io.Writer) (n int64, err error) Type() Type Bool() (v bool) Int8() (v int8) Uint8() (v uint8) Int16() (v int16) Uint16() (v uint16) Int32() (v int32) Uint32() (v uint32) Int64() (v int64) Uint64() (v uint64) Float() (v float32) Double() (v float64) Date() (v time.Time) Datetime() (v time.Time) Timestamp() (v time.Time) Interval() (v time.Duration) TzDate() (v time.Time) TzDatetime() (v time.Time) TzTimestamp() (v time.Time) String() (v string) UTF8() (v string) YSON() (v []byte) JSON() (v []byte) UUID() (v [16]byte) JSONDocument() (v []byte) DyNumber() (v string) Value() Value // Any returns any primitive or optional value. // Currently, it may return one of these types: // // bool // int8 // uint8 // int16 // uint16 // int32 // uint32 // int64 // uint64 // float32 // float64 // []byte // string // [16]byte // Any() interface{} // Unwrap unwraps current item under scan interpreting it as Optional<T> type. Unwrap() AssertType(t Type) bool IsNull() bool IsOptional() bool // ListIn interprets current item under scan as a ydb's list. // It returns the size of the nested items. // If current item under scan is not a list type, it returns -1. ListIn() (size int) // ListItem selects current item i-th element as an item to scan. // ListIn() must be called before. ListItem(i int) // ListOut leaves list entered before by ListIn() call. ListOut() // TupleIn interprets current item under scan as a ydb's tuple. // It returns the size of the nested items. TupleIn() (size int) // TupleItem selects current item i-th element as an item to scan. // Note that TupleIn() must be called before. // It panics if it is out of bounds. TupleItem(i int) // TupleOut leaves tuple entered before by TupleIn() call. TupleOut() // StructIn interprets current item under scan as a ydb's struct. // It returns the size of the nested items – the struct fields values. // If there is no current item under scan it returns -1. StructIn() (size int) // StructField selects current item i-th field value as an item to scan. // Note that StructIn() must be called before. // It panics if i is out of bounds. StructField(i int) (name string) // StructOut leaves struct entered before by StructIn() call. StructOut() // DictIn interprets current item under scan as a ydb's dict. // It returns the size of the nested items pairs. // If there is no current item under scan it returns -1. DictIn() (size int) // DictKey selects current item i-th pair key as an item to scan. // Note that DictIn() must be called before. // It panics if i is out of bounds. DictKey(i int) // DictPayload selects current item i-th pair value as an item to scan. // Note that DictIn() must be called before. // It panics if i is out of bounds. DictPayload(i int) // DictOut leaves dict entered before by DictIn() call. DictOut() // Variant unwraps current item under scan interpreting it as Variant<T> type. // It returns non-empty name of a field that is filled for struct-based // variant. // It always returns an index of filled field of a T. Variant() (name string, index uint32) // Decimal returns decimal value represented by big-endian 128 bit signed integer. Decimal(t Type) (v [16]byte) ODecimal(t Type) (v [16]byte) // UnwrapDecimal returns decimal value represented by big-endian 128 bit signed // integer and its type information. UnwrapDecimal() (v [16]byte, precision, scale uint32) IsDecimal() bool Err() error }
RawValue scanning non-primitive yql types or for own implementation scanner native API
type Response ¶ added in v2.4.0
func WrapNoOpResponse ¶ added in v2.4.0
func WrapNoOpResponse(resp NoOpResponse) Response
func WrapOpResponse ¶ added in v2.4.0
func WrapOpResponse(resp OpResponse) Response
type RetryChecker ¶
type RetryChecker struct { // RetryNotFound reports whether Repeater must operationCompleted ErrNotFound errors. // Deprecated: has no effect now RetryNotFound bool }
RetryChecker contains options of checking errors returned by YDB for ability to operationCompleted provoked operation.
func (*RetryChecker) Check ¶
func (r *RetryChecker) Check(err error) (m RetryMode)
Check returns operationCompleted mode for err.
type RetryMode ¶
type RetryMode struct {
// contains filtered or unexported fields
}
RetryMode reports whether operation is able to be retried and with which properties.
func (RetryMode) BackoffType ¶ added in v2.7.0
func (m RetryMode) BackoffType() BackoffType
func (RetryMode) MustBackoff ¶
func (RetryMode) MustCheckSession
deprecated
func (RetryMode) MustDeleteSession ¶
func (RetryMode) MustDropCache
deprecated
type StatusCode ¶
type StatusCode int32
StatusCode reports unsuccessful operation status code.
func (StatusCode) String ¶
func (e StatusCode) String() string
type StreamDoneInfo ¶
type StreamOperation ¶ added in v2.3.2
type StreamOperation = internal.StreamOperation
func WrapStreamOperation ¶ added in v2.3.2
func WrapStreamOperation( method string, req proto.Message, resp StreamOperationResponse, p func(error), ) StreamOperation
type StreamOperationResponse ¶ added in v2.3.2
type StreamOperationResponse = internal.StreamOperationResponse
func UnwrapStreamOperation ¶ added in v2.3.2
func UnwrapStreamOperation(op StreamOperation) ( method string, req proto.Message, resp StreamOperationResponse, processor func(error), )
type StreamRecvDoneInfo ¶
type StreamRecvStartInfo ¶
type StreamStartInfo ¶
type StructOption ¶
type StructOption func(*tStructType)
func StructField ¶
func StructField(name string, typ Type) StructOption
type StructValueOption ¶
type StructValueOption func(*tStructValueProto)
func StructFieldValue ¶
func StructFieldValue(name string, value Value) StructValueOption
type Time
deprecated
Deprecated: Use standard time.Time instead This type will be removed at next major release
func (*Time) FromDatetime ¶
func (*Time) FromTimestamp ¶
func (*Time) FromTzDate ¶
func (*Time) FromTzDatetime ¶
func (*Time) FromTzTimestamp ¶
func (Time) TzDatetime ¶
func (Time) TzTimestamp ¶
type TrackConnDoneInfo ¶
type TrackConnDoneInfo struct {
Address string
}
type TrackConnStartInfo ¶
type TrackConnStartInfo struct {
Address string
}
type TransportError ¶
type TransportError struct { Reason TransportErrorCode // contains filtered or unexported fields }
func (*TransportError) Error ¶
func (t *TransportError) Error() string
func (*TransportError) Unwrap ¶
func (t *TransportError) Unwrap() error
type TransportErrorCode ¶
type TransportErrorCode int32
const ( TransportErrorUnknownCode TransportErrorCode = iota TransportErrorCanceled TransportErrorUnknown TransportErrorInvalidArgument TransportErrorDeadlineExceeded TransportErrorNotFound TransportErrorAlreadyExists TransportErrorPermissionDenied TransportErrorResourceExhausted TransportErrorFailedPrecondition TransportErrorAborted TransportErrorOutOfRange TransportErrorUnimplemented TransportErrorInternal TransportErrorDataLoss TransportErrorUnauthenticated )
func (TransportErrorCode) String ¶
func (t TransportErrorCode) String() string
type Value ¶
func DateValueFromTime ¶ added in v2.4.0
func DatetimeValue ¶
func DatetimeValueFromTime ¶ added in v2.4.0
func DecimalValue ¶
DecimalValue creates decimal value of given type t and value v. Note that v interpreted as big-endian int128.
func DoubleValue ¶
func DyNumberValue ¶
func FloatValue ¶
func Int16Value ¶
func Int32Value ¶
func Int64Value ¶
func IntervalValue
deprecated
func IntervalValueFromDuration ¶ added in v2.4.0
func IntervalValueFromMicroseconds ¶ added in v2.12.1
IntervalValueFromMicroseconds makes Value from microseconds
func JSONDocumentValue ¶
func JSONDocumentValueFromBytes ¶ added in v2.4.0
func JSONValueFromBytes ¶ added in v2.4.0
func OptionalValue ¶
func StringValue ¶
func StringValueFromString ¶ added in v2.4.0
func StructValue ¶
func StructValue(opts ...StructValueOption) Value
func TimestampValue ¶
func TimestampValueFromTime ¶ added in v2.4.0
func TupleValue ¶
func TzDateValue ¶
func TzDateValueFromTime ¶ added in v2.4.0
func TzDatetimeValue ¶
func TzDatetimeValueFromTime ¶ added in v2.4.0
func TzTimestampValue ¶
func TzTimestampValueFromTime ¶ added in v2.4.0
func Uint16Value ¶
func Uint32Value ¶
func Uint64Value ¶
func Uint8Value ¶
func YSONValueFromBytes ¶ added in v2.4.0
Source Files ¶
- balancer.go
- call_info.go
- cluster.go
- conn.go
- conn_addr.go
- conn_runtime.go
- conn_state.go
- conn_stats.go
- conn_use_policy.go
- context.go
- credentials.go
- defaults.go
- dialer.go
- discovery.go
- driver.go
- driver_config.go
- driver_interface.go
- endpoint_info.go
- errors.go
- feature.go
- grpc.go
- invoke.go
- meta.go
- p2c.go
- pem.go
- repeat.go
- resolver.go
- response.go
- retry.go
- rr.go
- time.go
- trace.go
- trace_gtrace.go
- type.go
- value.go
- version.go
- wg.go
- wrap.go
Directories ¶
Path | Synopsis |
---|---|
iam
Package iam provides interface for retrieving and caching iam tokens.
|
Package iam provides interface for retrieving and caching iam tokens. |
cmd
|
|
Package decimal provides tools for working with YDB's decimal type.
|
Package decimal provides tools for working with YDB's decimal type. |
example
|
|
ydbtest
Package ydbtest provides tools for stubbing ydb server up.
|
Package ydbtest provides tools for stubbing ydb server up. |
ydbtypes
Package ydbtypes provides tools for integration ydb types with go/types package.
|
Package ydbtypes provides tools for integration ydb types with go/types package. |
Deprecated: file was moved to ydb package To use it, rename the import to github.com/yandex-cloud/ydb-go-sdk/v2
|
Deprecated: file was moved to ydb package To use it, rename the import to github.com/yandex-cloud/ydb-go-sdk/v2 |
Package opt contains go basic types wrappers to be used when dealing with optional types.
|
Package opt contains go basic types wrappers to be used when dealing with optional types. |
Package ydbsql provides integration of YDB table API with database/sql driver interface.
|
Package ydbsql provides integration of YDB table API with database/sql driver interface. |