syndesizer/sqlite_actor: move out compile conditional
This commit is contained in:
parent
29b19c711c
commit
119d89ff1c
|
@ -7,19 +7,22 @@ import syndicate, syndicate/relays, syndicate/actors/timers
|
||||||
|
|
||||||
const
|
const
|
||||||
withPostgre* {.booldefine.}: bool = true
|
withPostgre* {.booldefine.}: bool = true
|
||||||
|
withSqlite* {.booldefine.}: bool = true
|
||||||
|
|
||||||
import ./syndesizer/[
|
import ./syndesizer/[
|
||||||
cache_actor,
|
cache_actor,
|
||||||
file_system_usage,
|
file_system_usage,
|
||||||
json_socket_translator,
|
json_socket_translator,
|
||||||
json_translator,
|
json_translator,
|
||||||
sqlite_actor,
|
|
||||||
webhooks,
|
webhooks,
|
||||||
websockets]
|
websockets]
|
||||||
|
|
||||||
when withPostgre:
|
when withPostgre:
|
||||||
import ./syndesizer/postgre_actor
|
import ./syndesizer/postgre_actor
|
||||||
|
|
||||||
|
when withSqlite:
|
||||||
|
import ./syndesizer/sqlite_actor
|
||||||
|
|
||||||
runActor("syndesizer") do (turn: var Turn; root: Cap):
|
runActor("syndesizer") do (turn: var Turn; root: Cap):
|
||||||
connectStdio(turn, root)
|
connectStdio(turn, root)
|
||||||
discard spawnTimers(turn, root)
|
discard spawnTimers(turn, root)
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
# SPDX-FileCopyrightText: ☭ Emery Hemingway
|
# SPDX-FileCopyrightText: ☭ Emery Hemingway
|
||||||
# SPDX-License-Identifier: Unlicense
|
# SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
const withSqlite* {.booldefine.}: bool = true
|
|
||||||
|
|
||||||
when withSqlite:
|
|
||||||
import preserves, syndicate, syndicate/relays
|
import preserves, syndicate, syndicate/relays
|
||||||
import ../schema/[config, sql]
|
import ../schema/[config, sql]
|
||||||
|
|
||||||
|
@ -63,9 +60,9 @@ when withSqlite:
|
||||||
proc extractValue(stmt: Stmt; col: cint): Value =
|
proc extractValue(stmt: Stmt; col: cint): Value =
|
||||||
case column_type(stmt, col)
|
case column_type(stmt, col)
|
||||||
of SQLITE_INTEGER:
|
of SQLITE_INTEGER:
|
||||||
result = toPreserve(column_int64(stmt, col))
|
result = toPreserves(column_int64(stmt, col))
|
||||||
of SQLITE_FLOAT:
|
of SQLITE_FLOAT:
|
||||||
result = toPreserve(column_double(stmt, col))
|
result = toPreserves(column_double(stmt, col))
|
||||||
of SQLITE_TEXT:
|
of SQLITE_TEXT:
|
||||||
result = Value(kind: pkString, string: newString(column_bytes(stmt, col)))
|
result = Value(kind: pkString, string: newString(column_bytes(stmt, col)))
|
||||||
if result.string.len > 0:
|
if result.string.len > 0:
|
||||||
|
|
Loading…
Reference in New Issue