persistence

package
v0.0.0-...-984cbf5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 29, 2024 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeBool      = ydb_types.TypeBool
	TypeInt32     = ydb_types.TypeInt32
	TypeUint32    = ydb_types.TypeUint32
	TypeInt64     = ydb_types.TypeInt64
	TypeUint64    = ydb_types.TypeUint64
	TypeTimestamp = ydb_types.TypeTimestamp
	TypeString    = ydb_types.TypeString
	TypeBytes     = ydb_types.TypeBytes
	TypeUTF8      = ydb_types.TypeText
)

Variables

This section is empty.

Functions

func IsTransportError

func IsTransportError(err error, codes ...grpc_codes.Code) bool

func List

func List(t Type) ydb_types.Type

func Optional

func Optional(t ydb_types.Type) ydb_types.Type

func OptionalWithDefault

func OptionalWithDefault(
	columnName string,
	destinationValueReference interface{},
) ydb_named.Value

func ReadColumn

func ReadColumn(name string) ydb_options.ReadTableOption

func ReadGreaterOrEqual

func ReadGreaterOrEqual(v Value) ydb_options.ReadTableOption

func ReadLessOrEqual

func ReadLessOrEqual(v Value) ydb_options.ReadTableOption

func ReadOrdered

func ReadOrdered() ydb_options.ReadTableOption

func StructFieldValue

func StructFieldValue(name string, v Value) ydb_types.StructValueOption

func ValueParam

func ValueParam(name string, v Value) ydb_table.ParameterOption

func WithCredentials

func WithCredentials(creds ydb_credentials.Credentials) option

func WithDetails

func WithDetails(details trace.Details) option

func WithRegistry

func WithRegistry(registry metrics.Registry) option

func WithTraceDetails

func WithTraceDetails(details ydb_trace.Details) metricsOption

func WithTraces

func WithTraces(
	registry metrics.Registry,
	opts ...metricsOption,
) ydb.Option

Types

type CreateTableDescription

type CreateTableDescription struct {
	Columns                []ydb_options.Column
	PrimaryKey             []string
	SecondaryKeys          []string
	ColumnFamilies         []ydb_options.ColumnFamily
	UniformPartitions      uint64
	ExternalBlobsMediaKind string
}

func NewCreateTableDescription

func NewCreateTableDescription(opts ...CreateTableOption) CreateTableDescription

type CreateTableOption

type CreateTableOption func(*CreateTableDescription)

func WithColumn

func WithColumn(name string, typ Type) CreateTableOption

func WithColumnAndFamily

func WithColumnAndFamily(name string, typ Type, family string) CreateTableOption

func WithColumnFamilies

func WithColumnFamilies(cf ...ydb_options.ColumnFamily) CreateTableOption

func WithExternalBlobs

func WithExternalBlobs(mediaKind string) CreateTableOption

func WithPrimaryKeyColumn

func WithPrimaryKeyColumn(columns ...string) CreateTableOption

func WithSecondaryKeyColumn

func WithSecondaryKeyColumn(columns ...string) CreateTableOption

func WithUniformPartitions

func WithUniformPartitions(n uint64) CreateTableOption

type RawValue

type RawValue = ydb_types.RawValue

type Result

type Result struct {
	// contains filtered or unexported fields
}

func (*Result) Close

func (r *Result) Close() error

func (*Result) Err

func (r *Result) Err() error

func (*Result) NextResultSet

func (r *Result) NextResultSet(ctx context.Context, columns ...string) bool

func (*Result) NextRow

func (r *Result) NextRow() bool

func (*Result) Scan

func (r *Result) Scan(values ...ydb_indexed.RequiredOrOptional) error

func (*Result) ScanNamed

func (r *Result) ScanNamed(namedValues ...ydb_named.Value) error

func (*Result) ScanWithDefaults

func (r *Result) ScanWithDefaults(values ...ydb_indexed.Required) error

type S3Client

type S3Client struct {
	// contains filtered or unexported fields
}

func NewS3Client

func NewS3Client(
	endpoint string,
	region string,
	credentials S3Credentials,
	callTimeout time.Duration,
	registry metrics.Registry,
) (*S3Client, error)

func NewS3ClientFromConfig

func NewS3ClientFromConfig(
	config *persistence_config.S3Config,
	registry metrics.Registry,
) (*S3Client, error)

func (*S3Client) CreateBucket

func (c *S3Client) CreateBucket(
	ctx context.Context,
	bucket string,
) (err error)

func (*S3Client) DeleteObject

func (c *S3Client) DeleteObject(
	ctx context.Context,
	bucket string,
	key string,
) (err error)

