From 564c6ed1a299d9b66b636a04d1af7f2fa74a4527 Mon Sep 17 00:00:00 2001 From: Chris Tsang Date: Sat, 19 Jun 2021 21:06:12 +0800 Subject: [PATCH] ColumnDef --- src/entity/column.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/entity/column.rs b/src/entity/column.rs index e31af001..de98c0d7 100644 --- a/src/entity/column.rs +++ b/src/entity/column.rs @@ -227,6 +227,23 @@ impl ColumnType { } } +impl ColumnDef { + pub fn unique(mut self) -> Self { + self.unique = true; + self + } + + pub fn null(mut self) -> Self { + self.null = true; + self + } + + pub fn indexed(mut self) -> Self { + self.indexed = true; + self + } +} + impl Into for ColumnType { fn into(self) -> sea_query::ColumnType { match self {