Skip to content

Suggestion to remove circular module dependency #3

@axiom-a

Description

@axiom-a

There is a circular module dependency between traits.d and types.d that does not look like it needs to be there (the build system I use is very strict on this). The following patch removes it, but it may not be in line with the original intentions.

--git a/source/sqlbuilder/traits.d b/source/sqlbuilder/traits.d
index 47f07a6..2139c0f 100644
--- a/source/sqlbuilder/traits.d
+++ b/source/sqlbuilder/traits.d
@@ -336,16 +336,6 @@ template getAllowNullType(alias sym)
     alias getAllowNullType = result;
 }
 
-template getFetchType(T)
-{
-    static if(is(T == AllowNullType!Args, Args...))
-        alias getFetchType = T.type;
-    else static if(is(T == RowObj!U, U))
-        alias getFetchType = U;
-    else
-        alias getFetchType = T;
-}
-
 
 unittest
 {
diff --git a/source/sqlbuilder/types.d b/source/sqlbuilder/types.d
index 6ced72a..baf8021 100644
--- a/source/sqlbuilder/types.d
+++ b/source/sqlbuilder/types.d
@@ -1,8 +1,17 @@
 module sqlbuilder.types;
-import sqlbuilder.traits;
 
 @safe:
 
+template getFetchType(T)
+{
+    static if(is(T == AllowNullType!Args, Args...))
+        alias getFetchType = T.type;
+    else static if(is(T == RowObj!U, U))
+        alias getFetchType = U;
+    else
+        alias getFetchType = T;
+}
+
 enum Spec : char
 {
     none = '\0',

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions