package kv
import "github.com/ydb-platform/ydb-go-sdk/v3/internal/kv"
Index ¶
- type Endpoints
- type FieldType
- type KeyValue
- func Any(key string, value interface{}) KeyValue
- func Bool(key string, value bool) KeyValue
- func Duration(key string, value time.Duration) KeyValue
- func Error(value error) KeyValue
- func Int(k string, v int) KeyValue
- func Int64(k string, v int64) KeyValue
- func Latency(start time.Time) KeyValue
- func NamedError(key string, value error) KeyValue
- func String(k, v string) KeyValue
- func Stringer(key string, value fmt.Stringer) KeyValue
- func Strings(key string, value []string) KeyValue
- func Version() KeyValue
- func (f KeyValue) AnyValue() interface{}
- func (f KeyValue) BoolValue() bool
- func (f KeyValue) DurationValue() time.Duration
- func (f KeyValue) ErrorValue() error
- func (f KeyValue) Int64Value() int64
- func (f KeyValue) IntValue() int
- func (f KeyValue) Key() string
- func (f KeyValue) String() string
- func (f KeyValue) StringValue() string
- func (f KeyValue) Stringer() fmt.Stringer
- func (f KeyValue) StringsValue() []string
- func (f KeyValue) Type() FieldType
- type Metadata
Types ¶
type Endpoints ¶
type Endpoints []trace.EndpointInfo
func (Endpoints) String ¶
type FieldType ¶
type FieldType int
FieldType indicates type info about the KeyValue. This enum might be extended in future releases. Adapters that don't support some FieldType value should use KeyValue.Fallback() for marshaling.
const ( // InvalidType indicates that KeyValue was not initialized correctly. Adapters // should either ignore such field or issue an error. No value getters should // be called on field with such type. InvalidType FieldType = iota IntType Int64Type StringType BoolType DurationType // StringsType corresponds to []string StringsType ErrorType // AnyType indicates that the KeyValue is untyped. Adapters should use // reflection-based approached to marshal this field. AnyType // StringerType corresponds to fmt.Stringer StringerType )
func (FieldType) String ¶
type KeyValue ¶
type KeyValue struct {
// contains filtered or unexported fields
}
KeyValue represents typed log field (a key-value pair). Adapters should determine KeyValue's type based on Type and use the corresponding getter method to retrieve the value:
switch f.Type() { case logs.IntType: var i int = f.Int() // handle int value case logs.StringType: var s string = f.String() // handle string value //... }
Getter methods must not be called on fields with wrong Type (e.g. calling String() on fields with Type != StringType). KeyValue must not be initialized directly as a struct literal.
func Any ¶
Any constructs untyped KeyValue.
func Bool ¶
Bool constructs KeyValue with BoolType
func Duration ¶
Duration constructs KeyValue with DurationType
func Error ¶
Error is the same as NamedError("error", value)
func Int ¶
Int constructs KeyValue with IntType
func Int64 ¶
func Latency ¶
Latency creates KeyValue "latency": time.Since(start)
func NamedError ¶
NamedError constructs KeyValue with ErrorType
func String ¶
String constructs KeyValue with StringType
func Stringer ¶
Stringer constructs KeyValue with StringerType. If value is nil, resulting KeyValue will be of AnyType instead of StringerType.
func Strings ¶
Strings constructs KeyValue with StringsType
func Version ¶
func Version() KeyValue
Version creates KeyValue "version": version.Version
func (KeyValue) AnyValue ¶
func (f KeyValue) AnyValue() interface{}
AnyValue is a value getter for fields with AnyType type
func (KeyValue) BoolValue ¶
BoolValue is a value getter for fields with BoolType type
func (KeyValue) DurationValue ¶
DurationValue is a value getter for fields with DurationType type
func (KeyValue) ErrorValue ¶
ErrorValue is a value getter for fields with ErrorType type
func (KeyValue) Int64Value ¶
Int64Value is a value getter for fields with Int64Type type
func (KeyValue) IntValue ¶
IntValue is a value getter for fields with IntType type
func (KeyValue) Key ¶
func (KeyValue) String ¶
Returns default string representation of KeyValue value. It should be used by adapters that don't support f.Type directly.
func (KeyValue) StringValue ¶
StringValue is a value getter for fields with StringType type
func (KeyValue) Stringer ¶
Stringer is a value getter for fields with StringerType type
func (KeyValue) StringsValue ¶
StringsValue is a value getter for fields with StringsType type
func (KeyValue) Type ¶
type Metadata ¶
func (Metadata) String ¶
Source Files ¶
- Version
- v3.99.4
- Published
- Feb 4, 2025
- Platform
- linux/amd64
- Imports
- 8 packages
- Last checked
- 7 minutes ago –
Tools for package owners.