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

Function enum_name_2

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

Source from the content-addressed store, hash-verified

811 #[test]
812 #[cfg(feature = "macros")]
813 fn enum_name_2() {
814 use sea_query::Iden;
815
816 mod hello {
817 use crate as sea_orm;
818 use crate::entity::prelude::*;
819
820 #[derive(Copy, Clone, Default, Debug, DeriveEntity)]
821 pub struct Entity;
822
823 impl EntityName for Entity {
824 fn table_name(&self) -> &str {
825 "hello"
826 }
827 }
828
829 #[derive(Clone, Debug, PartialEq, Eq, DeriveModel, DeriveActiveModel)]
830 pub struct Model {
831 pub id: i32,
832 #[sea_orm(enum_name = "One1")]
833 pub one: i32,
834 pub two: i32,
835 #[sea_orm(enum_name = "Three3")]
836 pub three: i32,
837 }
838
839 #[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
840 pub enum Column {
841 Id,
842 One1,
843 Two,
844 Three3,
845 }
846
847 impl ColumnTrait for Column {
848 type EntityName = Entity;
849
850 fn def(&self) -> ColumnDef {
851 match self {
852 Column::Id => ColumnType::Integer.def(),
853 Column::One1 => ColumnType::Integer.def(),
854 Column::Two => ColumnType::Integer.def(),
855 Column::Three3 => ColumnType::Integer.def(),
856 }
857 }
858 }
859
860 #[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
861 pub enum PrimaryKey {
862 Id,
863 }
864
865 impl PrimaryKeyTrait for PrimaryKey {
866 type ValueType = i32;
867
868 fn auto_increment() -> bool {
869 true
870 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected