mirror of
https://code.sup39.dev/repos/Wqawg
synced 2024-12-29 00:34:54 +09:00
SQL: Move some DBNames to common util module
This commit is contained in:
parent
0904abd7e6
commit
c111f66d7d
6 changed files with 24 additions and 33 deletions
|
@ -24,6 +24,12 @@ module Database.Persist.Local.Sql
|
||||||
, sourceFieldFromProxy
|
, sourceFieldFromProxy
|
||||||
, (?:)
|
, (?:)
|
||||||
, (?++)
|
, (?++)
|
||||||
|
, uedge
|
||||||
|
, temp
|
||||||
|
, tid
|
||||||
|
, tpath
|
||||||
|
, tcycle
|
||||||
|
, tcontains
|
||||||
, FollowDirection (..)
|
, FollowDirection (..)
|
||||||
)
|
)
|
||||||
where
|
where
|
||||||
|
@ -158,3 +164,21 @@ infixr 5 ?:
|
||||||
(?++) :: Maybe [a] -> [a] -> [a]
|
(?++) :: Maybe [a] -> [a] -> [a]
|
||||||
(?++) = maybe id (++)
|
(?++) = maybe id (++)
|
||||||
infixr 5 ?++
|
infixr 5 ?++
|
||||||
|
|
||||||
|
uedge :: DBName
|
||||||
|
uedge = DBName "temp_undirected_edge_cte"
|
||||||
|
|
||||||
|
temp :: DBName
|
||||||
|
temp = DBName "temp_hierarchy_cte"
|
||||||
|
|
||||||
|
tid :: DBName
|
||||||
|
tid = DBName "id"
|
||||||
|
|
||||||
|
tpath :: DBName
|
||||||
|
tpath = DBName "path"
|
||||||
|
|
||||||
|
tcycle :: DBName
|
||||||
|
tcycle = DBName "cycle"
|
||||||
|
|
||||||
|
tcontains :: DBName
|
||||||
|
tcontains = DBName "contains"
|
||||||
|
|
|
@ -120,11 +120,6 @@ xmconnectsm' follow filter msource mdest mlen proxy = do
|
||||||
tEdge = entityDef $ dummyFromSnd proxy
|
tEdge = entityDef $ dummyFromSnd proxy
|
||||||
fwd = persistFieldDef $ destFieldFromProxy proxy
|
fwd = persistFieldDef $ destFieldFromProxy proxy
|
||||||
bwd = persistFieldDef $ sourceFieldFromProxy proxy
|
bwd = persistFieldDef $ sourceFieldFromProxy proxy
|
||||||
uedge = DBName "temp_undirected_edge_cte"
|
|
||||||
temp = DBName "temp_hierarchy_cte"
|
|
||||||
tid = DBName "id"
|
|
||||||
tpath = DBName "path"
|
|
||||||
tcycle = DBName "cycle"
|
|
||||||
dbname = connEscapeName conn
|
dbname = connEscapeName conn
|
||||||
t ^* f = dbname t <> "." <> dbname f
|
t ^* f = dbname t <> "." <> dbname f
|
||||||
t <#> s = dbname t <> " INNER JOIN " <> dbname s
|
t <#> s = dbname t <> " INNER JOIN " <> dbname s
|
||||||
|
|
|
@ -94,11 +94,6 @@ xcyclicn' follow filter minitials proxy = do
|
||||||
tEdge = entityDef $ dummyFromSnd proxy
|
tEdge = entityDef $ dummyFromSnd proxy
|
||||||
fwd = persistFieldDef $ destFieldFromProxy proxy
|
fwd = persistFieldDef $ destFieldFromProxy proxy
|
||||||
bwd = persistFieldDef $ sourceFieldFromProxy proxy
|
bwd = persistFieldDef $ sourceFieldFromProxy proxy
|
||||||
uedge = DBName "temp_undirected_edge_cte"
|
|
||||||
temp = DBName "temp_hierarchy_cte"
|
|
||||||
tid = DBName "id"
|
|
||||||
tpath = DBName "path"
|
|
||||||
tcycle = DBName "cycle"
|
|
||||||
dbname = connEscapeName conn
|
dbname = connEscapeName conn
|
||||||
t ^* f = dbname t <> "." <> dbname f
|
t ^* f = dbname t <> "." <> dbname f
|
||||||
t <#> s = dbname t <> " INNER JOIN " <> dbname s
|
t <#> s = dbname t <> " INNER JOIN " <> dbname s
|
||||||
|
|
|
@ -120,11 +120,6 @@ xmpathm' follow filter msource mdest mlen mlim proxy = do
|
||||||
tEdge = entityDef $ dummyFromSnd proxy
|
tEdge = entityDef $ dummyFromSnd proxy
|
||||||
fwd = persistFieldDef $ destFieldFromProxy proxy
|
fwd = persistFieldDef $ destFieldFromProxy proxy
|
||||||
bwd = persistFieldDef $ sourceFieldFromProxy proxy
|
bwd = persistFieldDef $ sourceFieldFromProxy proxy
|
||||||
uedge = DBName "temp_undirected_edge_cte"
|
|
||||||
temp = DBName "temp_hierarchy_cte"
|
|
||||||
tid = DBName "id"
|
|
||||||
tpath = DBName "path"
|
|
||||||
tcycle = DBName "cycle"
|
|
||||||
dbname = connEscapeName conn
|
dbname = connEscapeName conn
|
||||||
t ^* f = dbname t <> "." <> dbname f
|
t ^* f = dbname t <> "." <> dbname f
|
||||||
t <#> s = dbname t <> " INNER JOIN " <> dbname s
|
t <#> s = dbname t <> " INNER JOIN " <> dbname s
|
||||||
|
|
|
@ -93,11 +93,6 @@ xreachable' follow filter initials mlen proxy = do
|
||||||
tEdge = entityDef $ dummyFromSnd proxy
|
tEdge = entityDef $ dummyFromSnd proxy
|
||||||
fwd = persistFieldDef $ destFieldFromProxy proxy
|
fwd = persistFieldDef $ destFieldFromProxy proxy
|
||||||
bwd = persistFieldDef $ sourceFieldFromProxy proxy
|
bwd = persistFieldDef $ sourceFieldFromProxy proxy
|
||||||
uedge = DBName "temp_undirected_edge_cte"
|
|
||||||
temp = DBName "temp_hierarchy_cte"
|
|
||||||
tid = DBName "id"
|
|
||||||
tpath = DBName "path"
|
|
||||||
tcycle = DBName "cycle"
|
|
||||||
dbname = connEscapeName conn
|
dbname = connEscapeName conn
|
||||||
t ^* f = dbname t <> "." <> dbname f
|
t ^* f = dbname t <> "." <> dbname f
|
||||||
t <#> s = dbname t <> " INNER JOIN " <> dbname s
|
t <#> s = dbname t <> " INNER JOIN " <> dbname s
|
||||||
|
|
|
@ -79,10 +79,6 @@ trrSelect proxy = do
|
||||||
tEdge = entityDef $ dummyFromSnd proxy
|
tEdge = entityDef $ dummyFromSnd proxy
|
||||||
fwd = persistFieldDef $ destFieldFromProxy proxy
|
fwd = persistFieldDef $ destFieldFromProxy proxy
|
||||||
bwd = persistFieldDef $ sourceFieldFromProxy proxy
|
bwd = persistFieldDef $ sourceFieldFromProxy proxy
|
||||||
temp = DBName "temp_hierarchy_cte"
|
|
||||||
tid = DBName "id"
|
|
||||||
tpath = DBName "path"
|
|
||||||
tcycle = DBName "cycle"
|
|
||||||
dbname = connEscapeName conn
|
dbname = connEscapeName conn
|
||||||
ecols = T.intercalate ", " $ entityColumnNames tEdge conn
|
ecols = T.intercalate ", " $ entityColumnNames tEdge conn
|
||||||
qecols name =
|
qecols name =
|
||||||
|
@ -166,10 +162,6 @@ trrApply proxy = do
|
||||||
tEdge = entityDef $ dummyFromSnd proxy
|
tEdge = entityDef $ dummyFromSnd proxy
|
||||||
fwd = persistFieldDef $ destFieldFromProxy proxy
|
fwd = persistFieldDef $ destFieldFromProxy proxy
|
||||||
bwd = persistFieldDef $ sourceFieldFromProxy proxy
|
bwd = persistFieldDef $ sourceFieldFromProxy proxy
|
||||||
temp = DBName "temp_hierarchy_cte"
|
|
||||||
tid = DBName "id"
|
|
||||||
tpath = DBName "path"
|
|
||||||
tcycle = DBName "cycle"
|
|
||||||
dbname = connEscapeName conn
|
dbname = connEscapeName conn
|
||||||
t ^* f = dbname t <> "." <> dbname f
|
t ^* f = dbname t <> "." <> dbname f
|
||||||
t <#> s = dbname t <> " INNER JOIN " <> dbname s
|
t <#> s = dbname t <> " INNER JOIN " <> dbname s
|
||||||
|
@ -258,11 +250,6 @@ trrFix edge proxy = do
|
||||||
tEdge = entityDef $ dummyFromSnd proxy
|
tEdge = entityDef $ dummyFromSnd proxy
|
||||||
fwd = persistFieldDef $ destFieldFromProxy proxy
|
fwd = persistFieldDef $ destFieldFromProxy proxy
|
||||||
bwd = persistFieldDef $ sourceFieldFromProxy proxy
|
bwd = persistFieldDef $ sourceFieldFromProxy proxy
|
||||||
temp = DBName "temp_hierarchy_cte"
|
|
||||||
tid = DBName "id"
|
|
||||||
tpath = DBName "path"
|
|
||||||
tcontains = DBName "cycle"
|
|
||||||
tcycle = DBName "contains"
|
|
||||||
dbname = connEscapeName conn
|
dbname = connEscapeName conn
|
||||||
t ^* f = dbname t <> "." <> dbname f
|
t ^* f = dbname t <> "." <> dbname f
|
||||||
t <#> s = dbname t <> " INNER JOIN " <> dbname s
|
t <#> s = dbname t <> " INNER JOIN " <> dbname s
|
||||||
|
|
Loading…
Reference in a new issue