(column: E::Column)
| 38 | } |
| 39 | |
| 40 | fn json_schema_from_entity_column<E>(column: E::Column) -> Value |
| 41 | where |
| 42 | E: EntityTrait, |
| 43 | { |
| 44 | let mut obj = Map::new(); |
| 45 | |
| 46 | let column_def = column.def(); |
| 47 | obj.insert("name".to_owned(), Value::String(column.to_string())); |
| 48 | obj.insert( |
| 49 | "type".to_owned(), |
| 50 | type_def_from_column_def(&column_def.col_type), |
| 51 | ); |
| 52 | obj.insert("nullable".to_owned(), Value::Bool(column_def.null)); |
| 53 | if column_def.unique { |
| 54 | obj.insert("unique".to_owned(), Value::Bool(true)); |
| 55 | } |
| 56 | if let Some(comment) = column_def.comment { |
| 57 | obj.insert("comment".to_owned(), Value::String(comment)); |
| 58 | } |
| 59 | |
| 60 | Value::Object(obj) |
| 61 | } |
| 62 | |
| 63 | fn type_def_from_column_def(column_type: &ColumnType) -> Value { |
| 64 | match column_type { |
nothing calls this directly
no test coverage detected