Skip to main content

JsonTable

Struct JsonTable 

Source
pub struct JsonTable<T: 'static> {
    pub name: &'static str,
    pub primary_key: &'static str,
    pub indexes: &'static [IndexSpec<T>],
    pub unique_constraints: &'static [&'static [&'static str]],
}
Expand description

Full table specification: name + the ordered list of indexed columns.

Shared across open/reopen so a downstream shim can keep the same layout forever without duplicating strings.

The 'static bound on T is required because indexes is a &'static [IndexSpec<T>] — the compiler needs to know any T referenced by the static slice is itself valid for 'static. Every concrete record type we store (e.g. StoredNotifier) owns its data, so this bound is always satisfied in practice.

Fields§

§name: &'static str

SQL table name. Must be a valid SQL identifier; splat directly into DDL, so this MUST be a compile-time string literal.

§primary_key: &'static str

Name of the primary-key column. Defaults to "id" for every store created fresh by this codebase. It exists as a knob so a pre-existing on-disk schema whose primary key is named something else can be routed through this adapter without a destructive migration — the deployments table, for instance, has had name TEXT PRIMARY KEY since before the adapter existed, so it sets primary_key: "name". Like every other identifier on this struct it is splat directly into the DDL/queries, so it MUST be a compile-time string literal.

§indexes: &'static [IndexSpec<T>]

Indexed columns. May be empty for pure blob-only tables.

§unique_constraints: &'static [&'static [&'static str]]

Compound UNIQUE(col_a, col_b, ...) constraints emitted at CREATE TABLE time. Each inner slice becomes one UNIQUE(...) clause in the generated DDL. For single-column uniqueness prefer IndexSpec::unique = true — it’s flatter. Use this field when uniqueness spans two or more columns (e.g. UNIQUE(name, scope)).

Every column name referenced here MUST also appear in indexes so that it’s peeled out of T at write time; otherwise the CREATE TABLE statement will reference a column that doesn’t exist. The column names are splat directly into the DDL, so they MUST be compile-time string literals. May be empty when no compound constraints are needed.

Auto Trait Implementations§

§

impl<T> Freeze for JsonTable<T>

§

impl<T> RefUnwindSafe for JsonTable<T>

§

impl<T> Send for JsonTable<T>

§

impl<T> Sync for JsonTable<T>

§

impl<T> Unpin for JsonTable<T>

§

impl<T> UnsafeUnpin for JsonTable<T>

§

impl<T> UnwindSafe for JsonTable<T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more