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

Function column_name_enum_name_2

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

Source from the content-addressed store, hash-verified

918 #[test]
919 #[cfg(feature = "macros")]
920 fn column_name_enum_name_2() {
921 use sea_query::Iden;
922
923 mod hello {
924 use crate as sea_orm;
925 use crate::entity::prelude::*;
926
927 #[derive(Copy, Clone, Default, Debug, DeriveEntity)]
928 pub struct Entity;
929
930 impl EntityName for Entity {
931 fn table_name(&self) -> &str {
932 "hello"
933 }
934 }
935
936 #[derive(Clone, Debug, PartialEq, Eq, DeriveModel, DeriveActiveModel)]
937 pub struct Model {
938 #[sea_orm(enum_name = "IdentityCol")]
939 pub id: i32,
940 #[sea_orm(enum_name = "One1")]
941 pub one: i32,
942 pub two: i32,
943 #[sea_orm(enum_name = "Three3")]
944 pub three: i32,
945 }
946
947 #[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
948 pub enum Column {
949 #[sea_orm(column_name = "ID")]
950 IdentityCol,
951 #[sea_orm(column_name = "ONE")]
952 One1,
953 Two,
954 #[sea_orm(column_name = "THREE")]
955 Three3,
956 }
957
958 impl ColumnTrait for Column {
959 type EntityName = Entity;
960
961 fn def(&self) -> ColumnDef {
962 match self {
963 Column::IdentityCol => ColumnType::Integer.def(),
964 Column::One1 => ColumnType::Integer.def(),
965 Column::Two => ColumnType::Integer.def(),
966 Column::Three3 => ColumnType::Integer.def(),
967 }
968 }
969 }
970
971 #[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
972 pub enum PrimaryKey {
973 IdentityCol,
974 }
975
976 impl PrimaryKeyTrait for PrimaryKey {
977 type ValueType = i32;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected