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

Function column_name_2

src/entity/column.rs:708–777  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

706 #[test]
707 #[cfg(feature = "macros")]
708 fn column_name_2() {
709 use sea_query::Iden;
710
711 mod hello {
712 use crate as sea_orm;
713 use crate::entity::prelude::*;
714
715 #[derive(Copy, Clone, Default, Debug, DeriveEntity)]
716 pub struct Entity;
717
718 impl EntityName for Entity {
719 fn table_name(&self) -> &str {
720 "hello"
721 }
722 }
723
724 #[derive(Clone, Debug, PartialEq, Eq, DeriveModel, DeriveActiveModel)]
725 pub struct Model {
726 pub id: i32,
727 pub one: i32,
728 pub two: i32,
729 pub three: i32,
730 }
731
732 #[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
733 pub enum Column {
734 Id,
735 #[sea_orm(column_name = "ONE")]
736 One,
737 Two,
738 #[sea_orm(column_name = "3")]
739 Three,
740 }
741
742 impl ColumnTrait for Column {
743 type EntityName = Entity;
744
745 fn def(&self) -> ColumnDef {
746 match self {
747 Column::Id => ColumnType::Integer.def(),
748 Column::One => ColumnType::Integer.def(),
749 Column::Two => ColumnType::Integer.def(),
750 Column::Three => ColumnType::Integer.def(),
751 }
752 }
753 }
754
755 #[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
756 pub enum PrimaryKey {
757 Id,
758 }
759
760 impl PrimaryKeyTrait for PrimaryKey {
761 type ValueType = i32;
762
763 fn auto_increment() -> bool {
764 true
765 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected