Documentation ¶
Index ¶
- Constants
- func AttributesFilterQueryForSelectBuilder(sl squirrel.SelectBuilder, filter *base.AttributeFilter) squirrel.SelectBuilder
- func AttributesFilterQueryForUpdateBuilder(sl squirrel.UpdateBuilder, filter *base.AttributeFilter) squirrel.UpdateBuilder
- func EnsureDBVersion(db *pgxpool.Pool) (version string, err error)
- func GenerateGCQuery(table string, value uint64) squirrel.DeleteBuilder
- func HandleError(ctx context.Context, span trace.Span, err error, errorCode base.ErrorCode) error
- func IsContextRelatedError(ctx context.Context, err error) bool
- func IsSerializationRelatedError(err error) bool
- func NewContinuousToken(value string) database.ContinuousToken
- func SnapshotQuery(sl squirrel.SelectBuilder, value uint64) squirrel.SelectBuilder
- func TuplesFilterQueryForSelectBuilder(sl squirrel.SelectBuilder, filter *base.TupleFilter) squirrel.SelectBuilder
- func TuplesFilterQueryForUpdateBuilder(sl squirrel.UpdateBuilder, filter *base.TupleFilter) squirrel.UpdateBuilder
- func WaitWithBackoff(ctx context.Context, tenantID string, retries int)
- type ContinuousToken
- type EncodedContinuousToken
Constants ¶
const ( TransactionTemplate = `INSERT INTO transactions (tenant_id) VALUES ($1) RETURNING id` InsertTenantTemplate = `INSERT INTO tenants (id, name) VALUES ($1, $2) RETURNING created_at` DeleteTenantTemplate = `DELETE FROM tenants WHERE id = $1 RETURNING name, created_at` DeleteAllByTenantTemplate = `DELETE FROM %s WHERE tenant_id = $1` )
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 EnsureDBVersion ¶ added in v0.7.1
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
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
IsContextRelatedError checks if the error is due to context cancellation, deadline exceedance, or closed connection
func IsSerializationRelatedError ¶ added in v0.7.1
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 -
Types ¶
type ContinuousToken ¶
type ContinuousToken struct {
Value string
}
ContinuousToken - Structure for continuous token
func (ContinuousToken) Encode ¶
func (t ContinuousToken) Encode() database.EncodedContinuousToken
Encode - Encodes the token to a string
type EncodedContinuousToken ¶
type EncodedContinuousToken struct {
Value string
}
EncodedContinuousToken - Structure for encoded continuous token
func (EncodedContinuousToken) Decode ¶
func (t EncodedContinuousToken) Decode() (database.ContinuousToken, error)
Decode decodes the token from a string
func (EncodedContinuousToken) String ¶
func (t EncodedContinuousToken) String() string
Decode decodes the token from a string