MCPcopy Create free account
hub / github.com/SeaQL/sea-orm / create_enum_from_entity

Function create_enum_from_entity

src/schema/entity.rs:113–131  ·  view source on GitHub ↗
(_: E, backend: DbBackend)

Source from the content-addressed store, hash-verified

111
112#[allow(clippy::needless_borrow)]
113pub(crate) fn create_enum_from_entity<E>(_: E, backend: DbBackend) -> Vec<TypeCreateStatement>
114where
115 E: EntityTrait,
116{
117 if matches!(backend, DbBackend::MySql | DbBackend::Sqlite) {
118 return Vec::new();
119 }
120 let mut vec = Vec::new();
121 for col in E::Column::iter() {
122 let col_def = col.def();
123 let col_type = col_def.get_column_type();
124 if !matches!(col_type, ColumnType::Enum { .. }) {
125 continue;
126 }
127 let stmt = create_enum_from_column_type(&col_type);
128 vec.push(stmt);
129 }
130 vec
131}
132
133pub(crate) fn create_index_from_entity<E>(
134 entity: E,

Callers 1

Calls 5

get_column_typeMethod · 0.80
pushMethod · 0.80
newFunction · 0.50
defMethod · 0.45

Tested by

no test coverage detected