Created
December 26, 2019 18:53
-
-
Save jiro4989/2f7af0a857bd243300f5333851d74958 to your computer and use it in GitHub Desktop.
import test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const | |
loaded* = true | |
proc exec*(query: string) = | |
echo "db1:" & query |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const | |
loaded* = true | |
proc exec*(query: string) = | |
echo "db2:" & query |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template exec*(query: string) = | |
block: | |
when declared(db1.loaded): | |
db1.exec(query) | |
else: | |
when declared(db2.loaded): | |
db2.exec(query) | |
else: | |
echo "Not exec" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import interfaces | |
import db1 | |
interfaces.exec("SELECT * FROM user") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment