Skip to content

Instantly share code, notes, and snippets.

@jiro4989
Created December 26, 2019 18:53
Show Gist options
  • Save jiro4989/2f7af0a857bd243300f5333851d74958 to your computer and use it in GitHub Desktop.
Save jiro4989/2f7af0a857bd243300f5333851d74958 to your computer and use it in GitHub Desktop.
import test
const
loaded* = true
proc exec*(query: string) =
echo "db1:" & query
const
loaded* = true
proc exec*(query: string) =
echo "db2:" & query
template exec*(query: string) =
block:
when declared(db1.loaded):
db1.exec(query)
else:
when declared(db2.loaded):
db2.exec(query)
else:
echo "Not exec"
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