utils

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BulkEntityFilterTemplate = `` /* 503-byte string literal not displayed */

)

Variables

This section is empty.

Functions

func AttributesFilterQueryForSelectBuilder added in v0.5.0

func AttributesFilterQueryForSelectBuilder(sl squirrel.SelectBuilder, filter *base.AttributeFilter) squirrel.SelectBuilder

AttributesFilterQueryForSelectBuilder -

func AttributesFilterQueryForUpdateBuilder added in v0.5.0

func AttributesFilterQueryForUpdateBuilder(sl squirrel.UpdateBuilder, filter *base.AttributeFilter) squirrel.UpdateBuilder

AttributesFilterQueryForUpdateBuilder -

func BulkEntityFilterQuery added in v0.5.0

func BulkEntityFilterQuery(tenantID, entityType string, snap uint64) string

BulkEntityFilterQuery -

func EnsureDBVersion added in v0.7.1

func EnsureDBVersion(db *sql.DB) (version int, err error)

EnsureDBVersion checks the version of the given database connection and returns an error if the version is not supported.

func GenerateGCQuery added in v0.5.0

func GenerateGCQuery(table string, value uint64) squirrel.DeleteBuilder

GenerateGCQuery generates a Squirrel DELETE query builder for garbage collection. It constructs a query to delete expired records from the specified table based on the provided value, which represents a transaction ID.

func HandleError added in v0.6.2

func HandleError(ctx context.Context, span trace.Span, err error, errorCode base.ErrorCode) error

HandleError records an error in the given span, logs the error, and returns a standardized error. This function is used for consistent error handling across different parts of the application.

func IsContextRelatedError added in v0.6.9

func IsContextRelatedError(ctx context.Context, err error) bool

IsContextRelatedError checks if the error is due to context cancellation, deadline exceedance, or closed connection

func IsSerializationRelatedError added in v0.7.1

func IsSerializationRelatedError(err error) bool

IsSerializationRelatedError checks if the error is a serialization failure, typically in database transactions.

func NewContinuousToken

func NewContinuousToken(value string) database.ContinuousToken

NewContinuousToken - Creates a new continuous token

func SnapshotQuery

func SnapshotQuery(sl squirrel.SelectBuilder, value uint64) squirrel.SelectBuilder

SnapshotQuery adds conditions to a SELECT query for checking transaction visibility based on created and expired transaction IDs. The query checks if transactions are visible in a snapshot associated with the provided value.

func TuplesFilterQueryForSelectBuilder added in v0.5.0

func TuplesFilterQueryForSelectBuilder(sl squirrel.SelectBuilder, filter *base.TupleFilter) squirrel.SelectBuilder

TuplesFilterQueryForSelectBuilder -

func TuplesFilterQueryForUpdateBuilder added in v0.5.0

func TuplesFilterQueryForUpdateBuilder(sl squirrel.UpdateBuilder, filter *base.TupleFilter) squirrel.UpdateBuilder

TuplesFilterQueryForUpdateBuilder -

func WaitWithBackoff added in v0.7.1

func WaitWithBackoff(ctx context.Context, tenantID string, retries int)

WaitWithBackoff implements an exponential backoff strategy with jitter for retries. It waits for a calculated duration or until the context is cancelled, whichever comes first.

Types

type ContinuousToken

type ContinuousToken struct {
	Value string
}

ContinuousToken - Structure for continuous token

func (ContinuousToken) Encode

Encode - Encodes the token to a string

type EncodedContinuousToken

type EncodedContinuousToken struct {
	Value string
}

EncodedContinuousToken - Structure for encoded continuous token

func (EncodedContinuousToken) Decode

Decode decodes the token from a string

func (EncodedContinuousToken) String

func (t EncodedContinuousToken) String() string

Decode decodes the token from a string

Jump to

Keyboard shortcuts

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