Commit 592980b5 authored by Katharina Fey's avatar Katharina Fey 🏴
Browse files

Implementing "any primary key" feature and default redering

This PR changes the way that the `types::primary()` builder works and
adds a `primary(bool)` function to the Type pattern. The `PRIMARY`
base type still exists, but is handled seperately, for Pg reasons
(should be removed next version).  All other types that use the
`primary(...)` function will be able to become `PRIMARY KEY` in the
generated SQL.

Additionally this PR fixes the way that `WrappedDefault` values are
encoded. i.e. it is now possible to properly specify a default value
that is then mapped into the apropriate type.
parent 4fb981bf
......@@ -132,6 +132,11 @@ impl Type {
Self { primary: arg, ..self }
/// Specify if this type should be a primary key
pub fn primary(self, arg: bool) -> Self {
Self { primary: arg, ..self }
/// Provide a default value for a type column
pub fn default(self, arg: impl Into<WrappedDefault<'static>>) -> Self {
Self { default: Some(arg.into()), ..self }
......@@ -3,6 +3,7 @@
mod builders;
mod defaults;
mod impls;
mod defaults;
pub use self::builders::*;
pub use self::defaults::WrappedDefault;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment