我知道 PouchDB 仅适用于 CouchDB 兼容服务器。有没有办法在保持其原始架构的同时使用 SQL Server 作为后端?
我有一个想法如何实现这一点,但我不完全确定它是否可行。任何将导致这一结果的答案将不胜感激。
我认为可以完成的方法是使用 CouchDB 来存储同步元数据,如修订和成功同步所需的所有内容。然后,实际最新数据将按照其原始架构存储在 SQL Server 上。
为了能够做到这一点,我需要使用我的 C# 堆栈创建一个 CouchDB 兼容服务器。这将充当 CouchDB 和 PouchDB 之间的代理,因此我实际上不需要实现所有方法。我将不得不拦截某些方法,这些方法将允许我在服务器上保持 SQL Server 和 CouchDB 同步(遵循业务规则),同时利用 CouchDB 对 SQL Server 数据的同步功能。有了这个,我还可以添加一堆我希望将来使用的中间件。
这东西可行吗?我知道 express-pouchdb 存在,但它只是一个带有 PouchDB 后端的 CouchDB 兼容服务器。我想要的是让 CouchDB 和 SQL Server 一起工作。如果是这样,我应该怎么做?
这是我的appsettings.json文件
{
"ConnectionStrings": {
"DefaultConnection": "Host=localhost;Port=5432;Database=db;User ID=postgres;Password=root"
},
"Logging": {
"IncludeScopes": false,
"LogLevel": {
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
}
}
}
Run Code Online (Sandbox Code Playgroud)
这是我检索连接字符串的方式:
// Only works when run through visual studio not on vs code
Configuration.GetConnectionString("DefaultConnection")
Run Code Online (Sandbox Code Playgroud)
我的launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (web)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceRoot}\\src\\Chlx\\bin\\Debug\\netcoreapp1.0\\Chlx.dll",
"args": [],
"cwd": "${workspaceRoot}",
"stopAtEntry": false,
"internalConsoleOptions": "openOnSessionStart",
"launchBrowser": {
"enabled": true,
"args": "${auto-detect-url}",
"windows": {
"command": "cmd.exe",
"args": "/C …Run Code Online (Sandbox Code Playgroud) connection-string npgsql visual-studio-2015 visual-studio-code asp.net-core
嗨,我想匹配一个字符串:
"\par hello \par world"
反对我的正则表达式 - > \\par
但是,我得到了一个 Compilation failed: unknown property name after \P or \p
我相信我的正则表达式规则被视为unicode字符属性.如何逃避它并按原样运行模式?
我将它包含在PDO函数中.
function sqlite_regExp($sql,$db)
{
if($db->sqliteCreateFunction("regexp", "preg_match", 2) === FALSE) exit("Failed creating function!");
if($res = $db->query($sql)->fetchAll()){ return $res; }
else return false;
}
Run Code Online (Sandbox Code Playgroud)
我这样称呼函数
sqlite_regExp("SELECT COUNT(*) FROM table WHERE REGEXP('/\\par/',column) ",$db)
Run Code Online (Sandbox Code Playgroud) 我看到一个名为"do"的方法库
public function do
Run Code Online (Sandbox Code Playgroud)
完全错误解析器解析错误:语法错误,意外T_DO,期待T_STRING ...
//same on call
$obj->do()
Run Code Online (Sandbox Code Playgroud)
解析错误:语法错误,意外T_DO,期待T_STRING或T_VARIABLE或'$'in
Gearman顺便使用"do"功能.
这就是我提出的.
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape android:shape="rectangle" >
<solid android:color="@color/grey" />
<padding
android:bottom="1dp" />
<corners
android:radius="0dp"/>
</shape>
</item>
<item>
<shape android:shape="rectangle" >
<solid android:color="@color/white" />
<corners
android:radius="1dp"
android:bottomRightRadius="0dp"
android:bottomLeftRadius="0dp"
android:topLeftRadius="5dp"
android:topRightRadius="5dp"/>
</shape>
</item>
</layer-list>
Run Code Online (Sandbox Code Playgroud)
这是有效的,但是底部半径显示我放在它上面的任何值.
实际上只需要topLeftRadius让它看起来像这样
<corners
android:bottomRightRadius="0dp"
android:bottomLeftRadius="0dp"
android:topLeftRadius="5dp"
android:topRightRadius="0dp"/>
Run Code Online (Sandbox Code Playgroud)

我该如何调用此功能?
public static HtmlString DropdownForEnum<TModel>(this HtmlHelper<TModel> helper, Type type,
string name, string optionLabel, object htmlAttributes)
Run Code Online (Sandbox Code Playgroud)