Expand description
YDB SDK - a client for YDB.
§Example
// create driver
let client = ClientBuilder::new_from_connection_string("grpc://localhost:2136?database=local")?
.with_credentials(StaticToken::from("asd"))
.client()?;
// wait until driver background initialization finish
client.wait().await?;
// read query result
let sum: i32 = client
.table_client() // create table client
.retry_transaction(|mut t| async move {
// code in transaction can retry few times if was some retriable error
// send query to database
let res = t.query(Query::from("SELECT 1 + 1 AS sum")).await?;
// read exact one result from db
let field_val: i32 = res.into_only_row()?.remove_field_by_name("sum")?.try_into()?;
// return result
return Ok(field_val);
})
.await?;
// it will print "sum: 2"
println!("sum: {}", sum);
§More examples
Macros§
- ydb_
params - sugar for manual construct query params
- ydb_
struct - Sugar for manual construct structs Example:
Structs§
- Access
Token Credentials - Credentials with static token without renewing
- Acquire
Options - Acquire
Options Builder - Builder for
AcquireOptions
. - Alter
Consumer - Alter
Consumer Builder - Builder for
AlterConsumer
. - Alter
Topic Options - Alter
Topic Options Builder - Builder for
AlterTopicOptions
. - Anonymous
Credentials - Bytes
- Client
- YDB client
- Client
Builder - Codec
- Command
Line Credentials - Get from stdout of command
- Consumer
- Consumer
Builder - Builder for
Consumer
. - Coordination
Client - Coordination
Session - Create
Topic Options - Create
Topic Options Builder - Builder for
CreateTopicOptions
. - Describe
Options - Describe
Options Builder - Builder for
DescribeOptions
. - Describe
Topic Options - Describe
Topic Options Builder - Builder for
DescribeTopicOptions
. - Discovery
State - Current discovery state
- From
EnvCredentials - GCEMetadata
- Get instance service account token from GCE instance
- Lease
- Metadata
UrlCredentials - Get token of service account of instance
- Node
Config - Node
Config Builder - Builder for
NodeConfig
. - Node
Description - Partition
Info - PartitionInfo contains info about partition.
- Partition
Location - Partition
Stats - Partitioning
Settings - Query
- Query object
- Query
Result - Result
Set - Result
SetRows Iter - Retry
Options - Retry options
- Row
- Scheme
Client - Scheme
Entry - Scheme
Permissions - Service
Account Credentials - Get service account credentials instance service account key should be:
- Session
Options - Session
Options Builder - Builder for
SessionOptions
. - Signed
Interval - Static
Credentials - Static
Discovery - Always discovery once static node
- Stream
Result - Table
Client - Client for YDB table service (SQL queries)
- Token
Info - Topic
Client - Topic
Description - TopicDescription contains info about topic.
- Topic
Stats - Topic
Writer - TopicWriter at initial state of implementation it really doesn’t ready for use. For example It isn’t handle lost connection to the server and have some unimplemented method.
- Topic
Writer Connection Options - Topic
Writer Message - Topic
Writer Message Builder - Builder for
TopicWriterMessage
. - Topic
Writer Options - Topic
Writer Options Builder - Builder for
TopicWriterOptions
. - Topic
Writer Retry Settings - Transaction
Options - Options for create transaction
- Value
List - Value
Optional - Value
Struct - Watch
Options - Watch
Options Builder - Builder for
WatchOptions
. - YdbIssue
- Describe issue from server
- YdbStatus
Error - Describe operation status from server
Enums§
- Consistency
Mode - Metering
Mode - Mode
- Rate
Limiter Counters Mode - Scheme
Entry Type - Sign
- Value
- Internal represent database value for send to or received from database.
- Watch
Mode - YdbError
- Error which can be returned from the crate.
- YdbIssue
Severity - Severity of issue
- YdbOr
Customer Error - Error for wrap user errors while return it from callback
Traits§
- Credentials
- Discovery
- Discovery YDB endpoints
- Transaction
- Waiter
Type Aliases§
- Command
Line YcToken Deprecated - Static
Credentials Auth Deprecated - Static
Token Deprecated - Yandex
Metadata Deprecated - YdbResult
- T result or YdbError as Error
- YdbResult
With Customer Err - T result or YdbOrCustomerError as Error