func (*S3Client) GetObject

func (c *S3Client) GetObject(
	ctx context.Context,
	bucket string,
	key string,
) (o S3Object, err error)

func (*S3Client) PutObject

func (c *S3Client) PutObject(
	ctx context.Context,
	bucket string,
	key string,
	object S3Object,
) (err error)

type S3Credentials

type S3Credentials struct {
	ID     string `json:"id,omitempty"`
	Secret string `json:"secret,omitempty"`
}

func NewS3Credentials

func NewS3Credentials(id, secret string) S3Credentials

func NewS3CredentialsFromFile

func NewS3CredentialsFromFile(filePath string) (S3Credentials, error)

type S3Object

type S3Object struct {
	Data     []byte
	Metadata map[string]*string
}

type Session

type Session struct {
	// contains filtered or unexported fields
}

func (*Session) BeginRWTransaction

func (s *Session) BeginRWTransaction(
	ctx context.Context,
) (tx *Transaction, err error)

func (*Session) ExecuteRO

func (s *Session) ExecuteRO(
	ctx context.Context,
	query string,
	params ...ydb_table.ParameterOption,
) (Result, error)

func (*Session) ExecuteRW

func (s *Session) ExecuteRW(
	ctx context.Context,
	query string,
	params ...ydb_table.ParameterOption,
) (Result, error)

func (*Session) StreamExecuteRO

func (s *Session) StreamExecuteRO(
	ctx context.Context,
	query string,
	params ...ydb_table.ParameterOption,
) (Result, error)

func (*Session) StreamReadTable

func (s *Session) StreamReadTable(
	ctx context.Context,
	path string,
	opts ...ydb_options.ReadTableOption,
) (Result, error)

type Transaction

type Transaction struct {
	// contains filtered or unexported fields
}

func (*Transaction) Commit

func (t *Transaction) Commit(ctx context.Context) (err error)

func (*Transaction) Execute

func (t *Transaction) Execute(
	ctx context.Context,
	query string,
	params ...ydb_table.ParameterOption,
) (res Result, err error)

func (*Transaction) Rollback

func (t *Transaction) Rollback(ctx context.Context) (err error)

type Type

type Type = ydb_types.Type

type Value

type Value = ydb_types.Value

func BoolValue

func BoolValue(v bool) Value

func BytesValue

func BytesValue(v []byte) Value

func DatetimeValueFromTime

func DatetimeValueFromTime(t time.Time) Value

func DoubleValue

func DoubleValue(v float64) Value

func FloatValue

func FloatValue(v float32) Value

func Int32Value

func Int32Value(v int32) Value

func Int64Value

func Int64Value(v int64) Value

func ListValue

func ListValue(items ...Value) Value

func OptionalValue

func OptionalValue(v Value) Value

func StringValue

func StringValue(v []byte) Value

func StructValue

func StructValue(opts ...ydb_types.StructValueOption) Value

func TimestampValue

func TimestampValue(t time.Time) Value

func TupleValue

func TupleValue(values ...Value) Value

func UTF8Value

func UTF8Value(v string) Value

func Uint32Value

func Uint32Value(v uint32) Value

func Uint64Value

func Uint64Value(v uint64) Value

func ZeroValue

func ZeroValue(t Type) Value

type YDBClient

type YDBClient struct {
	// contains filtered or unexported fields
}

func NewYDBClient

func NewYDBClient(
	ctx context.Context,
	config *persistence_config.PersistenceConfig,
	registry metrics.Registry,
	opts ...option,
) (*YDBClient, error)

func (*YDBClient) AbsolutePath

func (c *YDBClient) AbsolutePath(elem ...string) string

func (*YDBClient) Close

func (c *YDBClient) Close(ctx context.Context) error

func (*YDBClient) CreateOrAlterTable

func (c *YDBClient) CreateOrAlterTable(
	ctx context.Context,
	folder string,
	name string,
	description CreateTableDescription,
	dropUnusedColumns bool,
) error

func (*YDBClient) DropTable

func (c *YDBClient) DropTable(
	ctx context.Context,
	folder string,
	name string,
) error

func (*YDBClient) Execute

func (c *YDBClient) Execute(
	ctx context.Context,
	op func(context.Context, *Session) error,
) error

func (*YDBClient) ExecuteRO

func (c *YDBClient) ExecuteRO(
	ctx context.Context,
	query string,
	params ...ydb_table.ParameterOption,
) (Result, error)

func (*YDBClient) ExecuteRW

func (c *YDBClient) ExecuteRW(
	ctx context.Context,
	query string,
	params ...ydb_table.ParameterOption,
) (Result, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL