Runlight.Db.Prefixed (runlight v0.3.2)

Copy Markdown View Source

A Runlight.Db whose tables and indexes start with a prefix in place of rl_, such as wp_rl_ inside WordPress, so two apps sharing one database each keep a set of their own (the SDK's prefixed()). Runlight's SQL names every table and index rl_ and something, and those names alone are rewritten on the way through, in each statement and in the names a schema check compares as text. A store given a prefix puts one in front of its Db, so the accounts and importers that reach the Db through the store follow it too.

Runlight.Db.Prefixed.new(Runlight.Db.Ecto.new(repo: MyApp.Repo), "wp_rl_")

Values bound as parameters are not rewritten.

Summary

Functions

The Db with every rl_ name under prefix: up to 32 letters, digits, and underscores, not starting with a digit.

The prefix a Db was made with, or nil when it is not a prefixed one.

Functions

new(inner, prefix)

@spec new(Runlight.Db.t(), String.t()) :: Runlight.Db.t()

The Db with every rl_ name under prefix: up to 32 letters, digits, and underscores, not starting with a digit.

prefix_of(db)

@spec prefix_of(Runlight.Db.t()) :: String.t() | nil

The prefix a Db was made with, or nil when it is not a prefixed one.