fsqlite-ext-misc
Miscellaneous extensions for FrankenSQLite: generate_series, decimal arithmetic, and UUID generation.
Overview
This crate bundles three independent extension families that do not warrant their own crates:
-
generate_series(START, STOP [, STEP]): A table-valued function (virtual table) that generates a sequence of integers, commonly used in joins and CTEs for generating test data or numeric ranges.
-
Decimal arithmetic: Exact string-based decimal operations that avoid floating-point precision loss. Functions include
decimal(normalize),decimal_add,decimal_sub,decimal_mul, anddecimal_cmp. -
UUID generation:
uuid()generates random UUID v4 strings,uuid_strconverts a 16-byte blob to a UUID string, anduuid_blobconverts a UUID string to a 16-byte blob.
This crate depends on fsqlite-types, fsqlite-error, fsqlite-func (for scalar function and virtual table traits), and tracing.
Key Types
GenerateSeriesTable- Virtual table implementation forgenerate_series()(implementsVirtualTable)GenerateSeriesCursor- Cursor for iterating over a generated integer series (implementsVirtualTableCursor)DecimalFunc- Scalar function to normalize a decimal string to canonical formDecimalAddFunc- Scalar function for exact decimal additionDecimalSubFunc- Scalar function for exact decimal subtractionDecimalMulFunc- Scalar function for exact decimal multiplicationDecimalCmpFunc- Scalar function for exact decimal comparisonUuidFunc- Scalar function generating random UUID v4 stringsUuidStrFunc- Scalar function converting a 16-byte blob to a UUID stringUuidBlobFunc- Scalar function converting a UUID string to a 16-byte blob
Key Functions
extension_name()- Returns"misc"register_misc_scalars(registry)- Register all miscellaneous scalar functions (decimal and UUID) into a function registry
Dependencies
fsqlite-typesfsqlite-errorfsqlite-functracing
License
MIT