#twilight #discord #discord-api #back-end #api-bindings

yanked sparkle-cache-postgres

Discord cache implementation using PostgresSQL for the Twilight ecosystem

0.14.1 Nov 20, 2022
0.14.0 Nov 18, 2022
0.13.3 Nov 6, 2022
0.13.2 Nov 6, 2022
0.13.1 Nov 6, 2022

#29 in #twilight

ISC license

110KB
3K SLoC

Rust 2K SLoC // 0.0% comments SQL 1K SLoC

Sparkle Cache Postgres

GitHub crates.io docs.rs

Discord cache implementation using PostgresSQL for the Twilight ecosystem

It provides a cache struct that implements Sparkle Cache's traits and uses SQLx as the backend driver

It also provides access to the cache's backend, meaning you can use the same database for your custom data

Compile-time verification

To use SQLx's compile time verification, set the DATABASE_URL environment variable to the URL of your database, for example, DATABASE_URL=postgresql://localhost:5432/sparkle

Stability

This is a new, relatively immature library. It passes Sparkle Cache's tests, but of course there may be points not covered by them. If there's a bug directly related to the PostgresSQL implementation, please create an issue

Sparkle Cache's tests currently don't cover stickers because of a bug in Twilight

The library casts unsigned integers except for IDs internally, so please don't use integer-based functions such as SUM or equality/size checks on them in SQL, instead query the data and use Rust equivalents

Features

TLS Backend

  • rustls (Default): Enables the runtime-tokio-rustls feature of SQLx
  • native-tls: Enables the runtime-tokio-native-tls feature of SQLx

Only one of these features can be selected

Dependencies

~12–28MB
~454K SLoC